diff options
Diffstat (limited to 'src/audio')
| -rw-r--r-- | src/audio/audio.cc | 6 | ||||
| -rw-r--r-- | src/audio/audio.h | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/audio/audio.cc b/src/audio/audio.cc index 2f485a6..c5bd3d9 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -65,9 +65,11 @@ void audio_start() { g_audio_backend->start(); } -void audio_render_ahead(float music_time, float dt) { +void audio_render_ahead(float music_time, float dt, float target_fill) { // Target: maintain look-ahead buffer - const float target_lookahead = (float)RING_BUFFER_LOOKAHEAD_MS / 1000.0f; + const float target_lookahead = (target_fill < 0.0f) + ? (float)RING_BUFFER_LOOKAHEAD_MS / 1000.0f + : target_fill; // Render in small chunks to keep synth time synchronized with tracker // Chunk size: one frame's worth of audio (~16.6ms @ 60fps) diff --git a/src/audio/audio.h b/src/audio/audio.h index e063a57..778d312 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -24,7 +24,8 @@ void audio_init(); void audio_start(); // Starts the audio device callback // Ring buffer audio rendering (main thread fills buffer) -void audio_render_ahead(float music_time, float dt); +// target_fill: Target buffer fill time in seconds (default: RING_BUFFER_LOOKAHEAD_MS/1000) +void audio_render_ahead(float music_time, float dt, float target_fill = -1.0f); // Get current playback time (in seconds) based on samples consumed // This is the ring buffer READ position (what's being played NOW) |
