Hi Kjetil,
In my own code I tend to exploit the incomparibility of NaN.
Instead of:
if (x < lo) x = lo; if (x > hi) x = hi;
I write:
if (! (x >= lo)) x = lo; if (! (x <= hi)) x = hi;
As any comparison with NaN gives false, the first version will pass NaN through unchanged, but the second version will replace NaN with lo. Behaviour with finite values and +/-Infinity should remain the same as the first version.
On 10/09/13 19:01, Kjetil Matheussen wrote:
Sorry again, that patch was for tabread4~, which should work fine. Trying again:
diff --git a/pure-data/src/d_delay.c b/pure-data/src/d_delay.c index a6e5f7c..f22f7d7 100644 --- a/pure-data/src/d_delay.c +++ b/pure-data/src/d_delay.c @@ -271,7 +271,11 @@ static t_int *sigvd_perform(t_int *w) t_sample zerodel = x->x_zerodel; while (n--) {
t_sample delsamps = x->x_sr * *in++ - zerodel, frac;
t_sample inval = *in++;
if(!isfinite(inval))
inval = 0.0f;
t_sample delsamps = x->x_sr * inval - zerodel, frac;
Not sure what Miller's policy on C standards is, but all other Pd code seems to declare all variables at the start of a block.
int idelsamps; t_sample a, b, c, d, cminusb; if (delsamps < 1.00001f) delsamps = 1.00001f;
Claude