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

◆ updateAutoGain()

void updateAutoGain ( float level)

Definition at line 148 of file advanced.h.

148 {
149 if (!autoGain) {
150 autoGainValue = 1.0f;
151 return;
152 }
153
154 static float targetLevel = 0.7f;
155 static float avgLevel = 0.0f;
156
157 avgLevel = avgLevel * 0.95f + level * 0.05f;
158
159 if (avgLevel > 0.01f) {
160 float gainAdjust = targetLevel / avgLevel;
161 gainAdjust = fl::clamp(gainAdjust, 0.5f, 2.0f);
162 autoGainValue = autoGainValue * 0.9f + gainAdjust * 0.1f;
163 }
164}
float autoGainValue
Definition advanced.h:91
UICheckbox autoGain("Auto Gain", true)
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
Definition clamp.h:10

References autoGain(), autoGainValue, and fl::clamp().

Referenced by loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: