sync midi by frames rather than useconds

This commit is contained in:
🪞👃🪞 2024-07-05 20:44:31 +03:00
parent 63b5eb3740
commit b1e4ec3a88
4 changed files with 29 additions and 17 deletions

View file

@ -119,7 +119,7 @@ impl Track {
input: MidiIter,
timebase: &Arc<Timebase>,
playing: Option<TransportState>,
started: Option<usize>,
started: Option<(usize, usize)>,
quant: usize,
reset: bool,
scope: &ProcessScope,
@ -145,13 +145,13 @@ impl Track {
// Play from phrase into output buffer
let phrase = &mut self.sequence.map(|id|self.phrases.get_mut(id)).flatten();
if playing == Some(TransportState::Rolling) {
if let Some(started) = started {
if let Some((start_frame, start_usec)) = started {
if let Some(phrase) = phrase {
phrase.process_out(
&mut self.midi_out_buf,
&mut self.notes_on,
timebase,
(usec0 - started, usecs, period)
(frame0.saturating_sub(start_frame), frames, period)
);
}
}