diff options
Diffstat (limited to 'pd/src/d_dac.c')
-rw-r--r-- | pd/src/d_dac.c | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/pd/src/d_dac.c b/pd/src/d_dac.c index 1606b3a1..77643844 100644 --- a/pd/src/d_dac.c +++ b/pd/src/d_dac.c @@ -26,17 +26,17 @@ static void *dac_new(t_symbol *s, int argc, t_atom *argv) int i; if (!argc) { - argv = defarg; - argc = 2; - SETFLOAT(&defarg[0], 1); - SETFLOAT(&defarg[1], 2); + argv = defarg; + argc = 2; + SETFLOAT(&defarg[0], 1); + SETFLOAT(&defarg[1], 2); } x->x_n = argc; x->x_vec = (t_int *)getbytes(argc * sizeof(*x->x_vec)); for (i = 0; i < argc; i++) - x->x_vec[i] = atom_getintarg(i, argc, argv); + x->x_vec[i] = atom_getintarg(i, argc, argv); for (i = 1; i < argc; i++) - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); x->x_f = 0; return (x); } @@ -47,12 +47,12 @@ static void dac_dsp(t_dac *x, t_signal **sp) t_signal **sp2; for (i = x->x_n, ip = x->x_vec, sp2 = sp; i--; ip++, sp2++) { - int ch = *ip - 1; - if ((*sp2)->s_n != DEFDACBLKSIZE) - error("dac~: bad vector size"); - else if (ch >= 0 && ch < sys_get_outchannels()) - dsp_add(plus_perform, 4, sys_soundout + DEFDACBLKSIZE*ch, - (*sp2)->s_vec, sys_soundout + DEFDACBLKSIZE*ch, DEFDACBLKSIZE); + int ch = *ip - 1; + if ((*sp2)->s_n != DEFDACBLKSIZE) + error("dac~: bad vector size"); + else if (ch >= 0 && ch < sys_get_outchannels()) + dsp_add(plus_perform, 4, sys_soundout + DEFDACBLKSIZE*ch, + (*sp2)->s_vec, sys_soundout + DEFDACBLKSIZE*ch, DEFDACBLKSIZE); } } @@ -64,7 +64,7 @@ static void dac_free(t_dac *x) static void dac_setup(void) { dac_class = class_new(gensym("dac~"), (t_newmethod)dac_new, - (t_method)dac_free, sizeof(t_dac), 0, A_GIMME, 0); + (t_method)dac_free, sizeof(t_dac), 0, A_GIMME, 0); CLASS_MAINSIGNALIN(dac_class, t_dac, x_f); class_addmethod(dac_class, (t_method)dac_dsp, gensym("dsp"), A_CANT, 0); class_sethelpsymbol(dac_class, gensym("adc~_dac~")); @@ -87,17 +87,17 @@ static void *adc_new(t_symbol *s, int argc, t_atom *argv) int i; if (!argc) { - argv = defarg; - argc = 2; - SETFLOAT(&defarg[0], 1); - SETFLOAT(&defarg[1], 2); + argv = defarg; + argc = 2; + SETFLOAT(&defarg[0], 1); + SETFLOAT(&defarg[1], 2); } x->x_n = argc; x->x_vec = (t_int *)getbytes(argc * sizeof(*x->x_vec)); for (i = 0; i < argc; i++) - x->x_vec[i] = atom_getintarg(i, argc, argv); + x->x_vec[i] = atom_getintarg(i, argc, argv); for (i = 0; i < argc; i++) - outlet_new(&x->x_obj, &s_signal); + outlet_new(&x->x_obj, &s_signal); return (x); } @@ -118,23 +118,23 @@ t_int *copy_perf8(t_int *w) for (; n; n -= 8, in1 += 8, out += 8) { - float f0 = in1[0]; - float f1 = in1[1]; - float f2 = in1[2]; - float f3 = in1[3]; - float f4 = in1[4]; - float f5 = in1[5]; - float f6 = in1[6]; - float f7 = in1[7]; - - out[0] = f0; - out[1] = f1; - out[2] = f2; - out[3] = f3; - out[4] = f4; - out[5] = f5; - out[6] = f6; - out[7] = f7; + float f0 = in1[0]; + float f1 = in1[1]; + float f2 = in1[2]; + float f3 = in1[3]; + float f4 = in1[4]; + float f5 = in1[5]; + float f6 = in1[6]; + float f7 = in1[7]; + + out[0] = f0; + out[1] = f1; + out[2] = f2; + out[3] = f3; + out[4] = f4; + out[5] = f5; + out[6] = f6; + out[7] = f7; } return (w+4); } @@ -142,9 +142,9 @@ t_int *copy_perf8(t_int *w) void dsp_add_copy(t_sample *in, t_sample *out, int n) { if (n&7) - dsp_add(copy_perform, 3, in, out, n); - else - dsp_add(copy_perf8, 3, in, out, n); + dsp_add(copy_perform, 3, in, out, n); + else + dsp_add(copy_perf8, 3, in, out, n); } static void adc_dsp(t_adc *x, t_signal **sp) @@ -153,13 +153,13 @@ static void adc_dsp(t_adc *x, t_signal **sp) t_signal **sp2; for (i = x->x_n, ip = x->x_vec, sp2 = sp; i--; ip++, sp2++) { - int ch = *ip - 1; - if ((*sp2)->s_n != DEFDACBLKSIZE) - error("adc~: bad vector size"); - else if (ch >= 0 && ch < sys_get_inchannels()) - dsp_add_copy(sys_soundin + DEFDACBLKSIZE*ch, - (*sp2)->s_vec, DEFDACBLKSIZE); - else dsp_add_zero((*sp2)->s_vec, DEFDACBLKSIZE); + int ch = *ip - 1; + if ((*sp2)->s_n != DEFDACBLKSIZE) + error("adc~: bad vector size"); + else if (ch >= 0 && ch < sys_get_inchannels()) + dsp_add_copy(sys_soundin + DEFDACBLKSIZE*ch, + (*sp2)->s_vec, DEFDACBLKSIZE); + else dsp_add_zero((*sp2)->s_vec, DEFDACBLKSIZE); } } @@ -171,7 +171,7 @@ static void adc_free(t_adc *x) static void adc_setup(void) { adc_class = class_new(gensym("adc~"), (t_newmethod)adc_new, - (t_method)adc_free, sizeof(t_adc), 0, A_GIMME, 0); + (t_method)adc_free, sizeof(t_adc), 0, A_GIMME, 0); class_addmethod(adc_class, (t_method)adc_dsp, gensym("dsp"), A_CANT, 0); class_sethelpsymbol(adc_class, gensym("adc~_dac~")); } |