From 9c6410cc3a43d9d1e01f853cb5a8d0f8a6d93b45 Mon Sep 17 00:00:00 2001 From: gramanas Date: Tue, 18 Apr 2023 16:31:25 +0300 Subject: autotools initial... --- src/lowpass.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/lowpass.h (limited to 'src/lowpass.h') diff --git a/src/lowpass.h b/src/lowpass.h new file mode 100644 index 0000000..6c99212 --- /dev/null +++ b/src/lowpass.h @@ -0,0 +1,46 @@ +#ifndef _LOWPASS_H +#define _LOWPASS_H + + +/* FILTER INFORMATION STRUCTURE FOR FILTER ROUTINES */ + +#define FILTER_SECTIONS 2 /* 2 filter sections for 24 db/oct filter */ + +typedef struct { + unsigned int length; /* size of filter */ + float history[2 * FILTER_SECTIONS]; /* history in filter */ + float *coef; /* pointer to coefficients of filter */ +} FILTER; + +typedef struct { + double a0, a1, a2; /* numerator coefficients */ + double b0, b1, b2; /* denominator coefficients */ +} BIQUAD; + +static BIQUAD ProtoCoef[FILTER_SECTIONS]; /* Filter prototype coefficients, + 1 for each filter section */ + +void szxform( + double *a0, double *a1, double *a2, /* numerator coefficients */ + double *b0, double *b1, double *b2, /* denominator coefficients */ + double fc, /* Filter cutoff frequency */ + double fs, /* sampling rate */ + double *k, /* overall gain factor */ + float *coef); /* pointer to 4 iir coefficients */ + + + +#ifdef __cplusplus + extern "C" { +#endif + + signed char LowPass_Init(); + void LowPass_Close(); + float LowPass_Filter(float input); + void LowPass_Update(float resonance, float cutoff, int samplerate); + +#ifdef __cplusplus + } +#endif + +#endif -- cgit v1.2.3