From 807c6f5097897fac92428b939df020cdb70aae77 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 9 Feb 2026 12:57:22 +0100 Subject: fix: Audio startup hiccup - use fill_audio_buffer for pre-fill - Added target_fill parameter to audio_render_ahead() for explicit control - Pre-fill now uses fill_audio_buffer() (same logic as main loop) - Ensures consistent tempo scaling and time advancement - Reduced pre-fill from 400ms to 100ms (was blocking visuals) - All 33 tests passing handoff(Claude): Fixed audio startup silence/suspension issue --- src/main.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/main.cc') diff --git a/src/main.cc b/src/main.cc index 4c44a78..59001fb 100644 --- a/src/main.cc +++ b/src/main.cc @@ -160,13 +160,9 @@ int main(int argc, char** argv) { } #endif /* !defined(STRIP_ALL) */ - // PRE-FILL: Fill ring buffer with initial 200ms before starting audio device - // This prevents underrun on first callback - g_audio_engine.update(g_music_time, 1.0f / 60.0f); - audio_render_ahead(g_music_time, - 1.0f / 60.0f); // Fill buffer with lookahead + // Pre-fill using same pattern as main loop (100ms) + fill_audio_buffer(0.1f, 0.0); - // Start audio (or render to WAV file) audio_start(); g_last_audio_time = audio_get_playback_time(); // Initialize after start -- cgit v1.2.3