-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2012-10-24 02:56, Miller Puckette wrote: > I think the most nearly correct thing to do would be to change the > signal structure to add an ?allocated-size" field, and put what is > now calcsize in the s_n field of the signal. >
attached is my somewhat simplistic attempt to make non-2^n blocksizes work. i have run some basic help-patches with it and it seems to work fine (though i expect problems with e.g. fft-objects in non-2^n mode). fgmasdr IOhannes -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlCHqHcACgkQkX2Xpv6ydvTlcwCgmczoV5OY5vBM0+AlF+ReOa2o LcoAmwcYa6HUxuiU53NonrksunqxseIf =9IT/ -----END PGP SIGNATURE-----
>From 66e1578b0a9500e754a82f2cc948be6fabb2e6fa Mon Sep 17 00:00:00 2001 From: IOhannes m zmoelnig <zmoel...@iem.at> Date: Wed, 24 Oct 2012 10:18:38 +0200 Subject: [PATCH] allow non 2^n blocksizes --- src/d_ugen.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/d_ugen.c b/src/d_ugen.c index 1ed3960..a282ec4 100644 --- a/src/d_ugen.c +++ b/src/d_ugen.c @@ -427,7 +427,7 @@ void signal_makereusable(t_signal *sig) signal whose buffer and size will be obtained later via signal_setborrowed(). */ -t_signal *signal_new(int n, t_float sr) +t_signal *signal_new(int n, int calcsize, t_float sr) { int logn, n2, vecsize = 0; t_signal *ret, **whichlist; @@ -464,7 +464,7 @@ t_signal *signal_new(int n, t_float sr) ret->s_nextused = signal_usedlist; signal_usedlist = ret; } - ret->s_n = n; + ret->s_n = calcsize; ret->s_vecsize = vecsize; ret->s_sr = sr; ret->s_refcount = 0; @@ -475,7 +475,7 @@ t_signal *signal_new(int n, t_float sr) static t_signal *signal_newlike(const t_signal *sig) { - return (signal_new(sig->s_n, sig->s_sr)); + return (signal_new(sig->s_vecsize, sig->s_n, sig->s_sr)); } void signal_setborrowed(t_signal *sig, t_signal *sig2) @@ -739,7 +739,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) if (!uin->i_nconnect) { t_float *scalar; - s3 = signal_new(dc->dc_vecsize, dc->dc_srate); + s3 = signal_new(dc->dc_vecsize, dc->dc_calcsize, dc->dc_srate); /* post("%s: unconnected signal inlet set to zero", class_getname(u->u_obj->ob_pd)); */ if (scalar = obj_findsignalscalar(u->u_obj, i)) @@ -779,10 +779,10 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) if (nonewsigs) { *sig = uout->o_signal = - signal_new(0, dc->dc_srate); + signal_new(0, 0, dc->dc_srate); } else - *sig = uout->o_signal = signal_new(dc->dc_vecsize, dc->dc_srate); + *sig = uout->o_signal = signal_new(dc->dc_vecsize, dc->dc_calcsize, dc->dc_srate); (*sig)->s_refcount = uout->o_nconnect; } /* now call the DSP scheduling routine for the ugen. This @@ -874,7 +874,7 @@ void ugen_done_graph(t_dspcontext *dc) t_block *blk; t_dspcontext *parent_context = dc->dc_parentcontext; t_float parent_srate; - int parent_vecsize; + int parent_vecsize, parent_calcsize; int period, frequency, phase, vecsize, calcsize; t_float srate; int chainblockbegin; /* DSP chain onset before block prolog code */ @@ -917,11 +917,13 @@ void ugen_done_graph(t_dspcontext *dc) { parent_srate = parent_context->dc_srate; parent_vecsize = parent_context->dc_vecsize; + parent_calcsize = parent_context->dc_calcsize; } else { parent_srate = sys_getsr(); parent_vecsize = sys_getblksize(); + parent_calcsize = parent_vecsize; } if (blk) { @@ -987,7 +989,7 @@ void ugen_done_graph(t_dspcontext *dc) if ((*sigp)->s_isborrowed && !(*sigp)->s_borrowedfrom) { signal_setborrowed(*sigp, - signal_new(parent_vecsize, parent_srate)); + signal_new(parent_vecsize, parent_calcsize, parent_srate)); (*sigp)->s_refcount++; if (ugen_loud) post("set %lx->%lx", *sigp, @@ -1068,7 +1070,7 @@ void ugen_done_graph(t_dspcontext *dc) { if ((*sigp)->s_isborrowed && !(*sigp)->s_borrowedfrom) { - t_signal *s3 = signal_new(parent_vecsize, parent_srate); + t_signal *s3 = signal_new(parent_vecsize, parent_calcsize, parent_srate); signal_setborrowed(*sigp, s3); (*sigp)->s_refcount++; dsp_add_zero(s3->s_vec, s3->s_n); -- 1.7.10.4
_______________________________________________ Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev