try to make code performant, lets see if this will work.

This commit is contained in:
2026-06-11 18:45:03 +02:00
parent 677f263648
commit c46caf7533
9 changed files with 306 additions and 230 deletions
+15 -17
View File
@@ -1,11 +1,13 @@
#pragma once
#include "AudioBuffer.h"
#include <array>
namespace engine {
class EqProcessor {
public:
static constexpr int BANDS = 10;
static constexpr int BANDS = 10;
static constexpr float FREQS[BANDS] = {
32, 64, 125, 250, 500, 1000, 2000, 4000, 8000, 16000
};
@@ -14,12 +16,9 @@ public:
void setBand(int band, float dB);
float band(int band) const;
void process(AudioBuffer &buf);
void reset();
void setSampleRate(int sr);
void process(AudioBuffer &buf);
void reset();
void setSampleRate(int sr);
private:
void recomputeBiquad(int band);
@@ -28,22 +27,21 @@ private:
float m_gainDb[BANDS] {};
struct BiquadCoefficients {
float b0 {};
float b1 {};
float b2 {};
float a1 {};
float a2 {};
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;
float z2;
float z1 { 0.0f };
float z2 { 0.0f };
};
static constexpr int MAX_CH = 8;
BiquadState m_state[BANDS][MAX_CH] {};
BiquadState m_state[BANDS][MAX_CH] {};
};
} // namespace engine