#pragma once #include "limiter_base.hpp" #include "CircularBuffer.h" class FastLimiter : public LimiterBase { protected: // Lookahead buffer for clean limiting CircularBuffer* delayBufferLeft; CircularBuffer* delayBufferRight; // Lookahead parameters float lookaheadMs; uint8_t lookaheadSamples; // Envelope following float envelope; float peakHold; uint8_t peakHoldCounter; uint8_t peakHoldSamples; // Internal gain smoothing float currentGain; public: FastLimiter(float sampleRate, float lookaheadMs = 5.0f); ~FastLimiter(); void setPeakHold(float peakHoldMs); void process(float input[2], float thresholdDb = -3.0f, float ceilingDb = -0.1f) override; private: float analyzeLevel(float left, float right); };