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

◆ pruneHypotheses()

void fl::audio::detector::TempoAnalyzer::pruneHypotheses ( )
private

Definition at line 218 of file tempo_analyzer.cpp.hpp.

218 {
219 // Remove hypotheses that haven't been updated recently
220 for (size i = 0; i < mHypotheses.size(); ) {
221 // Decay score over time
222 mHypotheses[i].score *= 0.95f;
223
224 if (mHypotheses[i].score < 0.1f) {
225 mHypotheses.erase(mHypotheses.begin() + i);
226 } else {
227 i++;
228 }
229 }
230
231 // Sort by score (highest first)
232 for (size i = 0; i < mHypotheses.size(); i++) {
233 for (size j = i + 1; j < mHypotheses.size(); j++) {
234 if (mHypotheses[j].score > mHypotheses[i].score) {
236 mHypotheses[i] = mHypotheses[j];
237 mHypotheses[j] = temp;
238 }
239 }
240 }
241
242 // Keep only top hypotheses
243 if (mHypotheses.size() > MAX_HYPOTHESES) {
245 }
246}
vector< TempoHypothesis > mHypotheses
static constexpr size MAX_HYPOTHESES

References MAX_HYPOTHESES, and mHypotheses.

Referenced by update().

+ Here is the caller graph for this function: