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

◆ getHistoricalFFT()

const fft::Bins * fl::audio::Context::getHistoricalFFT ( int framesBack) const

Definition at line 120 of file audio_context.cpp.hpp.

120 {
121 if (framesBack < 0 || framesBack >= static_cast<int>(mFFTHistory.size())) {
122 return nullptr;
123 }
124 // Ring buffer lookup: walk backwards from the most-recently-written slot.
125 // Adding history.size() before the modulo avoids negative values from
126 // the subtraction, since C++ modulo of negative ints is implementation-defined.
127 const int n = static_cast<int>(mFFTHistory.size());
128 int index = (mFFTHistoryIndex - 1 - framesBack + n) % n;
129 return &mFFTHistory[index];
130}
vector< fft::Bins > mFFTHistory

References mFFTHistory, and mFFTHistoryIndex.