launch pt.11: add start correction to switchover

This commit is contained in:
🪞👃🪞 2024-11-02 17:02:55 +02:00
parent 02a4cf8a0a
commit 5e7609d035

View file

@ -110,7 +110,9 @@ impl PhrasePlayer {
if let Some((start_at, phrase)) = &self.next_phrase {
let start = start_at.sample.get() as usize;
// If it's time to switch to the next phrase:
if start <= sample0 {
if start <= sample0.saturating_sub(
self.clock.started.read().unwrap().unwrap().0
) {
// Samples elapsed since phrase was supposed to start
let skipped = sample0 - start;
// Switch over to enqueued phrase