Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25462
Modified Files: Tag: desiredata builtins_dsp.c Log Message: interleaved code of [cpole~] [czero~] [czero_rev~]
Index: builtins_dsp.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/builtins_dsp.c,v retrieving revision 1.1.2.26 retrieving revision 1.1.2.27 diff -C2 -d -r1.1.2.26 -r1.1.2.27 *** builtins_dsp.c 19 Jul 2007 18:44:47 -0000 1.1.2.26 --- builtins_dsp.c 19 Jul 2007 18:53:39 -0000 1.1.2.27 *************** *** 2831,2835 **** /* ---------------- rpole~ - real one-pole filter (raw) ----------------- */ /* ---------------- rzero~ - real one-zero filter (raw) ----------------- */ ! /* --------- rzero_rev~ - real, reverse one-zero filter (raw) ----------- */ t_class *sigrpole_class; struct t_sigrpole : t_object {float a; float last;}; t_class *sigrzero_class; struct t_sigrzero : t_object {float a; float last;}; --- 2831,2835 ---- /* ---------------- rpole~ - real one-pole filter (raw) ----------------- */ /* ---------------- rzero~ - real one-zero filter (raw) ----------------- */ ! /* --- rzero_rev~ - real, reverse one-zero filter (raw) ----------------- */ t_class *sigrpole_class; struct t_sigrpole : t_object {float a; float last;}; t_class *sigrzero_class; struct t_sigrzero : t_object {float a; float last;}; *************** *** 2890,2917 **** static void sigrzrev_set(t_sigrzrev *x, t_float f) {x->last = f;} void sigr_setup() { ! sigrpole_class = class_new2("rpole~",sigrpole_new,0,sizeof(t_sigrpole),0,"F"); CLASS_MAINSIGNALIN(sigrpole_class, t_sigrpole, a); - class_addmethod2(sigrpole_class, sigrpole_set, "set","F"); - class_addmethod2(sigrpole_class, sigrpole_clear,"clear",""); - class_addmethod2(sigrpole_class, sigrpole_dsp, "dsp",""); - sigrzero_class = class_new2("rzero~",sigrzero_new,0,sizeof(t_sigrzero),0,"F"); CLASS_MAINSIGNALIN(sigrzero_class, t_sigrzero, a); - class_addmethod2(sigrzero_class, sigrzero_set, "set","F"); - class_addmethod2(sigrzero_class, sigrzero_clear,"clear",""); - class_addmethod2(sigrzero_class, sigrzero_dsp, "dsp",""); - sigrzrev_class = class_new2("rzero_rev~",sigrzrev_new,0,sizeof(t_sigrzrev),0,"F"); CLASS_MAINSIGNALIN(sigrzrev_class, t_sigrzrev, a); class_addmethod2(sigrzrev_class, sigrzrev_set, "set","F"); class_addmethod2(sigrzrev_class, sigrzrev_clear,"clear",""); class_addmethod2(sigrzrev_class, sigrzrev_dsp, "dsp",""); }
/* -------------- cpole~ - complex one-pole filter (raw) --------------- */ ! struct t_sigcpole : t_object { ! float a; ! float lastre; ! float lastim; ! }; ! t_class *sigcpole_class; static void *sigcpole_new(t_float re, t_float im) { t_sigcpole *x = (t_sigcpole *)pd_new(sigcpole_class); --- 2890,2918 ---- static void sigrzrev_set(t_sigrzrev *x, t_float f) {x->last = f;} void sigr_setup() { ! sigrpole_class = class_new2("rpole~", sigrpole_new,0,sizeof(t_sigrpole),0,"F"); ! sigrzero_class = class_new2("rzero~", sigrzero_new,0,sizeof(t_sigrzero),0,"F"); ! sigrzrev_class = class_new2("rzero_rev~",sigrzrev_new,0,sizeof(t_sigrzrev),0,"F"); CLASS_MAINSIGNALIN(sigrpole_class, t_sigrpole, a); CLASS_MAINSIGNALIN(sigrzero_class, t_sigrzero, a); CLASS_MAINSIGNALIN(sigrzrev_class, t_sigrzrev, a); + class_addmethod2(sigrpole_class, sigrpole_set, "set","F"); + class_addmethod2(sigrzero_class, sigrzero_set, "set","F"); class_addmethod2(sigrzrev_class, sigrzrev_set, "set","F"); + class_addmethod2(sigrpole_class, sigrpole_clear,"clear",""); + class_addmethod2(sigrzero_class, sigrzero_clear,"clear",""); class_addmethod2(sigrzrev_class, sigrzrev_clear,"clear",""); + class_addmethod2(sigrpole_class, sigrpole_dsp, "dsp",""); + class_addmethod2(sigrzero_class, sigrzero_dsp, "dsp",""); class_addmethod2(sigrzrev_class, sigrzrev_dsp, "dsp",""); }
/* -------------- cpole~ - complex one-pole filter (raw) --------------- */ ! /* -------------- czero~ - complex one-pole filter (raw) --------------- */ ! /* ---------- czero_rev~ - complex one-pole filter (raw) --------------- */ ! ! t_class *sigcpole_class; struct t_sigcpole : t_object {float a; float lastre; float lastim;}; ! t_class *sigczero_class; struct t_sigczero : t_object {float a; float lastre; float lastim;}; ! t_class *sigczrev_class; struct t_sigczrev : t_object {float a; float lastre; float lastim;}; ! static void *sigcpole_new(t_float re, t_float im) { t_sigcpole *x = (t_sigcpole *)pd_new(sigcpole_class); *************** *** 2925,2928 **** --- 2926,2952 ---- return x; } + static void *sigczero_new(t_float re, t_float im) { + t_sigczero *x = (t_sigczero *)pd_new(sigczero_class); + inlet_new(x, x, &s_signal, &s_signal); + pd_float((t_pd *)inlet_new(x, x, &s_signal, &s_signal), re); + pd_float((t_pd *)inlet_new(x, x, &s_signal, &s_signal), im); + outlet_new(x, &s_signal); + outlet_new(x, &s_signal); + x->lastre = x->lastim = 0; + x->a = 0; + return x; + } + static void *sigczrev_new(t_float re, t_float im) { + t_sigczrev *x = (t_sigczrev *)pd_new(sigczrev_class); + inlet_new(x, x, &s_signal, &s_signal); + pd_float((t_pd *)inlet_new(x, x, &s_signal, &s_signal), re); + pd_float((t_pd *)inlet_new(x, x, &s_signal, &s_signal), im); + outlet_new(x, &s_signal); + outlet_new(x, &s_signal); + x->lastre = x->lastim = 0; + x->a = 0; + return x; + } + static t_int *sigcpole_perform(t_int *w) { float *inre1 = (float *)w[1], *inim1 = (float *)w[2]; *************** *** 2946,2980 **** return w+9; } - static void sigcpole_dsp(t_sigcpole *x, t_signal **sp) { - dsp_add(sigcpole_perform, 8, sp[0]->v, sp[1]->v, sp[2]->v, sp[3]->v, sp[4]->v, sp[5]->v, x, sp[0]->n); - } - static void sigcpole_clear(t_sigcpole *x) {x->lastre = x->lastim = 0;} - static void sigcpole_set(t_sigcpole *x, t_float re, t_float im) {x->lastre = re; x->lastim = im;} - void sigcpole_setup() { - sigcpole_class = class_new2("cpole~",sigcpole_new,0,sizeof(t_sigcpole),0,"FF"); - CLASS_MAINSIGNALIN(sigcpole_class, t_sigcpole, a); - class_addmethod2(sigcpole_class, sigcpole_set, "set","FF"); - class_addmethod2(sigcpole_class, sigcpole_clear,"clear",""); - class_addmethod2(sigcpole_class, sigcpole_dsp, "dsp",""); - } - - /* -------------- czero~ - complex one-pole filter (raw) --------------- */ - struct t_sigczero : t_object { - float a; - float lastre; - float lastim; - }; - t_class *sigczero_class; - static void *sigczero_new(t_float re, t_float im) { - t_sigczero *x = (t_sigczero *)pd_new(sigczero_class); - inlet_new(x, x, &s_signal, &s_signal); - pd_float((t_pd *)inlet_new(x, x, &s_signal, &s_signal), re); - pd_float((t_pd *)inlet_new(x, x, &s_signal, &s_signal), im); - outlet_new(x, &s_signal); - outlet_new(x, &s_signal); - x->lastre = x->lastim = 0; - x->a = 0; - return x; - } static t_int *sigczero_perform(t_int *w) { float *inre1 = (float *)w[1], *inim1 = (float *)w[2]; --- 2970,2973 ---- *************** *** 2997,3036 **** return w+9; } ! static void sigczero_dsp(t_sigczero *x, t_signal **sp) { ! dsp_add(sigczero_perform, 8, sp[0]->v, sp[1]->v, sp[2]->v, sp[3]->v, sp[4]->v, sp[5]->v, x, sp[0]->n); ! } ! static void sigczero_clear(t_sigczero *x) {x->lastre = x->lastim = 0;} ! static void sigczero_set(t_sigczero *x, t_float re, t_float im) {x->lastre = re; x->lastim = im;} ! void sigczero_setup() { ! sigczero_class = class_new2("czero~",sigczero_new,0,sizeof(t_sigczero),0,"FF"); ! CLASS_MAINSIGNALIN(sigczero_class, t_sigczero, a); ! class_addmethod2(sigczero_class, sigczero_set, "set","FF"); ! class_addmethod2(sigczero_class, sigczero_clear, "clear",""); ! class_addmethod2(sigczero_class, sigczero_dsp, "dsp",""); ! } ! ! /* -------------- czero_rev~ - complex one-pole filter (raw) --------------- */ ! struct t_sigczero_rev : t_object { ! float a; ! float lastre; ! float lastim; ! }; ! t_class *sigczero_rev_class; ! static void *sigczero_rev_new(t_float re, t_float im) { ! t_sigczero_rev *x = (t_sigczero_rev *)pd_new(sigczero_rev_class); ! inlet_new(x, x, &s_signal, &s_signal); ! pd_float((t_pd *)inlet_new(x, x, &s_signal, &s_signal), re); ! pd_float((t_pd *)inlet_new(x, x, &s_signal, &s_signal), im); ! outlet_new(x, &s_signal); ! outlet_new(x, &s_signal); ! x->lastre = x->lastim = 0; ! x->a = 0; ! return x; ! } ! static t_int *sigczero_rev_perform(t_int *w) { float *inre1 = (float *)w[1], *inim1 = (float *)w[2]; float *inre2 = (float *)w[3], *inim2 = (float *)w[4]; float *outre = (float *)w[5], *outim = (float *)w[6]; ! t_sigczero_rev *x = (t_sigczero_rev *)w[7]; int n = (t_int)w[8]; float lastre = x->lastre; --- 2990,2998 ---- return w+9; } ! static t_int *sigczrev_perform(t_int *w) { float *inre1 = (float *)w[1], *inim1 = (float *)w[2]; float *inre2 = (float *)w[3], *inim2 = (float *)w[4]; float *outre = (float *)w[5], *outim = (float *)w[6]; ! t_sigczrev *x = (t_sigczrev *)w[7]; int n = (t_int)w[8]; float lastre = x->lastre; *************** *** 3039,3044 **** float nextre = *inre1++, nextim = *inim1++; float coefre = *inre2++, coefim = *inim2++; ! /* transfer function is (A bar) - Z^-1, for the same ! frequency response as 1 - AZ^-1 from czero_tilde. */ *outre++ = lastre - nextre * coefre - nextim * coefim; *outim++ = lastim - nextre * coefim + nextim * coefre; --- 3001,3005 ---- float nextre = *inre1++, nextim = *inim1++; float coefre = *inre2++, coefim = *inim2++; ! /* transfer function is (A bar) - Z^-1, for the same frequency response as 1 - AZ^-1 from czero_tilde. */ *outre++ = lastre - nextre * coefre - nextim * coefim; *outim++ = lastim - nextre * coefim + nextim * coefre; *************** *** 3050,3070 **** return w+9; } ! static void sigczero_rev_dsp(t_sigczero_rev *x, t_signal **sp) { ! dsp_add(sigczero_rev_perform, 8, sp[0]->v, sp[1]->v, sp[2]->v, sp[3]->v, ! sp[4]->v, sp[5]->v, x, sp[0]->n); ! } ! static void sigczero_rev_clear(t_sigczero_rev *x) { ! x->lastre = x->lastim = 0; ! } ! static void sigczero_rev_set(t_sigczero_rev *x, t_float re, t_float im) { ! x->lastre = re; ! x->lastim = im; ! } ! void sigczero_rev_setup() { ! sigczero_rev_class = class_new2("czero_rev~",sigczero_rev_new,0,sizeof(t_sigczero_rev),0,"FF"); ! CLASS_MAINSIGNALIN(sigczero_rev_class, t_sigczero_rev, a); ! class_addmethod2(sigczero_rev_class, sigczero_rev_set, "set","FF"); ! class_addmethod2(sigczero_rev_class, sigczero_rev_clear, "clear",""); ! class_addmethod2(sigczero_rev_class, sigczero_rev_dsp, "dsp",""); }
--- 3011,3045 ---- return w+9; } ! ! static void sigcpole_dsp(t_sigcpole *x, t_signal **sp) { ! dsp_add(sigcpole_perform, 8, sp[0]->v, sp[1]->v, sp[2]->v, sp[3]->v, sp[4]->v, sp[5]->v, x, sp[0]->n);} ! static void sigczero_dsp(t_sigczero *x, t_signal **sp) { ! dsp_add(sigczero_perform, 8, sp[0]->v, sp[1]->v, sp[2]->v, sp[3]->v, sp[4]->v, sp[5]->v, x, sp[0]->n);} ! static void sigczrev_dsp(t_sigczrev *x, t_signal **sp) { ! dsp_add(sigczrev_perform, 8, sp[0]->v, sp[1]->v, sp[2]->v, sp[3]->v, sp[4]->v, sp[5]->v, x, sp[0]->n);} ! ! static void sigcpole_clear(t_sigcpole *x) {x->lastre = x->lastim = 0;} ! static void sigczero_clear(t_sigczero *x) {x->lastre = x->lastim = 0;} ! static void sigczrev_clear(t_sigczrev *x) {x->lastre = x->lastim = 0;} ! static void sigcpole_set(t_sigcpole *x, t_float re, t_float im) {x->lastre = re; x->lastim = im;} ! static void sigczero_set(t_sigczero *x, t_float re, t_float im) {x->lastre = re; x->lastim = im;} ! static void sigczrev_set(t_sigczrev *x, t_float re, t_float im) {x->lastre = re; x->lastim = im;} ! ! void sigc_setup() { ! sigcpole_class = class_new2("cpole~", sigcpole_new,0,sizeof(t_sigcpole),0,"FF"); ! sigczero_class = class_new2("czero~", sigczero_new,0,sizeof(t_sigczero),0,"FF"); ! sigczrev_class = class_new2("czero_rev~",sigczrev_new,0,sizeof(t_sigczrev),0,"FF"); ! CLASS_MAINSIGNALIN(sigcpole_class, t_sigcpole, a); ! CLASS_MAINSIGNALIN(sigczero_class, t_sigczero, a); ! CLASS_MAINSIGNALIN(sigczrev_class, t_sigczrev, a); ! class_addmethod2(sigcpole_class, sigcpole_set, "set","FF"); ! class_addmethod2(sigczero_class, sigczero_set, "set","FF"); ! class_addmethod2(sigczrev_class, sigczrev_set, "set","FF"); ! class_addmethod2(sigcpole_class, sigcpole_clear,"clear",""); ! class_addmethod2(sigczero_class, sigczero_clear, "clear",""); ! class_addmethod2(sigczrev_class, sigczrev_clear, "clear",""); ! class_addmethod2(sigcpole_class, sigcpole_dsp, "dsp",""); ! class_addmethod2(sigczero_class, sigczero_dsp, "dsp",""); ! class_addmethod2(sigczrev_class, sigczrev_dsp, "dsp",""); }
*************** *** 3236,3240 **** static void sigcatch_free(t_sigcatch *x) { pd_unbind(x, x->sym); ! freealignedbytes(x->vec,x->n* sizeof(float)); } static void sigcatch_setup() { --- 3211,3215 ---- static void sigcatch_free(t_sigcatch *x) { pd_unbind(x, x->sym); ! freealignedbytes(x->vec,x->n*sizeof(float)); } static void sigcatch_setup() { *************** *** 3974,3980 **** sigsamphold_setup(); sigr_setup(); ! sigcpole_setup(); ! sigczero_setup(); ! sigczero_rev_setup();
sigsend_setup(); --- 3949,3953 ---- sigsamphold_setup(); sigr_setup(); ! sigc_setup();
sigsend_setup();