Enhance buzzer detection logic to group intermittent matches with a 500 ms quiet tail, updating relevant configurations and documentation.
This commit is contained in:
+10
-5
@@ -14,7 +14,11 @@ typedef struct {
|
||||
typedef struct {
|
||||
det_state_t state;
|
||||
uint32_t hist; // bit 0 = newest frame, 1 = matched
|
||||
uint32_t cooldown_start_ms;
|
||||
uint32_t frame_index;
|
||||
uint32_t match_time_ms[32];
|
||||
uint32_t buzz_start_ms;
|
||||
uint32_t last_match_ms;
|
||||
uint32_t last_completed_start_ms;
|
||||
uint32_t triggers;
|
||||
} detector_t;
|
||||
|
||||
@@ -24,8 +28,9 @@ void detector_reset(detector_t *d); // back to IDLE with empty history
|
||||
// Loudness gate AND score >= threshold.
|
||||
bool detector_is_match(float rms, float score, float min_rms, float threshold);
|
||||
|
||||
// Feed one frame. Returns true exactly once per trigger (IDLE -> TRIGGERED).
|
||||
// TRIGGERED lasts one frame, then COOLDOWN until cooldown_ms elapsed, then IDLE
|
||||
// with a cleared history (the buzzer's tail cannot re-trigger).
|
||||
bool detector_update(detector_t *d, bool match, uint32_t now_ms, const detector_cfg_t *cfg);
|
||||
// Feed one frame. Returns true when a buzz event ends and writes its duration.
|
||||
// Matches within cooldown_ms extend the same event; the final quiet tail is
|
||||
// excluded from its duration.
|
||||
bool detector_update(detector_t *d, bool match, uint32_t now_ms, const detector_cfg_t *cfg,
|
||||
uint32_t *buzz_duration_ms);
|
||||
const char *detector_state_name(det_state_t s);
|
||||
|
||||
Reference in New Issue
Block a user