X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=filter.h;h=1bf18c9cd5855afdc119bb7c8a399b6e9b560db0;hb=9e47a2f661b9d292598ef0277e507458e3dad62f;hp=5e455d2fff840704a7ab3ae44cca24105f89a8d7;hpb=12f9082b06c037b76dc3a653643bdaeaea89f2d2;p=nageru diff --git a/filter.h b/filter.h index 5e455d2..1bf18c9 100644 --- a/filter.h +++ b/filter.h @@ -10,20 +10,13 @@ #define _FILTER_H 1 #define _USE_MATH_DEFINES -#include -#include +#include #include #ifdef __SSE__ #include #endif -#include "defs.h" - -namespace std { -template struct complex; -} // namespace std - enum FilterType { FILTER_NONE = 0, @@ -32,6 +25,11 @@ enum FilterType FILTER_BPF, FILTER_NOTCH, FILTER_APF, + + // EQ filters. + FILTER_PEAKING_EQ, + FILTER_LOW_SHELF, + FILTER_HIGH_SHELF, }; #define FILTER_MAX_ORDER 4 @@ -69,6 +67,12 @@ public: resonance = new_resonance; } + // For EQ filters only. + void set_dbgain_normalized(float db_gain_div_40) + { + A = pow(10.0f, db_gain_div_40); + } + #ifdef __SSE__ // We don't need the stride argument for SSE, as StereoFilter // has its own SSE implementations. @@ -81,6 +85,7 @@ public: private: float omega; //which is 2*Pi*frequency /SAMPLE_RATE float resonance; + float A; // which is 10^(db_gain / 40) public: unsigned filter_order; @@ -104,7 +109,7 @@ class StereoFilter public: void init(FilterType type, int new_order); - void render(float *inout_left_ptr, unsigned n_samples, float cutoff, float resonance); + void render(float *inout_left_ptr, unsigned n_samples, float cutoff, float resonance, float dbgain_normalized = 0.0f); #ifndef NDEBUG #ifdef __SSE__ void debug() { parm_filter.debug(); }