From bb49daa17cfbb244a239b620372eaf27ed252b0f Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 4 Feb 2026 13:10:57 +0100 Subject: feat(audio): Implement mock audio backend for testing (Task #51.2) Created MockAudioBackend for deterministic audio event recording and timing verification. Enables robust tracker synchronization testing. Changes: - Created VoiceTriggerEvent structure (timestamp, spec_id, volume, pan) - Implemented MockAudioBackend with event recording capabilities - Added time tracking: manual (advance_time) and automatic (on_frames_rendered) - Created test_mock_backend.cc with 6 comprehensive test scenarios - Verified synth integration and audio_render_silent compatibility - Added to CMake test builds All test infrastructure guarded by #if !defined(STRIP_ALL). Zero size impact on production build. All 14 tests pass. handoff(Claude): Task #51.2 complete, mock backend ready for tracker tests Co-Authored-By: Claude Sonnet 4.5 --- TODO.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md index a981f8e..71ed4ff 100644 --- a/TODO.md +++ b/TODO.md @@ -3,6 +3,15 @@ This file tracks prioritized tasks with detailed attack plans. ## Recently Completed (February 4, 2026) +- [x] **Task #51.2: Mock Audio Backend**: + - [x] **Event Recording**: Created `VoiceTriggerEvent` structure to capture timestamp, spectrogram_id, volume, and pan. + - [x] **MockAudioBackend Class**: Implemented test-only backend with event recording and time tracking capabilities. + - [x] **Time Management**: Added `advance_time()`, `set_time()`, and `get_current_time()` for deterministic testing. + - [x] **Frame Rendering Hook**: Implemented `on_frames_rendered()` to automatically update time based on audio frames (32kHz). + - [x] **Synth Integration**: Verified mock backend correctly captures voice triggers from synth engine. + - [x] **Comprehensive Tests**: Created `test_mock_backend.cc` with 6 test scenarios covering all mock functionality. + - [x] **Build Integration**: Added mock backend to test builds, all 14 tests pass. + - [x] **Task #51.1: Audio Backend Abstraction**: - [x] **Interface Created**: Defined `AudioBackend` interface in `src/audio/audio_backend.h` with hooks for voice triggering and frame rendering. - [x] **Production Backend**: Moved miniaudio implementation to `MiniaudioBackend` class, maintaining backward compatibility. @@ -73,7 +82,7 @@ This file tracks prioritized tasks with detailed attack plans. - [ ] **Task #51: Tracker Timing Verification** - [x] **Task #51.1: Audio Backend Abstraction**: Create an interface to separate audio output from synth logic, enabling testable backends. - - [ ] **Task #51.2: Mock Audio Backend**: Implement a test backend that records voice trigger events with precise timestamps. + - [x] **Task #51.2: Mock Audio Backend**: Implement a test backend that records voice trigger events with precise timestamps. - [ ] **Task #51.3: Tracker Test Suite**: Create `test_tracker.cc` to verify pattern triggering, timing accuracy, and synchronization. - [ ] **Task #51.4: Integration with Build**: Wire up tests to CMake and ensure they run in CI. -- cgit v1.2.3