summaryrefslogtreecommitdiff
path: root/src/audio/audio.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/audio.cc')
-rw-r--r--src/audio/audio.cc5
1 files changed, 5 insertions, 0 deletions
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;