Fix sync_offset calculation

This commit is contained in:
Niels Geens 2025-08-18 15:31:28 +02:00
parent 62edeeebce
commit 3e4f79380c

View File

@ -53,7 +53,10 @@ impl<const ROWS: usize> Column<ROWS> {
}
} else {
if len > 0 {
let sync_offset = len - self.playback_position;
// Calculate the next beat position where recording will start
let current_beat = self.playback_position / self.frames_per_beat;
let next_beat = (current_beat + 1) % (len / self.frames_per_beat);
let sync_offset = next_beat * self.frames_per_beat;
track.record_auto_stop(len, sync_offset, last_volume_setting);
} else {
track.record(last_volume_setting);