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 (, ). --- src/audio/audio_engine.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/audio/audio_engine.cc') diff --git a/src/audio/audio_engine.cc b/src/audio/audio_engine.cc index 6d2ee92..d11303c 100644 --- a/src/audio/audio_engine.cc +++ b/src/audio/audio_engine.cc @@ -82,14 +82,14 @@ void AudioEngine::load_music_data(const TrackerScore* score, #endif } -void AudioEngine::update(float music_time) { +void AudioEngine::update(float music_time, float dt) { current_time_ = music_time; // Pre-warm samples needed in next 2 seconds (lazy loading strategy) // TODO: Implement pre-warming based on upcoming pattern triggers // Update tracker (triggers events) - tracker_update(music_time); + tracker_update(music_time, dt); } void AudioEngine::render(float* output_buffer, int num_frames) { @@ -191,7 +191,7 @@ void AudioEngine::seek(float target_time) { } // 6. Final update at exact target time - tracker_update(target_time); + tracker_update(target_time, 0.0f); current_time_ = target_time; #if defined(DEBUG_LOG_AUDIO) @@ -216,6 +216,6 @@ void AudioEngine::update_silent(float music_time) { // Update tracker without triggering audio (for fast-forward/seeking) // This is a placeholder - proper implementation requires tracker support // for silent updates. For now, we just update normally. - tracker_update(music_time); + tracker_update(music_time, 0.0f); } #endif /* !defined(STRIP_ALL) */ -- cgit v1.2.3