diff options
author | Guenter Geiger <ggeiger@users.sourceforge.net> | 2002-11-25 10:47:53 +0000 |
---|---|---|
committer | Guenter Geiger <ggeiger@users.sourceforge.net> | 2002-11-25 10:47:53 +0000 |
commit | 5aef03b3a165b309622f6d051bd4d53c42b4532d (patch) | |
tree | 808a2924e736f3327c968f0868fd1efdbc3a1aec /pd/src/d_filter.c | |
parent | b09bea965d034a8e092b35d369f2ef6591ef0e65 (diff) |
This commit was generated by cvs2svn to compensate for changes in r232,
which included commits to RCS files with non-trunk default branches.
svn path=/trunk/; revision=233
Diffstat (limited to 'pd/src/d_filter.c')
-rw-r--r-- | pd/src/d_filter.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/pd/src/d_filter.c b/pd/src/d_filter.c index 1693cd85..88318900 100644 --- a/pd/src/d_filter.c +++ b/pd/src/d_filter.c @@ -4,7 +4,6 @@ /* "filters", both linear and nonlinear. */ - #include "m_pd.h" #include <math.h> @@ -65,9 +64,8 @@ static t_int *sighip_perform(t_int *w) *out++ = new - last; last = new; } - /* NAN protect */ - if (!((last <= 0) || (last >= 0))) - last = 0; + if (PD_BADFLOAT(last)) + last = 0; c->c_x = last; return (w+5); } @@ -158,8 +156,7 @@ static t_int *siglop_perform(t_int *w) float feedback = 1 - coef; for (i = 0; i < n; i++) last = *out++ = coef * *in++ + feedback * last; - /* NAN protect */ - if (!((last <= 0) || (last >= 0))) + if (PD_BADFLOAT(last)) last = 0; c->c_x = last; return (w+5); @@ -290,10 +287,9 @@ static t_int *sigbp_perform(t_int *w) prev = last; last = output; } - /* NAN protect */ - if (!((last <= 0) || (last >= 0))) + if (PD_BADFLOAT(last)) last = 0; - if (!((prev <= 0) || (prev >= 0))) + if (PD_BADFLOAT(prev)) prev = 0; c->c_x1 = last; c->c_x2 = prev; @@ -376,6 +372,8 @@ static t_int *sigbiquad_perform(t_int *w) for (i = 0; i < n; i++) { float output = *in++ + fb1 * last + fb2 * prev; + if (PD_BADFLOAT(output)) + output = 0; *out++ = ff1 * output + ff2 * last + ff3 * prev; prev = last; last = output; |