remove bq_t type, use double instead
This commit is contained in:
parent
0a5c150ca6
commit
153331f5f7
4 changed files with 10 additions and 20 deletions
|
@ -1,7 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <string.h>
|
||||
|
||||
#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);
|
||||
|
|
14
crap_util.h
14
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"
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue