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

◆ findMostCommonMeter()

u8 fl::audio::detector::Downbeat::findMostCommonMeter ( ) const
private

Definition at line 402 of file downbeat.cpp.hpp.

402 {
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}
unsigned char u8
Definition stdint.h:131

References mMeterCandidates.

Referenced by detectMeter().

+ Here is the caller graph for this function: