MCPcopy Create free account
hub / github.com/FastLED/FastLED / applyScaling

Method applyScaling

src/fl/audio/audio_reactive.cpp.hpp:420–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420void Reactive::applyScaling() {
421 // Apply scaling mode to frequency bins
422 for (int i = 0; i < 16; ++i) {
423 float value = mCurrentData.frequencyBins[i];
424
425 switch (mConfig.scalingMode) {
426 case 1: // Logarithmic scaling
427 if (value > 1.0f) {
428 value = logf(value) * 20.0f; // Scale factor
429 } else {
430 value = 0.0f;
431 }
432 break;
433
434 case 2: // Linear scaling (no change)
435 // value remains as-is
436 break;
437
438 case 3: // Square root scaling
439 if (value > 0.0f) {
440 value = sqrtf(value) * 8.0f; // Scale factor
441 } else {
442 value = 0.0f;
443 }
444 break;
445
446 case 0: // No scaling
447 default:
448 // value remains as-is
449 break;
450 }
451
452 mCurrentData.frequencyBins[i] = value;
453 }
454}
455
456void Reactive::smoothResults() {
457 // Attack/decay smoothing - different rates for rising vs falling values

Callers

nothing calls this directly

Calls 2

logfFunction · 0.85
sqrtfFunction · 0.85

Tested by

no test coverage detected