From 392d03c0c05f24be3210a04d9a50cd9714d1e265 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 8 Feb 2026 11:13:53 +0100 Subject: refactor(audio): Finalize audio sync, update docs, and clean up test artifacts - Implemented sample-accurate audio-visual synchronization by using the hardware audio clock as the master time source. - Ensured tracker updates and visual rendering are slaved to the stable audio clock. - Corrected to accept and use delta time for sample-accurate event scheduling. - Updated all relevant tests (, , , , ) to use the new delta time parameter. - Added function. - Marked Task #71 as completed in . - Updated to reflect the audio system's current status. - Created a handoff document: . - Removed temporary peak log files (, ). --- TODO.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md index a6ebe3e..2400113 100644 --- a/TODO.md +++ b/TODO.md @@ -4,20 +4,22 @@ This file tracks prioritized tasks with detailed attack plans. **Note:** For a history of recently completed tasks, see `COMPLETED.md`. -## Priority 1: Audio Pipeline Simplification & Jitter Fix (Task #71) [NEW] +## Priority 1: Audio Pipeline Simplification & Jitter Fix (Task #71) [COMPLETED] **Goal**: Address audio jittering in the miniaudio backend and simplify the entire audio pipeline (Synth, Tracker, AudioEngine, AudioBackend) for better maintainability and performance. +**Summary**: Achieved sample-accurate audio-visual synchronization by making the audio playback time the master clock for visuals and tracker updates. Eliminated jitter by using a stable audio clock for scheduling. See HANDOFF_2026-02-07_Final.md for details. + ### Phase 1: Jitter Analysis & Fix -- [ ] **Investigate**: Deep dive into `miniaudio_backend.cc` to find the root cause of audio jitter. Analyze buffer sizes, callback timing, and thread synchronization. -- [ ] **Implement Fix**: Modify buffer management, threading model, or callback logic to ensure smooth, consistent audio delivery. -- [ ] **Verify**: Create a new, specific test case in `src/tests/test_audio_backend.cc` or a new test file that reliably reproduces jitter and confirms the fix. +- [x] **Investigate**: Deep dive into `miniaudio_backend.cc` to find the root cause of audio jitter. Analyze buffer sizes, callback timing, and thread synchronization. +- [x] **Implement Fix**: Modify buffer management, threading model, or callback logic to ensure smooth, consistent audio delivery. +- [x] **Verify**: Create a new, specific test case in `src/tests/test_audio_backend.cc` or a new test file that reliably reproduces jitter and confirms the fix. ### Phase 2: Code Simplification & Refactor -- [ ] **Review Architecture**: Map out the current interactions between `Synth`, `Tracker`, `AudioEngine`, and `AudioBackend`. -- [ ] **Identify Complexity**: Pinpoint areas of redundant code, unnecessary abstractions, or confusing data flow. -- [ ] **Refactor**: Simplify the pipeline to create a clear, linear data flow from tracker events to audio output. Reduce dependencies and clarify ownership of resources. -- [ ] **Update Documentation**: Modify `doc/HOWTO.md` and `doc/CONTRIBUTING.md` to reflect the new, simpler audio architecture. +- [x] **Review Architecture**: Map out the current interactions between `Synth`, `Tracker`, `AudioEngine`, and `AudioBackend`. +- [x] **Identify Complexity**: Pinpoint areas of redundant code, unnecessary abstractions, or confusing data flow. +- [x] **Refactor**: Simplify the pipeline to create a clear, linear data flow from tracker events to audio output. Reduce dependencies and clarify ownership of resources. +- [x] **Update Documentation**: Modify `doc/HOWTO.md` and `doc/CONTRIBUTING.md` to reflect the new, simpler audio architecture. --- -- cgit v1.2.3