diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2017-01-15 11:08:42 +0100 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2017-02-18 21:01:04 +0100 |
commit | ac0da3f76ee3f31599b0c572ed296b251e94378b (patch) | |
tree | a1e3bfe7bedd349db38c11487023a57e5da1dfe0 /src/common/filter.h | |
parent | 799b96c801567c1cd0c6a1281511bca90eeac1db (diff) |
Filter improvement: LP and HP filters, added test function
The -3 dB level at cut-off frequency is now maintained for multiple
iterations.
Diffstat (limited to 'src/common/filter.h')
-rw-r--r-- | src/common/filter.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/common/filter.h b/src/common/filter.h index 09a379b..42f051b 100644 --- a/src/common/filter.h +++ b/src/common/filter.h @@ -1,12 +1,14 @@ #ifndef _FILTER_H #define _FILTER_H -typedef struct filter_lowpass { +typedef struct filter { + int iter; double a0, a1, a2, b1, b2; - double z1[10], z2[10]; -} filter_lowpass_t; + double z1[64], z2[64]; +} filter_t; -void filter_lowpass_init(filter_lowpass_t *bq, double frequency, int samplerate); -void filter_lowpass_process(filter_lowpass_t *bq, double *samples, int length, int iterations); +void filter_lowpass_init(filter_t *bq, double frequency, int samplerate, int iterations); +void filter_highpass_init(filter_t *bq, double frequency, int samplerate, int iterations); +void filter_process(filter_t *bq, double *samples, int length); #endif /* _FILTER_H */ |