diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-15 11:52:14 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-15 11:52:14 +0100 |
| commit | 6899cc35addc43acb04bb04bcb60e88cb66ab1de (patch) | |
| tree | df2d8240e2484327c7aba754405bc3be119a308d /src/app/test_demo.cc | |
| parent | aa58489ffb597fc981fd779e9ce8b54f32e48197 (diff) | |
fix(audio): eliminate startup delay with automatic buffer pre-fill
Added audio_get_required_prefill_time() to query ring buffer lookahead
(400ms) and audio_is_prefilled() to check buffer state. audio_start()
now warns if buffer under-filled. Replaced hardcoded 100ms pre-fill
with automatic target-based pre-fill in main.cc and test_demo.cc.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/app/test_demo.cc')
| -rw-r--r-- | src/app/test_demo.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/app/test_demo.cc b/src/app/test_demo.cc index 39dbcba..f45916a 100644 --- a/src/app/test_demo.cc +++ b/src/app/test_demo.cc @@ -286,8 +286,8 @@ int main(int argc, char** argv) { audio_render_ahead(g_music_time, audio_dt * g_tempo_scale); }; - // Pre-fill using same pattern as main loop (100ms) - fill_audio_buffer(0.1f, 0.0); + // Pre-fill ring buffer to target lookahead (prevents startup delay) + fill_audio_buffer(audio_get_required_prefill_time(), 0.0); audio_start(); g_last_audio_time = audio_get_playback_time(); |
