Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3205
Modified Files:
Tag: desiredata
d_ugen.c
Log Message:
cleanup
Index: d_ugen.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_ugen.c,v
retrieving revision 1.3.4.1.2.5.2.10
retrieving revision 1.3.4.1.2.5.2.11
diff -C2 -d -r1.3.4.1.2.5.2.10 -r1.3.4.1.2.5.2.11
*** d_ugen.c 28 Jun 2007 16:35:58 -0000 1.3.4.1.2.5.2.10
--- d_ugen.c 30 Jun 2007 13:56:06 -0000 1.3.4.1.2.5.2.11
***************
*** 249,253 ****
static void block_dsp(t_block *x, t_signal **sp) {/* do nothing here */}
! void block_tilde_setup(void) {
block_class = class_new2("block~", (t_newmethod)block_new, 0, sizeof(t_block), 0,"FFF");
class_addcreator2("switch~",(t_newmethod)switch_new,"FFF");
--- 249,253 ----
static void block_dsp(t_block *x, t_signal **sp) {/* do nothing here */}
! void block_tilde_setup() {
block_class = class_new2("block~", (t_newmethod)block_new, 0, sizeof(t_block), 0,"FFF");
class_addcreator2("switch~",(t_newmethod)switch_new,"FFF");
***************
*** 263,288 ****
void dsp_add(t_perfroutine f, int n, ...) {
- int newsize = dsp_chainsize + n+1, i;
va_list ap;
- dsp_chain = (t_int *)t_resizebytes(dsp_chain, dsp_chainsize * sizeof (t_int), newsize * sizeof (t_int));
- dsp_chain[dsp_chainsize-1] = (t_int)f;
va_start(ap, n);
! for (i = 0; i < n; i++) dsp_chain[dsp_chainsize + i] = va_arg(ap, t_int);
! va_end(ap);
dsp_chain[newsize-1] = (t_int)dsp_done;
dsp_chainsize = newsize;
}
! /* at Guenter's suggestion, here's a vectorized version */
void dsp_addv(t_perfroutine f, int n, t_int *vec) {
! int newsize = dsp_chainsize + n+1, i;
! dsp_chain = (t_int *)t_resizebytes(dsp_chain, dsp_chainsize * sizeof (t_int), newsize * sizeof (t_int));
dsp_chain[dsp_chainsize-1] = (t_int)f;
! for (i = 0; i < n; i++) dsp_chain[dsp_chainsize + i] = vec[i];
dsp_chain[newsize-1] = (t_int)dsp_done;
dsp_chainsize = newsize;
}
! void dsp_tick(void) {
if (dsp_chain) {
for (t_int *ip = dsp_chain; ip; ) ip = ((t_perfroutine)*ip)(ip);
--- 263,288 ----
void dsp_add(t_perfroutine f, int n, ...) {
va_list ap;
va_start(ap, n);
! int newsize = dsp_chainsize + n+1;
! dsp_chain = (t_int *)resizebytes(dsp_chain, dsp_chainsize * sizeof (t_int), newsize * sizeof (t_int));
! dsp_chain[dsp_chainsize-1] = (t_int)f;
! for (int i=0; i<n; i++) dsp_chain[dsp_chainsize + i] = va_arg(ap, t_int);
dsp_chain[newsize-1] = (t_int)dsp_done;
dsp_chainsize = newsize;
+ va_end(ap);
}
! /* at Guenter's suggestion, here's a vectorized version */
void dsp_addv(t_perfroutine f, int n, t_int *vec) {
! int newsize = dsp_chainsize + n+1;
! dsp_chain = (t_int *)resizebytes(dsp_chain, dsp_chainsize * sizeof (t_int), newsize * sizeof (t_int));
dsp_chain[dsp_chainsize-1] = (t_int)f;
! for (int i=0; i<n; i++) dsp_chain[dsp_chainsize + i] = vec[i];
dsp_chain[newsize-1] = (t_int)dsp_done;
dsp_chainsize = newsize;
}
! void dsp_tick() {
if (dsp_chain) {
for (t_int *ip = dsp_chain; ip; ) ip = ((t_perfroutine)*ip)(ip);
***************
*** 387,391 ****
ret->s_vec = (t_sample *)getbytes(vecsize * sizeof (*ret->s_vec));
#else
! /* T.Grill - make signal vectors aligned! */
ret->s_vec = (t_sample *)getalignedbytes(vecsize * sizeof (*ret->s_vec));
#endif
--- 387,391 ----
ret->s_vec = (t_sample *)getbytes(vecsize * sizeof (*ret->s_vec));
#else
! /* T.Grill - make signal vectors aligned! */
ret->s_vec = (t_sample *)getalignedbytes(vecsize * sizeof (*ret->s_vec));
#endif
***************
*** 467,471 ****
static t_dspcontext *ugen_currentcontext;
! void ugen_stop(void) {
if (dsp_chain) {
free(dsp_chain);
--- 467,471 ----
static t_dspcontext *ugen_currentcontext;
! void ugen_stop() {
if (dsp_chain) {
free(dsp_chain);
***************
*** 475,479 ****
}
! void ugen_start(void) {
ugen_stop();
ugen_sortno++;
--- 475,479 ----
}
! void ugen_start() {
ugen_stop();
ugen_sortno++;
***************
*** 484,488 ****
}
! int ugen_getsortno(void) {return ugen_sortno;}
#if 0
--- 484,488 ----
}
! int ugen_getsortno() {return ugen_sortno;}
#if 0
***************
*** 1031,1037 ****
void resample_free(t_resample *x) {
! if (x->s_n) t_freebytes(x->s_vec, x->s_n*sizeof(*x->s_vec));
! if (x->coefsize) t_freebytes(x->coeffs, x->coefsize*sizeof(*x->coeffs));
! if (x->bufsize) t_freebytes(x->buffer, x->bufsize*sizeof(*x->buffer));
x->s_n = x->coefsize = x->bufsize = 0;
x->s_vec = x->coeffs = x->buffer = 0;
--- 1031,1037 ----
void resample_free(t_resample *x) {
! if (x->s_n) free(x->s_vec);
! if (x->coefsize) free(x->coeffs);
! if (x->bufsize) free(x->buffer);
x->s_n = x->coefsize = x->bufsize = 0;
x->s_vec = x->coeffs = x->buffer = 0;
***************
*** 1070,1074 ****
case RESAMPLE_LINEAR:
if (x->bufsize != 1) {
! t_freebytes(x->buffer, x->bufsize*sizeof(*x->buffer));
x->bufsize = 1;
x->buffer = (t_float *)t_getbytes(x->bufsize*sizeof(*x->buffer));
--- 1070,1074 ----
case RESAMPLE_LINEAR:
if (x->bufsize != 1) {
! free(x->buffer);
x->bufsize = 1;
x->buffer = (t_float *)t_getbytes(x->bufsize*sizeof(*x->buffer));
***************
*** 1087,1091 ****
void resamplefrom_dsp(t_resample *x, t_sample *in, int insize, int outsize, int method) {
if (insize==outsize) {
! t_freebytes(x->s_vec, x->s_n * sizeof(*x->s_vec));
x->s_n = 0;
x->s_vec = in;
--- 1087,1091 ----
void resamplefrom_dsp(t_resample *x, t_sample *in, int insize, int outsize, int method) {
if (insize==outsize) {
! free(x->s_vec);
x->s_n = 0;
x->s_vec = in;
***************
*** 1094,1098 ****
if (x->s_n != outsize) {
t_float *buf=x->s_vec;
! t_freebytes(buf, x->s_n * sizeof(*buf));
buf = (t_float *)t_getbytes(outsize * sizeof(*buf));
x->s_vec = buf;
--- 1094,1098 ----
if (x->s_n != outsize) {
t_float *buf=x->s_vec;
! free(buf);
buf = (t_float *)t_getbytes(outsize * sizeof(*buf));
x->s_vec = buf;
***************
*** 1105,1109 ****
void resampleto_dsp(t_resample *x, t_sample *out, int insize, int outsize, int method) {
if (insize==outsize) {
! if (x->s_n)t_freebytes(x->s_vec, x->s_n * sizeof(*x->s_vec));
x->s_n = 0;
x->s_vec = out;
--- 1105,1109 ----
void resampleto_dsp(t_resample *x, t_sample *out, int insize, int outsize, int method) {
if (insize==outsize) {
! if (x->s_n)free(x->s_vec);
x->s_n = 0;
x->s_vec = out;
***************
*** 1112,1116 ****
if (x->s_n != insize) {
t_float *buf=x->s_vec;
! t_freebytes(buf, x->s_n * sizeof(*buf));
buf = (t_float *)t_getbytes(insize * sizeof(*buf));
x->s_vec = buf;
--- 1112,1116 ----
if (x->s_n != insize) {
t_float *buf=x->s_vec;
! free(buf);
buf = (t_float *)t_getbytes(insize * sizeof(*buf));
x->s_vec = buf;
***************
*** 1148,1152 ****
}
! static void samplerate_tilde_setup(void) {
samplerate_tilde_class = class_new(gensym("samplerate~"),
(t_newmethod)samplerate_tilde_new, 0, sizeof(t_samplerate), 0, 0);
--- 1148,1152 ----
}
! static void samplerate_tilde_setup() {
samplerate_tilde_class = class_new(gensym("samplerate~"),
(t_newmethod)samplerate_tilde_new, 0, sizeof(t_samplerate), 0, 0);