| 55 | } // namespace detector |
| 56 | |
| 57 | class Processor { |
| 58 | public: |
| 59 | Processor() FL_NOEXCEPT; |
| 60 | ~Processor() FL_NOEXCEPT; |
| 61 | |
| 62 | // ----- Main Update ----- |
| 63 | void update(const Sample& sample) FL_NOEXCEPT; |
| 64 | |
| 65 | // Update detectors using an externally-provided Context (FFT already cached). |
| 66 | // Skips signal conditioning and setSample — caller is responsible for those. |
| 67 | void updateFromContext(shared_ptr<Context> externalContext) FL_NOEXCEPT; |
| 68 | |
| 69 | // ----- Beat Detection Events ----- |
| 70 | void onBeat(function<void()> callback) FL_NOEXCEPT; |
| 71 | void onBeatPhase(function<void(float phase)> callback) FL_NOEXCEPT; |
| 72 | void onOnset(function<void(float strength)> callback) FL_NOEXCEPT; |
| 73 | void onTempoChange(function<void(float bpm, float confidence)> callback) FL_NOEXCEPT; |
| 74 | |
| 75 | // ----- Tempo Analysis Events ----- |
| 76 | void onTempo(function<void(float bpm)> callback) FL_NOEXCEPT; |
| 77 | void onTempoWithConfidence(function<void(float bpm, float confidence)> callback) FL_NOEXCEPT; |
| 78 | void onTempoStable(function<void()> callback) FL_NOEXCEPT; |
| 79 | void onTempoUnstable(function<void()> callback) FL_NOEXCEPT; |
| 80 | |
| 81 | // ----- Frequency Band Events ----- |
| 82 | void onBass(function<void(float level)> callback) FL_NOEXCEPT; |
| 83 | void onMid(function<void(float level)> callback) FL_NOEXCEPT; |
| 84 | void onTreble(function<void(float level)> callback) FL_NOEXCEPT; |
| 85 | void onFrequencyBands(function<void(float bass, float mid, float treble)> callback) FL_NOEXCEPT; |
| 86 | |
| 87 | // ----- detector::Equalizer Events (WLED-style, all 0.0-1.0) ----- |
| 88 | void onEqualizer(function<void(const detector::Equalizer&)> callback) FL_NOEXCEPT; |
| 89 | |
| 90 | // ----- Energy/Level Events ----- |
| 91 | void onEnergy(function<void(float rms)> callback) FL_NOEXCEPT; |
| 92 | void onNormalizedEnergy(function<void(float normalizedRms)> callback) FL_NOEXCEPT; |
| 93 | void onPeak(function<void(float peak)> callback) FL_NOEXCEPT; |
| 94 | void onAverageEnergy(function<void(float avgEnergy)> callback) FL_NOEXCEPT; |
| 95 | |
| 96 | // ----- Transient Detection Events ----- |
| 97 | void onTransient(function<void()> callback) FL_NOEXCEPT; |
| 98 | void onTransientWithStrength(function<void(float strength)> callback) FL_NOEXCEPT; |
| 99 | void onAttack(function<void(float strength)> callback) FL_NOEXCEPT; |
| 100 | |
| 101 | // ----- Silence Detection Events ----- |
| 102 | void onSilence(function<void(u8 silent)> callback) FL_NOEXCEPT; |
| 103 | void onSilenceStart(function<void()> callback) FL_NOEXCEPT; |
| 104 | void onSilenceEnd(function<void()> callback) FL_NOEXCEPT; |
| 105 | void onSilenceDuration(function<void(u32 durationMs)> callback) FL_NOEXCEPT; |
| 106 | |
| 107 | // ----- Dynamics Analysis Events ----- |
| 108 | void onCrescendo(function<void()> callback) FL_NOEXCEPT; |
| 109 | void onDiminuendo(function<void()> callback) FL_NOEXCEPT; |
| 110 | void onDynamicTrend(function<void(float trend)> callback) FL_NOEXCEPT; |
| 111 | void onCompressionRatio(function<void(float compression)> callback) FL_NOEXCEPT; |
| 112 | |
| 113 | // ----- Pitch Detection Events ----- |
| 114 | void onPitch(function<void(float hz)> callback) FL_NOEXCEPT; |