FastLED 3.10.8
Loading...
Searching...
No Matches

◆ initRms()

void fl::audio::SampleImpl::initRms ( )
inlineprivate

Definition at line 184 of file audio.h.

184 {
185 if (mSignedPcm.empty()) {
186 mRms = 0.0f;
187 return;
188 }
189 fl::u64 sum_sq = 0;
190 const int N = mSignedPcm.size();
191 for (int i = 0; i < N; ++i) {
192 fl::i32 x32 = fl::i32(mSignedPcm[i]);
193 sum_sq += x32 * x32;
194 }
195 mRms = sqrtf(float(sum_sq) / N);
196 }
VectorPCM mSignedPcm
Definition audio.h:198
float sqrtf(float value) FL_NO_EXCEPT
Definition math.h:461

References fl::FL_NO_EXCEPT, mRms, mSignedPcm, and fl::sqrtf().

Referenced by rms().

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