148 {
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);
163 }
164}
UICheckbox autoGain("Auto Gain", true)
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)