#define _FILTER_H 1
#define _USE_MATH_DEFINES
-#include <math.h>
-#include <string.h>
+#include <cmath>
#include <complex>
#ifdef __SSE__
#include <xmmintrin.h>
#endif
-#include "defs.h"
-
-namespace std {
-template <typename _Tp> struct complex;
-} // namespace std
-
enum FilterType
{
FILTER_NONE = 0,
FILTER_BPF,
FILTER_NOTCH,
FILTER_APF,
+
+ // EQ filters.
+ FILTER_PEAKING_EQ,
+ FILTER_LOW_SHELF,
+ FILTER_HIGH_SHELF,
};
#define FILTER_MAX_ORDER 4
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.
private:
float omega; //which is 2*Pi*frequency /SAMPLE_RATE
float resonance;
+ float A; // which is 10^(db_gain / 40)
public:
unsigned filter_order;
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(); }