MCPcopy Create free account
hub / github.com/FastLED/FastLED / findMostCommonMeter

Method findMostCommonMeter

src/fl/audio/detector/downbeat.cpp.hpp:402–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400}
401
402u8 Downbeat::findMostCommonMeter() const {
403 if (mMeterCandidates.empty()) {
404 return 4; // Default to 4/4
405 }
406
407 // Count occurrences of each meter
408 fl::array<u8, 16> counts = {}; // Support meters 2-16
409
410 for (size i = 0; i < mMeterCandidates.size(); i++) {
411 u8 meter = mMeterCandidates[i];
412 if (meter >= 2 && meter < 16) {
413 counts[meter]++;
414 }
415 }
416
417 // Find most common
418 u8 maxCount = 0;
419 u8 mostCommonMeter = 4;
420
421 for (u8 meter = 2; meter < 16; meter++) {
422 if (counts[meter] > maxCount) {
423 maxCount = counts[meter];
424 mostCommonMeter = meter;
425 }
426 }
427
428 return mostCommonMeter;
429}
430
431} // namespace detector
432} // namespace audio

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected