当前位置: 首页>>代码示例>>C++>>正文


C++ plumber_add_ugen函数代码示例

本文整理汇总了C++中plumber_add_ugen函数的典型用法代码示例。如果您正苦于以下问题:C++ plumber_add_ugen函数的具体用法?C++ plumber_add_ugen怎么用?C++ plumber_add_ugen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了plumber_add_ugen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sporth_waveset

int sporth_waveset(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT input;
    SPFLOAT out;
    SPFLOAT ilen;
    SPFLOAT rep;
    sp_waveset *waveset;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            plumber_print(pd, "waveset: Creating\n");
#endif

            sp_waveset_create(&waveset);
            plumber_add_ugen(pd, SPORTH_WAVESET, waveset);
            if(sporth_check_args(stack, "fff") != SPORTH_OK) {
                plumber_print(pd,"Not enough arguments for waveset\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            ilen = sporth_stack_pop_float(stack);
            rep = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            plumber_print(pd, "waveset: Initialising\n");
#endif

            ilen = sporth_stack_pop_float(stack);
            rep = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            waveset = pd->last->ud;
            sp_waveset_init(pd->sp, waveset, ilen);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            ilen = sporth_stack_pop_float(stack);
            rep = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            waveset = pd->last->ud;
            waveset->rep = rep;
            sp_waveset_compute(pd->sp, waveset, &input, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            waveset = pd->last->ud;
            sp_waveset_destroy(&waveset);
            break;
        default:
            plumber_print(pd, "waveset: Unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:PaulBatchelor,项目名称:AudioKit,代码行数:60,代码来源:waveset.c

示例2: sporth_ref

int sporth_ref(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    char *str;
    switch(pd->mode) {
        case PLUMBER_CREATE: 
            plumber_add_ugen(pd, SPORTH_REF, NULL);
            if(sporth_check_args(stack, "s") != SPORTH_OK) {
                stack->error++;
                fprintf(stderr, "ref: Invalid arguments.");
                return PLUMBER_NOTOK;
            }
            sporth_stack_pop_string(stack);
            break;
        case PLUMBER_INIT: 
            str = sporth_stack_pop_string(stack);
            plumber_ftmap_delete(pd, 0);
            /* get reference of the *next* pipe in the plumbing */
            plumber_ftmap_add_userdata(pd, str, pd->next->ud);
            plumber_ftmap_delete(pd, 1);
            break;
        case PLUMBER_COMPUTE: 
            break;
        case PLUMBER_DESTROY: 
            break;
    }
    return PLUMBER_OK;
}
开发者ID:Luckyncl,项目名称:3rd,代码行数:28,代码来源:ref.c

示例3: sporth_in

int sporth_in(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;

    SPFLOAT out;
    sp_in *data;
    switch(pd->mode){
        case PLUMBER_CREATE:
            sp_in_create(&data);
            plumber_add_ugen(pd, SPORTH_IN, data);
            break;
        case PLUMBER_INIT:
            data = pd->last->ud;
            sp_in_init(pd->sp, data);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            data = pd->last->ud;
            sp_in_compute(pd->sp, data, NULL, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            data = pd->last->ud;
            sp_in_destroy(&data);
            break;
        default:
           printf("Error: Unknown mode!");
           break;
    }
    return PLUMBER_OK;
}
开发者ID:BillGrim,项目名称:AudioKit,代码行数:31,代码来源:in.c

示例4: sporth_palias

int sporth_palias(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    char *name;
    int id;
    SPFLOAT *foo;

    switch(pd->mode) {
        case PLUMBER_CREATE:
            plumber_add_ugen(pd, SPORTH_PALIAS, NULL);
            if(sporth_check_args(stack, "sf") != SPORTH_OK) {
                fprintf(stderr,"palias: Not enough arguments\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            id = floor(sporth_stack_pop_float(stack));
            name = sporth_stack_pop_string(stack);
            foo = &pd->p[id];
            plumber_ftmap_delete(pd, 0);
            plumber_set_var(pd, name, foo);
            plumber_ftmap_delete(pd, 1);
            break;
        case PLUMBER_INIT:
            sporth_stack_pop_float(stack);
            sporth_stack_pop_string(stack);
            break;
        case PLUMBER_COMPUTE:
            sporth_stack_pop_float(stack);
            break;
        default:
            break;
    }

    return PLUMBER_OK;
}
开发者ID:aure,项目名称:Sporth,代码行数:35,代码来源:p.c

示例5: sporth_crossfade

int sporth_crossfade(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT in1;
    SPFLOAT in2;
    SPFLOAT out;
    SPFLOAT pos;
    sp_crossfade *crossfade;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            plumber_print(pd, "crossfade: Creating\n");
#endif

            sp_crossfade_create(&crossfade);
            plumber_add_ugen(pd, SPORTH_CROSSFADE, crossfade);
            if(sporth_check_args(stack, "fff") != SPORTH_OK) {
                plumber_print(pd,"Not enough arguments for crossfade\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            pos = sporth_stack_pop_float(stack);
            in1 = sporth_stack_pop_float(stack);
            in2 = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            plumber_print(pd, "crossfade: Initialising\n");
#endif

            pos = sporth_stack_pop_float(stack);
            in1 = sporth_stack_pop_float(stack);
            in2 = sporth_stack_pop_float(stack);
            crossfade = pd->last->ud;
            sp_crossfade_init(pd->sp, crossfade);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            pos = sporth_stack_pop_float(stack);
            in1 = sporth_stack_pop_float(stack);
            in2 = sporth_stack_pop_float(stack);
            crossfade = pd->last->ud;
            crossfade->pos = pos;
            sp_crossfade_compute(pd->sp, crossfade, &in1, &in2, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            crossfade = pd->last->ud;
            sp_crossfade_destroy(&crossfade);
            break;
        default:
            plumber_print(pd, "crossfade: Unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:PaulBatchelor,项目名称:AudioKit,代码行数:60,代码来源:crossfade.c

示例6: sporth_f

int sporth_f(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    unsigned int fnum;
    sporth_func_d *fd;
    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "aux (f)unction: creating\n");
#endif
            fd = malloc(sizeof(sporth_func_d));
           if(sporth_check_args(stack, "f") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for aux (f)unction\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            plumber_add_ugen(pd, SPORTH_F, fd);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "aux (f)unction: initialising\n");
#endif
            fnum = (int)sporth_stack_pop_float(stack);

            if(fnum > 16) {
                fprintf(stderr, "Invalid function number %d\n", fnum);
                stack->error++;
                return PLUMBER_NOTOK;
            }

            fd = pd->last->ud;
            fd->fun = pd->f[fnum];

            pd->mode = PLUMBER_CREATE;
            fd->fun(stack, ud);

            pd->mode = PLUMBER_INIT;
            fd->fun(stack, ud);

            break;

        case PLUMBER_COMPUTE:
            fnum = (int)sporth_stack_pop_float(stack);
            fd = pd->last->ud;
            fd->fun(stack, ud);
            break;

        case PLUMBER_DESTROY:
            fd = pd->last->ud;
            fd->fun(stack, ud);
            free(fd);
            break;
        default:
            fprintf(stderr, "aux (f)unction: unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:laurentVeliscek,项目名称:AudioKit,代码行数:60,代码来源:f.c

示例7: sporth_delay

int sporth_delay(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT input;
    SPFLOAT out;
    SPFLOAT time;
    SPFLOAT feedback;
    sp_delay *delay;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "delay: Creating\n");
#endif

            sp_delay_create(&delay);
            plumber_add_ugen(pd, SPORTH_DELAY, delay);
            if(sporth_check_args(stack, "fff") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for delay\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            time = sporth_stack_pop_float(stack);
            feedback = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "delay: Initialising\n");
#endif

            time = sporth_stack_pop_float(stack);
            feedback = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            delay = pd->last->ud;
            sp_delay_init(pd->sp, delay, time);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            time = sporth_stack_pop_float(stack);
            feedback = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            delay = pd->last->ud;
            delay->feedback = feedback;
            sp_delay_compute(pd->sp, delay, &input, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            delay = pd->last->ud;
            sp_delay_destroy(&delay);
            break;
        default:
            fprintf(stderr, "delay: Unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:Ferrick90,项目名称:AudioKit,代码行数:60,代码来源:delay.c

示例8: sporth_moogladder

int sporth_moogladder(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT input;
    SPFLOAT out;
    SPFLOAT freq;
    SPFLOAT res;
    sp_moogladder *moogladder;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "moogladder: Creating\n");
#endif

            sp_moogladder_create(&moogladder);
            plumber_add_ugen(pd, SPORTH_MOOGLADDER, moogladder);
            if(sporth_check_args(stack, "fff") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for moogladder\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            res = sporth_stack_pop_float(stack);
            freq = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "moogladder: Initialising\n");
#endif
            res = sporth_stack_pop_float(stack);
            freq = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            moogladder = pd->last->ud;
            sp_moogladder_init(pd->sp, moogladder);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            res = sporth_stack_pop_float(stack);
            freq = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            moogladder = pd->last->ud;
            moogladder->freq = freq;
            moogladder->res = res;
            sp_moogladder_compute(pd->sp, moogladder, &input, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            moogladder = pd->last->ud;
            sp_moogladder_destroy(&moogladder);
            break;
        default:
            fprintf(stderr, "moogladder: Unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:Ferrick90,项目名称:AudioKit,代码行数:60,代码来源:moogladder.c

示例9: sporth_comb

int sporth_comb(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT input;
    SPFLOAT out;
    SPFLOAT looptime;
    SPFLOAT revtime;
    sp_comb *comb;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            plumber_print(pd, "comb: Creating\n");
#endif

            sp_comb_create(&comb);
            plumber_add_ugen(pd, SPORTH_COMB, comb);
            if(sporth_check_args(stack, "fff") != SPORTH_OK) {
                plumber_print(pd,"Not enough arguments for comb\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            looptime = sporth_stack_pop_float(stack);
            revtime = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            plumber_print(pd, "comb: Initialising\n");
#endif

            looptime = sporth_stack_pop_float(stack);
            revtime = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            comb = pd->last->ud;
            sp_comb_init(pd->sp, comb, looptime);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            looptime = sporth_stack_pop_float(stack);
            revtime = sporth_stack_pop_float(stack);
            input = sporth_stack_pop_float(stack);
            comb = pd->last->ud;
            comb->revtime = revtime;
            sp_comb_compute(pd->sp, comb, &input, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            comb = pd->last->ud;
            sp_comb_destroy(&comb);
            break;
        default:
            plumber_print(pd, "comb: Unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:PaulBatchelor,项目名称:AudioKit,代码行数:60,代码来源:comb.c

示例10: sporth_bpm2dur

int sporth_bpm2dur(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    bpm2val *data;
    SPFLOAT val;
    switch(pd->mode){
        case PLUMBER_CREATE:
#ifdef DEBUG_MODE
            fprintf(stderr, "bpm2dur: Creating\n");
#endif
            data = malloc(sizeof(bpm2val));
            data->pbpm = -100;
            data->val= -100;
            if(sporth_check_args(stack, "f") != SPORTH_OK) {
                fprintf(stderr, "bpm2dur: not enough args\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            val = sporth_stack_pop_float(stack);
            data->pbpm= val;
            data->val= 60.0 / val;
            plumber_add_ugen(pd, SPORTH_BPM2DUR, data);
            sporth_stack_push_float(stack, data->val);
            break;
        case PLUMBER_INIT:
#ifdef DEBUG_MODE
            fprintf(stderr, "bpm2dur: Initializing\n");
#endif
            data = pd->last->ud;
            val = sporth_stack_pop_float(stack);

            if(data->pbpm != val) {
                data->pbpm= val;
                data->val= 60.0 / val;
            }

            sporth_stack_push_float(stack, data->val);
            break;
        case PLUMBER_COMPUTE:
            data = pd->last->ud;
            val = sporth_stack_pop_float(stack);
            if(data->pbpm  != val) {
                data->pbpm= val;
                data->val = 60.0 / val;
            }
            sporth_stack_push_float(stack, data->val);
            break;
        case PLUMBER_DESTROY:
            data = pd->last->ud;
            free(data);
            break;
        default:
            fprintf(stderr,"bpm2dur: unknown mode!");
            stack->error++;
            return PLUMBER_NOTOK;
            break;
    }
    return PLUMBER_OK;
}
开发者ID:Ferrick90,项目名称:AudioKit,代码行数:59,代码来源:bpm.c

示例11: sporth_maygate

int sporth_maygate(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT trig;
    SPFLOAT out;
    SPFLOAT prob;
    sp_maygate *maygate;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "maygate: Creating\n");
#endif

            sp_maygate_create(&maygate);
            plumber_add_ugen(pd, SPORTH_MAYGATE, maygate);
            if(sporth_check_args(stack, "ff") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for maygate\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            prob = sporth_stack_pop_float(stack);
            trig = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "maygate: Initialising\n");
#endif

            prob = sporth_stack_pop_float(stack);
            trig = sporth_stack_pop_float(stack);
            maygate = pd->last->ud;
            sp_maygate_init(pd->sp, maygate);
            maygate->mode = 0;
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            prob = sporth_stack_pop_float(stack);
            trig = sporth_stack_pop_float(stack);
            maygate = pd->last->ud;
            maygate->prob = prob;
            sp_maygate_compute(pd->sp, maygate, &trig, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            maygate = pd->last->ud;
            sp_maygate_destroy(&maygate);
            break;
        default:
            fprintf(stderr, "maygate: Unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:Ferrick90,项目名称:AudioKit,代码行数:57,代码来源:maygate.c

示例12: sporth_print

int sporth_print(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    sporth_print_d *prnt;
    char *str = NULL; 
    SPFLOAT val = 0;
    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "print: Creating\n");
#endif
            prnt = malloc(sizeof(sporth_print_d));
            plumber_add_ugen(pd, SPORTH_PRINT, prnt);
            if(sporth_check_args(stack, "fs") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for print\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            str = sporth_stack_pop_string(stack);
            val = sporth_stack_pop_float(stack);
            
            strncpy(prnt->label, str, 128);
            prnt->pval = val; 
            prnt->init = 1;
            sporth_stack_push_float(stack, val);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "print: Initialising\n");
#endif
            prnt = pd->last->ud;
            str = sporth_stack_pop_string(stack);
            val = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, val);
            break;
        case PLUMBER_COMPUTE:
            prnt = pd->last->ud;
            val = sporth_stack_pop_float(stack);
            if(val != prnt->pval || prnt->init) {
                prnt->pval = val;
                prnt->init = 0;
                printf("%s: %g\n", prnt->label, val);
            }
            sporth_stack_push_float(stack, val);
            break;
        case PLUMBER_DESTROY:
            prnt = pd->last->ud;
            free(prnt);
            break;
        default:
            fprintf(stderr, "print: Unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:laurentVeliscek,项目名称:AudioKit,代码行数:57,代码来源:print.c

示例13: sporth_dmetro

int sporth_dmetro(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT out;
    SPFLOAT time;
    sp_dmetro *dmetro;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "dmetro: Creating\n");
#endif

            sp_dmetro_create(&dmetro);
            plumber_add_ugen(pd, SPORTH_DMETRO, dmetro);
            if(sporth_check_args(stack, "f") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for dmetro\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            time = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "dmetro: Initialising\n");
#endif

            time = sporth_stack_pop_float(stack);
            dmetro = pd->last->ud;
            sp_dmetro_init(pd->sp, dmetro);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            if(sporth_check_args(stack, "f") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for dmetro\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            time = sporth_stack_pop_float(stack);
            dmetro = pd->last->ud;
            dmetro->time = time;
            sp_dmetro_compute(pd->sp, dmetro, NULL, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            dmetro = pd->last->ud;
            sp_dmetro_destroy(&dmetro);
            break;
        default:
            fprintf(stderr, "dmetro: Uknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:BillGrim,项目名称:AudioKit,代码行数:57,代码来源:dmetro.c

示例14: sporth_pdhalf

int sporth_pdhalf(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT sig;
    SPFLOAT out;
    SPFLOAT amount;
    sp_pdhalf *pdhalf;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "pdhalf: Creating\n");
#endif

            sp_pdhalf_create(&pdhalf);
            plumber_add_ugen(pd, SPORTH_PDHALF, pdhalf);
            if(sporth_check_args(stack, "ff") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for pdhalf\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            amount = sporth_stack_pop_float(stack);
            sig = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "pdhalf: Initialising\n");
#endif

            amount = sporth_stack_pop_float(stack);
            sig = sporth_stack_pop_float(stack);
            pdhalf = pd->last->ud;
            sp_pdhalf_init(pd->sp, pdhalf);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            amount = sporth_stack_pop_float(stack);
            sig = sporth_stack_pop_float(stack);
            pdhalf = pd->last->ud;
            pdhalf->amount = amount;
            sp_pdhalf_compute(pd->sp, pdhalf, &sig, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            pdhalf = pd->last->ud;
            sp_pdhalf_destroy(&pdhalf);
            break;
        default:
            fprintf(stderr, "pdhalf: Unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:Luckyncl,项目名称:3rd,代码行数:56,代码来源:pdhalf.c

示例15: sporth_blsaw

int sporth_blsaw(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT out;
    SPFLOAT freq;
    SPFLOAT amp;
    sp_blsaw *blsaw;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "blsaw: Creating\n");
#endif

            sp_blsaw_create(&blsaw);
            plumber_add_ugen(pd, SPORTH_SAW, blsaw);
            if(sporth_check_args(stack, "ff") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for blsaw\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            amp = sporth_stack_pop_float(stack);
            freq = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "blsaw: Initialising\n");
#endif
            amp = sporth_stack_pop_float(stack);
            freq = sporth_stack_pop_float(stack);
            blsaw = pd->last->ud;
            sp_blsaw_init(pd->sp, blsaw);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            amp = sporth_stack_pop_float(stack);
            freq = sporth_stack_pop_float(stack);
            blsaw = pd->last->ud;
            *blsaw->freq = freq;
            *blsaw->amp = amp;
            sp_blsaw_compute(pd->sp, blsaw, NULL, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            blsaw = pd->last->ud;
            sp_blsaw_destroy(&blsaw);
            break;
        default:
            fprintf(stderr, "blsaw: Unknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
开发者ID:Ferrick90,项目名称:AudioKit,代码行数:56,代码来源:blsaw.c


注:本文中的plumber_add_ugen函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。