per-track reset

This commit is contained in:
🪞👃🪞 2024-07-05 20:14:49 +03:00
parent 2989c79fd0
commit 63b5eb3740
4 changed files with 17 additions and 6 deletions

View file

@ -22,6 +22,9 @@ pub struct Track {
pub devices: Vec<JackDevice>,
/// Device selector
pub device: usize,
/// Send all notes off
/// FIXME: Some(nframes)?
pub reset: bool
}
ports!(Track {
audio: {
@ -51,6 +54,7 @@ impl Track {
phrases: phrases.unwrap_or_else(||Vec::with_capacity(16)),
devices: devices.unwrap_or_else(||Vec::with_capacity(16)),
device: 0,
reset: true,
})
}
pub fn device (&self) -> Option<RwLockReadGuard<Box<dyn Device>>> {
@ -117,7 +121,7 @@ impl Track {
playing: Option<TransportState>,
started: Option<usize>,
quant: usize,
panic: bool,
reset: bool,
scope: &ProcessScope,
(frame0, frames): (usize, usize),
(usec0, usecs): (usize, usize),
@ -131,7 +135,11 @@ impl Track {
frame.clear();
}
// Emit "all notes off" at start of buffer if requested
if panic {
if self.reset {
all_notes_off(&mut self.midi_out_buf);
self.reset = false;
}
else if reset {
all_notes_off(&mut self.midi_out_buf);
}
// Play from phrase into output buffer