From 0a446a421d0f73bb3dbe5ad90d5a68839eb2074d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 24 Feb 2012 15:44:09 -0600 Subject: [PATCH] Return the correct value from biquad_filt() If you turned set `debug = 1` in hairtunes, you'd quickly get a mess of debug messages that showed bf_est_drift in bf_est_update() going quicky out of range toward a float NaN value (usually negative). Clearly the presence of this `out` variable in biquad_filt was meant to be used, not marked as unused. --- hairtunes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hairtunes.c b/hairtunes.c index 1a19140a..a9abfcb7 100644 --- a/hairtunes.c +++ b/hairtunes.c @@ -586,11 +586,11 @@ static void biquad_lpf(biquad_t *bq, double freq, double Q) { static double biquad_filt(biquad_t *bq, double in) { double w = in - bq->a[0]*bq->hist[0] - bq->a[1]*bq->hist[1]; - double out __attribute__((unused)) = bq->b[1]*bq->hist[0] + bq->b[2]*bq->hist[1] + bq->b[0]*w; + double out = bq->b[1]*bq->hist[0] + bq->b[2]*bq->hist[1] + bq->b[0]*w; bq->hist[1] = bq->hist[0]; bq->hist[0] = w; - return w; + return out; } static double bf_playback_rate = 1.0;