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

◆ computeRMS()

float fl::AudioReactive::computeRMS ( const fl::vector< fl::i16 > & samples)
private

Definition at line 545 of file audio_reactive.cpp.

545 {
546 if (samples.empty()) return 0.0f;
547
548 float sumSquares = 0.0f;
549 for (const auto& sample : samples) {
550 float f = static_cast<float>(sample);
551 sumSquares += f * f;
552 }
553
554 return sqrtf(sumSquares / samples.size());
555}
bool empty() const
Definition vector.h:547

References fl::HeapVector< T, Allocator >::empty(), and fl::HeapVector< T, Allocator >::size().

+ Here is the call graph for this function: