49 bool needsFFT()
const override {
return true; }
51 const char*
getName()
const override {
return "Downbeat"; }
52 void reset()
override;
void setBeatDetector(shared_ptr< Beat > beatDetector)
Share an external Beat instance.
bool needsFFTHistory() const override
void setAccentThreshold(float threshold)
Set accent detection threshold (default: 1.2)
const char * getName() const override
deque< u8 > mMeterCandidates
float calculateBeatAccent(const fft::Bins &fft, float bassEnergy)
bool isDownbeat() const
Returns true if downbeat was detected this frame.
~Downbeat() FL_NOEXCEPT override
deque< float > mBeatAccents
function_list< void(float phase)> onMeasurePhase
Fires with measure phase each frame (0-1 range)
u8 getBeatsPerMeasure() const
Returns detected beats per measure (time signature numerator)
Downbeat(shared_ptr< Beat > beatDetector)
Construct with shared Beat (recommended)
u8 getCurrentBeat() const
Returns current beat number within measure (1-based, 1 = downbeat)
Downbeat() FL_NOEXCEPT
Construct with standalone Beat.
void setTimeSignature(u8 beatsPerMeasure)
Manually set time signature (disables auto-detection)
u8 findMostCommonMeter() const
function_list< void()> onDownbeat
Fires on detected downbeat (first beat of measure)
void fireCallbacks() override
float getConfidence() const
Returns downbeat detection confidence (0-1)
float mConfidenceThreshold
shared_ptr< Beat > mBeatDetector
void update(shared_ptr< Context > context) override
void updateMeasurePhase(u32 timestamp)
void updateBeatDetector(shared_ptr< Context > context)
void setAutoMeterDetection(bool enable)
Enable/disable automatic meter detection (default: true)
function_list< void(u8 beatsPerMeasure)> onMeterChange
Fires when time signature changes.
static constexpr size METER_HISTORY_SIZE
static constexpr size MAX_BEAT_HISTORY
bool needsFFT() const override
function_list< void(u8 beatNumber)> onMeasureBeat
Fires on each beat with beat number (1-based, downbeat = 1)
void setConfidenceThreshold(float threshold)
Set minimum confidence for downbeat detection (default: 0.6)
float getMeasurePhase() const
Returns measure phase (0-1, 0 = downbeat)
shared_ptr< const fft::Bins > mRetainedFFT
bool detectDownbeat(u32 timestamp, float accent)
Base definition for an LED controller.