FastLED 3.9.15
Loading...
Searching...
No Matches

◆ applyGain()

void fl::audio::Reactive::applyGain ( )
private

Definition at line 402 of file audio_reactive.cpp.hpp.

402 {
403 // Apply gain setting (0-255 maps to 0.0-2.0 multiplier)
404 float gainMultiplier = static_cast<float>(mConfig.gain) / 128.0f;
405
406 // Don't apply gain to adaptive volume — it's self-normalizing (converges
407 // to 1.0 regardless of amplitude), so scaling it is meaningless.
408 mCurrentData.volumeRaw *= gainMultiplier;
409 mCurrentData.peak *= gainMultiplier;
410
411 // Clamp to documented 0.0-1.0 range after gain
412 if (mCurrentData.volumeRaw > 1.0f) mCurrentData.volumeRaw = 1.0f;
413 if (mCurrentData.peak > 1.0f) mCurrentData.peak = 1.0f;
414
415 for (int i = 0; i < 16; ++i) {
416 mCurrentData.frequencyBins[i] *= gainMultiplier;
417 }
418}
ReactiveConfig mConfig

References mConfig, and mCurrentData.

Referenced by processSample().

+ Here is the caller graph for this function: