Files
reasampler/temp_cortex/fast_limiter.hpp
T
2026-08-01 15:09:30 -04:00

35 lines
954 B
C++

#pragma once
#include "limiter_base.hpp"
#include "CircularBuffer.h"
class FastLimiter : public LimiterBase
{
protected:
// Lookahead buffer for clean limiting
CircularBuffer<float, uint8_t>* delayBufferLeft;
CircularBuffer<float, uint8_t>* 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);
};