#pragma once #include "AudioBuffer.h" #include namespace engine { class EqProcessor { public: static constexpr int BANDS = 10; static constexpr float FREQS[BANDS] = { 32, 64, 125, 250, 500, 1000, 2000, 4000, 8000, 16000 }; EqProcessor(); void setBand(int band, float dB); float band(int band) const; void process(AudioBuffer &buf); void reset(); void setSampleRate(int sr); private: void recomputeBiquad(int band); int m_sampleRate { 44100 }; float m_gainDb[BANDS] {}; struct BiquadCoefficients { float b0 { 1.0f }; float b1 { 0.0f }; float b2 { 0.0f }; float a1 { 0.0f }; float a2 { 0.0f }; }; BiquadCoefficients m_coeff[BANDS]; struct BiquadState { float z1 { 0.0f }; float z2 { 0.0f }; }; static constexpr int MAX_CH = 8; BiquadState m_state[BANDS][MAX_CH] {}; }; } // namespace engine