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

◆ applyScaling()

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

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

420 {
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}
ReactiveConfig mConfig
float sqrtf(float value) FL_NOEXCEPT
Definition math.h:453
constexpr int type_rank< T >::value
float logf(float value) FL_NOEXCEPT
Definition math.h:418

References fl::logf(), mConfig, mCurrentData, fl::sqrtf(), and fl::type_rank< T >::value.

Referenced by processSample().

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