summaryrefslogtreecommitdiffstats
path: root/src/lowpass.h
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2023-09-14 14:30:52 +0300
committergramanas <anastasis.gramm2@gmail.com>2023-09-14 14:30:52 +0300
commit2a2a1b0d9fc4bfffcaf23d2f66d38d6927d76bbe (patch)
treefbb51f0f79017fb11946a69e7171c4bb751b63a7 /src/lowpass.h
parent12ef243815d409e5f4039502f378d43ecdf7abaa (diff)
downloadsynth-project-2a2a1b0d9fc4bfffcaf23d2f66d38d6927d76bbe.tar.gz
synth-project-2a2a1b0d9fc4bfffcaf23d2f66d38d6927d76bbe.tar.bz2
synth-project-2a2a1b0d9fc4bfffcaf23d2f66d38d6927d76bbe.zip
Add square wave and fix lowpass styling
Diffstat (limited to 'src/lowpass.h')
-rw-r--r--src/lowpass.h43
1 files changed, 17 insertions, 26 deletions
diff --git a/src/lowpass.h b/src/lowpass.h
index 6c99212..0f50683 100644
--- a/src/lowpass.h
+++ b/src/lowpass.h
@@ -4,43 +4,34 @@
/* FILTER INFORMATION STRUCTURE FOR FILTER ROUTINES */
-#define FILTER_SECTIONS 2 /* 2 filter sections for 24 db/oct filter */
+#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 */
+ 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 */
+ 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 */
+ 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 */
+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 */
+signed char lpf_init();
+void lpf_close();
+float lpf_filter(float input);
+void lpf_update(float resonance, float cutoff, int samplerate);
-#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