Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25408
Modified Files: Tag: desiredata builtins_dsp.c Log Message: removed useless gensym and merged _perform into FUNC1 macro
Index: builtins_dsp.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/builtins_dsp.c,v retrieving revision 1.1.2.18 retrieving revision 1.1.2.19 diff -C2 -d -r1.1.2.18 -r1.1.2.19 *** builtins_dsp.c 9 Jan 2007 20:09:02 -0000 1.1.2.18 --- builtins_dsp.c 9 Jan 2007 22:30:24 -0000 1.1.2.19 *************** *** 439,443 **** x->arrayname = s; x->vec = 0; ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 439,443 ---- x->arrayname = s; x->vec = 0; ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 498,502 **** x->arrayname = s; x->vec = 0; ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 498,502 ---- x->arrayname = s; x->vec = 0; ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 606,610 **** x->fnpoints = 512.; x->finvnpoints = (1./512.); ! outlet_new(x, gensym("signal")); inlet_new(x, x, &s_float, gensym("ft1")); x->a = 0; --- 606,610 ---- x->fnpoints = 512.; x->finvnpoints = (1./512.); ! outlet_new(x, &s_signal); inlet_new(x, x, &s_float, gensym("ft1")); x->a = 0; *************** *** 997,1001 **** t_sig *x = (t_sig *)pd_new(sig_tilde_class); x->a = f; ! outlet_new(x, gensym("signal")); return x; } --- 997,1001 ---- t_sig *x = (t_sig *)pd_new(sig_tilde_class); x->a = f; ! outlet_new(x, &s_signal); return x; } *************** *** 1148,1152 **** static void *line_tilde_new() { t_line *x = (t_line *)pd_new(line_tilde_class); ! outlet_new(x, gensym("signal")); floatinlet_new(x, &x->inletvalue); x->ticksleft = x->retarget = 0; --- 1148,1152 ---- static void *line_tilde_new() { t_line *x = (t_line *)pd_new(line_tilde_class); ! outlet_new(x, &s_signal); floatinlet_new(x, &x->inletvalue); x->ticksleft = x->retarget = 0; *************** *** 1296,1300 **** static void *vline_tilde_new() { t_vline *x = (t_vline *)pd_new(vline_tilde_class); ! outlet_new(x, gensym("signal")); floatinlet_new(x, &x->inlet1); floatinlet_new(x, &x->inlet2); --- 1296,1300 ---- static void *vline_tilde_new() { t_vline *x = (t_vline *)pd_new(vline_tilde_class); ! outlet_new(x, &s_signal); floatinlet_new(x, &x->inlet1); floatinlet_new(x, &x->inlet2); *************** *** 1447,1451 **** for (; i < npoints+MAXVSTAKEN; i++) buf[i] = 0; x->clock = clock_new(x, env_tilde_tick); ! x->outlet = outlet_new(x, gensym("float")); x->a = 0; return x; --- 1447,1451 ---- for (; i < npoints+MAXVSTAKEN; i++) buf[i] = 0; x->clock = clock_new(x, env_tilde_tick); ! x->outlet = outlet_new(x, &s_float); x->a = 0; return x; *************** *** 1644,1650 **** dsp_add(threshold_tilde_perform, 3, sp[0]->v, x, sp[0]->n); } ! static void threshold_tilde_ff(t_threshold_tilde *x) { ! clock_free(x->clock); ! } static void threshold_tilde_setup() { t_class *c = threshold_tilde_class = --- 1644,1648 ---- dsp_add(threshold_tilde_perform, 3, sp[0]->v, x, sp[0]->n); } ! static void threshold_tilde_ff(t_threshold_tilde *x) {clock_free(x->clock);} static void threshold_tilde_setup() { t_class *c = threshold_tilde_class = *************** *** 2106,2111 **** static void *sigfft_new() { t_sigfft *x = (t_sigfft *)pd_new(sigfft_class); ! outlet_new(x, gensym("signal")); ! outlet_new(x, gensym("signal")); inlet_new(x, x, &s_signal, &s_signal); x->a = 0; --- 2104,2109 ---- static void *sigfft_new() { t_sigfft *x = (t_sigfft *)pd_new(sigfft_class); ! outlet_new(x, &s_signal); ! outlet_new(x, &s_signal); inlet_new(x, x, &s_signal, &s_signal); x->a = 0; *************** *** 2115,2120 **** static void *sigifft_new() { t_sigfft *x = (t_sigfft *)pd_new(sigifft_class); ! outlet_new(x, gensym("signal")); ! outlet_new(x, gensym("signal")); inlet_new(x, x, &s_signal, &s_signal); x->a = 0; --- 2113,2118 ---- static void *sigifft_new() { t_sigfft *x = (t_sigfft *)pd_new(sigifft_class); ! outlet_new(x, &s_signal); ! outlet_new(x, &s_signal); inlet_new(x, x, &s_signal, &s_signal); x->a = 0; *************** *** 2187,2192 **** static void *sigrfft_new() { t_sigrfft *x = (t_sigrfft *)pd_new(sigrfft_class); ! outlet_new(x, gensym("signal")); ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 2185,2190 ---- static void *sigrfft_new() { t_sigrfft *x = (t_sigrfft *)pd_new(sigrfft_class); ! outlet_new(x, &s_signal); ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 2243,2247 **** t_sigrifft *x = (t_sigrifft *)pd_new(sigrifft_class); inlet_new(x, x, &s_signal, &s_signal); ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 2241,2245 ---- t_sigrifft *x = (t_sigrifft *)pd_new(sigrifft_class); inlet_new(x, x, &s_signal, &s_signal); ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 2287,2292 **** static void *sigfftw_new() { t_sigfftw *x = (t_sigfftw *)pd_new(sigfftw_class); ! outlet_new(x, gensym("signal")); ! outlet_new(x, gensym("signal")); inlet_new(x, x, &s_signal, &s_signal); x->a = 0; --- 2285,2290 ---- static void *sigfftw_new() { t_sigfftw *x = (t_sigfftw *)pd_new(sigfftw_class); ! outlet_new(x, &s_signal); ! outlet_new(x, &s_signal); inlet_new(x, x, &s_signal, &s_signal); x->a = 0; *************** *** 2343,2348 **** static void *sigrfftw_new() { t_sigrfftw *x = (t_sigrfftw *)pd_new(sigrfftw_class); ! outlet_new(x, gensym("signal")); ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 2341,2346 ---- static void *sigrfftw_new() { t_sigrfftw *x = (t_sigrfftw *)pd_new(sigrfftw_class); ! outlet_new(x, &s_signal); ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 2400,2404 **** t_sigrifftw *x = (t_sigrifftw *)pd_new(sigrifftw_class); inlet_new(x, x, &s_signal, &s_signal); ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 2398,2402 ---- t_sigrifftw *x = (t_sigrifftw *)pd_new(sigrifftw_class); inlet_new(x, x, &s_signal, &s_signal); ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 2447,2452 **** t_sigframp *x = (t_sigframp *)pd_new(sigframp_class); inlet_new(x, x, &s_signal, &s_signal); ! outlet_new(x, gensym("signal")); ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 2445,2450 ---- t_sigframp *x = (t_sigframp *)pd_new(sigframp_class); inlet_new(x, x, &s_signal, &s_signal); ! outlet_new(x, &s_signal); ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 2524,2528 **** static void *sighip_new(t_floatarg f) { t_sighip *x = (t_sighip *)pd_new(sighip_class); ! inlet_new(x, x, gensym("float"), gensym("ft1")); outlet_new(x, &s_signal); x->sr = 44100; --- 2522,2526 ---- static void *sighip_new(t_floatarg f) { t_sighip *x = (t_sighip *)pd_new(sighip_class); ! inlet_new(x, x, &s_float, gensym("ft1")); outlet_new(x, &s_signal); x->sr = 44100; *************** *** 2594,2598 **** static void *siglop_new(t_floatarg f) { t_siglop *x = (t_siglop *)pd_new(siglop_class); ! inlet_new(x, x, gensym("float"), gensym("ft1")); outlet_new(x, &s_signal); x->sr = 44100; --- 2592,2596 ---- static void *siglop_new(t_floatarg f) { t_siglop *x = (t_siglop *)pd_new(siglop_class); ! inlet_new(x, x, &s_float, gensym("ft1")); outlet_new(x, &s_signal); x->sr = 44100; *************** *** 2664,2669 **** static void *sigbp_new(t_floatarg f, t_floatarg q) { t_sigbp *x = (t_sigbp *)pd_new(sigbp_class); ! inlet_new(x, x, gensym("float"), gensym("ft1")); ! inlet_new(x, x, gensym("float"), gensym("ft2")); outlet_new(x, &s_signal); x->sr = 44100; --- 2662,2667 ---- static void *sigbp_new(t_floatarg f, t_floatarg q) { t_sigbp *x = (t_sigbp *)pd_new(sigbp_class); ! inlet_new(x, x, &s_float, gensym("ft1")); ! inlet_new(x, x, &s_float, gensym("ft2")); outlet_new(x, &s_signal); x->sr = 44100; *************** *** 3461,3465 **** x->lo = lo; x->hi = hi; ! outlet_new(x, gensym("signal")); floatinlet_new(x, &x->lo); floatinlet_new(x, &x->hi); --- 3459,3463 ---- x->lo = lo; x->hi = hi; ! outlet_new(x, &s_signal); floatinlet_new(x, &x->lo); floatinlet_new(x, &x->hi); *************** *** 3529,3533 **** static void *sigrsqrt_new() { t_sigrsqrt *x = (t_sigrsqrt *)pd_new(sigrsqrt_class); ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 3527,3531 ---- static void *sigrsqrt_new() { t_sigrsqrt *x = (t_sigrsqrt *)pd_new(sigrsqrt_class); ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 3569,3573 **** static void *sigsqrt_new() { t_sigsqrt *x = (t_sigsqrt *)pd_new(sigsqrt_class); ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 3567,3571 ---- static void *sigsqrt_new() { t_sigsqrt *x = (t_sigsqrt *)pd_new(sigsqrt_class); ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 3608,3612 **** static void *sigwrap_new() { t_sigwrap *x = (t_sigwrap *)pd_new(sigwrap_class); ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 3606,3610 ---- static void *sigwrap_new() { t_sigwrap *x = (t_sigwrap *)pd_new(sigwrap_class); ! outlet_new(x, &s_signal); x->a = 0; return x; *************** *** 3640,3704 **** t_class *dbtopow_tilde_class, *powtodb_tilde_class;
! static t_int *mtof_tilde_perform(t_int *w) { ! float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); ! t_int n = *(t_int *)(w+3); ! for (; n--; in++, out++) { ! float f = *in; ! *out = f<=-1500 ? 0 : 8.17579891564 * exp(.0577622650 * min(f,1499.f)); ! } ! return w+4; ! } ! static t_int *ftom_tilde_perform(t_int *w) { ! float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); ! for (t_int n = *(t_int *)(w+3); n--; *in++, out++) { ! float f = *in; ! *out = (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500); ! } ! return w+4; ! } ! static t_int *dbtorms_tilde_perform(t_int *w) { ! float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); ! for (t_int n = *(t_int *)(w+3); n--; in++, out++) { ! float f = *in; ! *out = f<=0 ? 0 : exp((LOGTEN * 0.05) * (min(f,485.f)-100.)); ! } ! return w+4; ! } ! static t_int *rmstodb_tilde_perform(t_int *w) { ! float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); ! for (t_int n = *(t_int *)(w+3); n--; in++, out++) { ! float f = *in; ! *out = f<=0 ? 0 : max(100 + 20./LOGTEN * log(f),0.); ! } ! return w+4; ! } ! static t_int *dbtopow_tilde_perform(t_int *w) { ! float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); ! for (t_int n = *(t_int *)(w+3); n--; in++, out++) { ! float f = *in; ! *out = f<=0 ? 0 : exp((LOGTEN * 0.1) * (min(f,870.f)-100.)); ! } ! return w+4; ! } ! static t_int *powtodb_tilde_perform(t_int *w) { ! float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); ! for (t_int n = *(t_int *)(w+3); n--; in++, out++) { ! float f = *in; ! *out = f<=0 ? 0 : max(100 + 10./LOGTEN * log(f),0.); ! } ! return w+4; ! } ! ! #define FUNC1(NAME) \ static void *NAME##_new() {t_func1 *x = (t_func1 *)pd_new(NAME##_class); \ outlet_new(x,&s_signal); x->a = 0; return x;} \ static void NAME##_dsp(t_func1 *x, t_signal **sp) { \ dsp_add(NAME##_perform, 3, sp[0]->v, sp[1]->v, sp[0]->n);} ! FUNC1(mtof_tilde) ! FUNC1(ftom_tilde) ! FUNC1(dbtorms_tilde) ! FUNC1(dbtopow_tilde) ! FUNC1(rmstodb_tilde) ! FUNC1(powtodb_tilde)
#define FUNC1DECL(NAME,SYM) \ --- 3638,3658 ---- t_class *dbtopow_tilde_class, *powtodb_tilde_class;
! #define FUNC1(NAME,EXPR) \ ! static t_int *NAME##_perform(t_int *w) { \ ! float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); \ ! for (t_int n = *(t_int *)(w+3); n--; in++, out++) { float a = *in; *out = (EXPR); } \ ! return w+4;} \ static void *NAME##_new() {t_func1 *x = (t_func1 *)pd_new(NAME##_class); \ outlet_new(x,&s_signal); x->a = 0; return x;} \ static void NAME##_dsp(t_func1 *x, t_signal **sp) { \ dsp_add(NAME##_perform, 3, sp[0]->v, sp[1]->v, sp[0]->n);} ! ! ! FUNC1(mtof_tilde, a<=-1500 ? 0 : 8.17579891564 * exp(.0577622650 * min(a,1499.f))) ! FUNC1(ftom_tilde, a>0 ? 17.3123405046 * log(.12231220585 * a) : -1500) ! FUNC1(dbtorms_tilde, a<=0 ? 0 : exp((LOGTEN * 0.05) * (min(a,485.f)-100.))) ! FUNC1(dbtopow_tilde, a<=0 ? 0 : max(100 + 20./LOGTEN * log(a),0.)) ! FUNC1(rmstodb_tilde, a<=0 ? 0 : exp((LOGTEN * 0.1) * (min(a,870.f)-100.))) ! FUNC1(powtodb_tilde, a<=0 ? 0 : max(100 + 10./LOGTEN * log(a),0.))
#define FUNC1DECL(NAME,SYM) \ *************** *** 3755,3759 **** static void *print_new(t_symbol *s) { t_print *x = (t_print *)pd_new(print_class); ! x->sym = (s->name[0]? s : gensym("print~")); x->count = 0; x->a = 0; --- 3709,3713 ---- static void *print_new(t_symbol *s) { t_print *x = (t_print *)pd_new(print_class); ! x->sym = s->name[0] ? s : gensym("print~"); x->count = 0; x->a = 0; *************** *** 3806,3810 **** x->phase = 0; x->conv = 0; ! outlet_new(x, gensym("signal")); return x; } --- 3760,3764 ---- x->phase = 0; x->conv = 0; ! outlet_new(x, &s_signal); return x; } *************** *** 3854,3858 **** static void *cos_new() { t_cos *x = (t_cos *)pd_new(cos_class); ! outlet_new(x, gensym("signal")); x->a = 0; return x; --- 3808,3812 ---- static void *cos_new() { t_cos *x = (t_cos *)pd_new(cos_class); ! outlet_new(x,&s_signal); x->a = 0; return x; *************** *** 3936,3940 **** t_osc *x = (t_osc *)pd_new(osc_class); x->a = f; ! outlet_new(x, gensym("signal")); inlet_new(x, x, &s_float, gensym("ft1")); inlet_settip(x->inlet,gensym("phase")); --- 3890,3894 ---- t_osc *x = (t_osc *)pd_new(osc_class); x->a = f; ! outlet_new(x,&s_signal); inlet_new(x, x, &s_float, gensym("ft1")); inlet_settip(x->inlet,gensym("phase")); *************** *** 4026,4032 **** t_sigvcf *x = (t_sigvcf *)pd_new(sigvcf_class); inlet_new(x, x, &s_signal, &s_signal); ! inlet_new(x, x, gensym("float"), gensym("ft1")); ! outlet_new(x, gensym("signal")); ! outlet_new(x, gensym("signal")); x->ctl = &x->cspace; x->cspace.re = 0; --- 3980,3986 ---- t_sigvcf *x = (t_sigvcf *)pd_new(sigvcf_class); inlet_new(x, x, &s_signal, &s_signal); ! inlet_new(x, x, &s_float, gensym("ft1")); ! outlet_new(x, &s_signal); ! outlet_new(x, &s_signal); x->ctl = &x->cspace; x->cspace.re = 0; *************** *** 4074,4084 **** tf.tf_i[HIOFFSET] = normhipart; frac = tf.tf_d - UNITBIT32; ! f1 = addr[0]; ! f2 = addr[1]; ! coefr = r * (f1 + frac * (f2 - f1)); addr = tab + ((tabindex - (COSTABSIZE/4)) & (COSTABSIZE-1)); ! f1 = addr[0]; ! f2 = addr[1]; ! coefi = r * (f1 + frac * (f2 - f1)); f1 = *in1++; re2 = re; --- 4028,4034 ---- tf.tf_i[HIOFFSET] = normhipart; frac = tf.tf_d - UNITBIT32; ! f1 = addr[0]; f2 = addr[1]; coefr = r * (f1 + frac * (f2 - f1)); addr = tab + ((tabindex - (COSTABSIZE/4)) & (COSTABSIZE-1)); ! f1 = addr[0]; f2 = addr[1]; coefi = r * (f1 + frac * (f2 - f1)); f1 = *in1++; re2 = re; *************** *** 4113,4117 **** static int init = 307; x->val = (init *= 1319); ! outlet_new(x, gensym("signal")); return x; } --- 4063,4067 ---- static int init = 307; x->val = (init *= 1319); ! outlet_new(x, &s_signal); return x; }