void applyGain(const vector< i16 > &input, float gain, vector< i16 > &output) FL_NO_EXCEPT
Apply gain to audio samples.
Sample process(const Sample &sample) FL_NO_EXCEPT
Process audio sample with automatic gain adjustment.
void configure(const AutoGainConfig &config) FL_NO_EXCEPT
Configure the auto gain controller.
void reset() FL_NO_EXCEPT
Reset internal state.
float mLastGain
Last smoothed gain output.
void setSampleRate(int sampleRate) FL_NO_EXCEPT
Set sample rate for dt computation.
AttackDecayFilter< float > mPeakEnvelope
Peak envelope tracker: fast attack (10ms), slow decay (preset-dependent)
float updatePIController(float targetGain, float dt) FL_NO_EXCEPT
Update PI controller toward target gain.
vector< i16 > mOutputBuffer
Working buffer (reused to avoid allocations)
float computeTargetGain() FL_NO_EXCEPT
Compute target gain from peak envelope.
float getGain() const FL_NO_EXCEPT
Get current gain multiplier.
const Stats & getStats() const FL_NO_EXCEPT
float mIntegrator
PI integrator state.
void resolvePreset() FL_NO_EXCEPT
Resolve preset enum into concrete PI tuning parameters.
Get current statistics (for monitoring/debugging)
AGCPreset
AGC preset selection — derived from WLED Sound Reactive's proven approach.
@ AGCPreset_Vivid
Faster response: 1.3s peak decay, higher PI gains.
@ AGCPreset_Normal
Balanced: 3.3s peak decay, moderate PI gains.
@ AGCPreset_Custom
Use custom PI tuning fields below.
@ AGCPreset_Lazy
Slower, more stable: 6.7s peak decay, lower PI gains.
float kp
Proportional gain for PI controller.
float ki
Integral gain for PI controller.
float targetRMSLevel
Target RMS level after gain (0-32767) The AGC will adjust gain to maintain this average level.
float peakDecayTau
Peak envelope decay time constant (seconds).
float maxGain
Maximum gain multiplier (prevents over-amplification)
AGCPreset preset
AGC behavior preset (default: Normal)
float minGain
Minimum gain multiplier (prevents over-attenuation)
float gainFollowSlowTau
Slow gain-follow time constant (seconds) — used when error is small.
float gainFollowFastTau
Fast gain-follow time constant (seconds) — used when error is large.
bool enabled
Enable automatic gain adjustment.
Configuration for automatic gain control.
u8 u8 fract8 blur_amount FL_NO_EXCEPT
CRGB sample(const CRGB *grid, const XYMap &xyMap, float x, float y, SampleMode mode) FL_NO_EXCEPT
Sample a pixel from a 2D CRGB grid at floating-point coordinates.
Base definition for an LED controller.