From 8cababb75f17c420518cc5e84b66f48a1a1b82d3 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 15 Feb 2026 12:38:48 +0100 Subject: investigating audio-drive bug --- src/audio/audio.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/audio/audio.cc') diff --git a/src/audio/audio.cc b/src/audio/audio.cc index aaadd5a..ba76a28 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -97,6 +97,11 @@ void audio_render_ahead(float music_time, float dt, float target_fill) { // Render in small chunks to keep synth time synchronized with tracker // Chunk size: one frame's worth of audio (~16.6ms @ 60fps) + // TODO(timing): CRITICAL BUG - Truncation here may cause 180ms drift over 63 beats + // (int) cast loses fractional samples: 0.333 samples/frame * 2560 frames = 853 samples = 27ms + // But observed drift is 180ms, so this is not the only source (27ms < 180ms) + // NOTE: This is NOT a float vs double precision issue - floats handle <500s times fine + // See also: tracker.cc BPM timing calculation const int chunk_frames = (int)(dt * RING_BUFFER_SAMPLE_RATE); const int chunk_samples = chunk_frames * RING_BUFFER_CHANNELS; -- cgit v1.2.3