From 153331f5f7c9611ef3a9013dc5b7f58c2305aaf2 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 5 Feb 2014 23:32:24 -0800 Subject: [PATCH] remove bq_t type, use double instead --- crap_eq.h | 5 ++--- crap_eq_const.h | 5 ++--- crap_util.h | 14 +++----------- crap_util_def.h | 6 +++--- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/crap_eq.h b/crap_eq.h index 8772bf6..8ca155d 100644 --- a/crap_eq.h +++ b/crap_eq.h @@ -1,7 +1,6 @@ #include #include -#define BIQUAD_DOUBLE #include "crap_util.h" #include "param.h" @@ -19,8 +18,8 @@ typedef struct { float fs; } personal; -static bq_t -process_one(biquad *filters, bq_t samp) +static double +process_one(biquad *filters, double samp) { for (int i = 0; i < BANDS; i++) samp = biquad_run(&filters[i], samp); diff --git a/crap_eq_const.h b/crap_eq_const.h index 53b9784..e379153 100644 --- a/crap_eq_const.h +++ b/crap_eq_const.h @@ -1,6 +1,5 @@ #include -#define BIQUAD_DOUBLE #include "crap_util.h" #define ID 0x0DEFACED @@ -15,8 +14,8 @@ typedef struct { biquad filters[2][BANDS]; } personal; -static bq_t -process_one(biquad *filters, bq_t samp) +static double +process_one(biquad *filters, double samp) { for (int i = 0; i < BANDS; i++) samp = biquad_run(&filters[i], samp); diff --git a/crap_util.h b/crap_util.h index 98f8732..74db44f 100644 --- a/crap_util.h +++ b/crap_util.h @@ -7,16 +7,8 @@ #define ANGULAR(fc, fs) (2 * M_PI / (fs) * (fc)) #define ANGULAR_LIM(fc, fs) (2 * M_PI / (fs) * LIMIT((fc), 1, (fs)/2)) -/* this is pretty gross; - * it's too easy to define BIQUAD_DOUBLE in one file and not another */ -#ifdef BIQUAD_DOUBLE -typedef double bq_t; -#else -typedef float bq_t; -#endif - typedef struct { - bq_t a1, a2, b0, b1, b2, x1, x2, y1, y2; + double a1, a2, b0, b1, b2, x1, x2, y1, y2; } biquad; typedef struct { @@ -51,7 +43,7 @@ design(double cw, double sw, double num0, double num1, double num2, double den0, double den1, double den2); -static bq_t -biquad_run(biquad *bq, bq_t x); +static double +biquad_run(biquad *bq, double x); #include "crap_util_def.h" diff --git a/crap_util_def.h b/crap_util_def.h index 76aa22f..6e0326e 100644 --- a/crap_util_def.h +++ b/crap_util_def.h @@ -76,9 +76,9 @@ biquad_gen(filter_t type, double fc, double gain, double bw, double fs) { return out; } -static bq_t -biquad_run(biquad *bq, bq_t x) { - bq_t y; +static double +biquad_run(biquad *bq, double x) { + double y; y = bq->b0*x + bq->b1*bq->x1 + bq->b2*bq->x2 + bq->a1*bq->y1 + bq->a2*bq->y2;