mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
per-track reset
This commit is contained in:
parent
2989c79fd0
commit
63b5eb3740
4 changed files with 17 additions and 6 deletions
|
|
@ -302,10 +302,12 @@ fn activate (app: &mut App) -> Usually<bool> {
|
|||
if app.track_cursor == 0 {
|
||||
for (i, track) in app.tracks.iter_mut().enumerate() {
|
||||
track.sequence = scene.clips[i];
|
||||
track.reset = true;
|
||||
}
|
||||
} else {
|
||||
let track = &mut app.tracks[app.track_cursor - 1];
|
||||
track.sequence = scene.clips[app.track_cursor - 1];
|
||||
track.reset = true;
|
||||
};
|
||||
true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ process!(App |self, _client, scope| {
|
|||
} = scope.cycle_times().unwrap();
|
||||
let transport = self.transport.as_ref().unwrap().query().unwrap();
|
||||
self.playhead = transport.pos.frame() as usize;
|
||||
let mut send_all_off = false;
|
||||
let mut reset = false;
|
||||
if self.playing != Some(transport.state) {
|
||||
match transport.state {
|
||||
TransportState::Rolling => {
|
||||
|
|
@ -90,7 +90,7 @@ process!(App |self, _client, scope| {
|
|||
},
|
||||
TransportState::Stopped => {
|
||||
self.play_started = None;
|
||||
send_all_off = true;
|
||||
reset = true;
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ process!(App |self, _client, scope| {
|
|||
self.playing,
|
||||
self.play_started,
|
||||
self.quant,
|
||||
send_all_off,
|
||||
reset,
|
||||
&scope,
|
||||
(current_frames as usize, self.chunk_size),
|
||||
(current_usecs as usize, next_usecs.saturating_sub(current_usecs) as usize),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -45,12 +45,13 @@ render!(App |self, buf, area| {
|
|||
.get(self.track_cursor - 1)
|
||||
.unwrap();
|
||||
|
||||
let chain_area = Rect { x, y: y + height - height / 3 - 1, width, height: height / 3 };
|
||||
ChainView {
|
||||
focused: self.section == 1,
|
||||
track: Some(track),
|
||||
vertical: false,
|
||||
}
|
||||
.render(buf, Rect { x, y: y + height - height / 3 - 1, width, height: height / 3 })?.height;
|
||||
.render(buf, chain_area)?;
|
||||
|
||||
let phrase = self.phrase();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue