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

◆ applyScaling()

void fl::AudioReactive::applyScaling ( )
private

Definition at line 270 of file audio_reactive.cpp.

270 {
271 // Apply scaling mode to frequency bins
272 for (int i = 0; i < 16; ++i) {
273 float value = mCurrentData.frequencyBins[i];
274
275 switch (mConfig.scalingMode) {
276 case 1: // Logarithmic scaling
277 if (value > 1.0f) {
278 value = logf(value) * 20.0f; // Scale factor
279 } else {
280 value = 0.0f;
281 }
282 break;
283
284 case 2: // Linear scaling (no change)
285 // value remains as-is
286 break;
287
288 case 3: // Square root scaling
289 if (value > 0.0f) {
290 value = sqrtf(value) * 8.0f; // Scale factor
291 } else {
292 value = 0.0f;
293 }
294 break;
295
296 case 0: // No scaling
297 default:
298 // value remains as-is
299 break;
300 }
301
302 mCurrentData.frequencyBins[i] = value;
303 }
304}
AudioReactiveConfig mConfig

References mConfig, and mCurrentData.

Referenced by processSample().

+ Here is the caller graph for this function: