Update of /cvsroot/pure-data/externals/signal/lrshift~ In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21659
Modified Files: lrshift~.c Log Message: added float input to dynamically change shift amount
Index: lrshift~.c =================================================================== RCS file: /cvsroot/pure-data/externals/signal/lrshift~/lrshift~.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lrshift~.c 16 Sep 2004 18:01:08 -0000 1.1 --- lrshift~.c 7 Nov 2006 22:00:41 -0000 1.2 *************** *** 11,14 **** --- 11,15 ---- } t_lrshift_tilde;
+ #ifdef OBSOLETE static t_int *leftshift_perform(t_int *w) { *************** *** 40,48 **** return (w+5); }
! static void lrshift_tilde_dsp(t_lrshift_tilde *x, t_signal **sp) { ! int n = sp[0]->s_n; ! int shift = x->x_n; if (shift > n) shift = n; --- 41,54 ---- return (w+5); } + #endif
! static t_int *lrshift_perform(t_int *w) { ! t_float *in = (t_float *)(w[1]); ! t_float *out= (t_float *)(w[2]); ! int n = (int)(w[3]); ! t_lrshift_tilde *x = (t_lrshift_tilde *)w[4]; ! int shift = x->x_n; ! if (shift > n) shift = n; *************** *** 50,57 **** shift = -n; if (shift < 0) ! dsp_add(rightshift_perform, 4, ! sp[0]->s_vec + n, sp[1]->s_vec + n, n, -shift); ! else dsp_add(leftshift_perform, 4, ! sp[0]->s_vec, sp[1]->s_vec, n, shift); }
--- 56,87 ---- shift = -n; if (shift < 0) ! { ! shift = -shift; ! out += n; ! in += n; ! n -= shift; ! in -= shift; ! while (n--) ! *--out = *--in; ! while (shift--) ! *--out = 0; ! } ! else ! { ! in += shift; ! n -= shift; ! while (n--) ! *out++ = *in++; ! while (shift--) ! *out++ = 0; ! } ! return (w+5); ! } ! ! static void lrshift_tilde_dsp(t_lrshift_tilde *x, t_signal **sp) ! { ! int n = sp[0]->s_n; ! dsp_add(lrshift_perform, 4, sp[0]->s_vec, sp[1]->s_vec, n, x); ! }
*************** *** 64,67 **** --- 94,102 ---- }
+ static void lrshift_tilde_float(t_lrshift_tilde *x, t_floatarg f) + { + x->x_n = f; + } + void lrshift_tilde_setup(void) { *************** *** 72,74 **** --- 107,110 ---- class_addmethod(lrshift_tilde_class, (t_method)lrshift_tilde_dsp, gensym("dsp"), 0); + class_addfloat(lrshift_tilde_class, (t_method)lrshift_tilde_float); }