mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
add Arranger model
This commit is contained in:
parent
c85fa3cd06
commit
20e30cb472
14 changed files with 310 additions and 241 deletions
|
|
@ -44,8 +44,8 @@ fn handle_focused (state: &mut App, e: &AppEvent) -> Usually<bool> {
|
|||
}
|
||||
|
||||
fn handle_device (state: &mut App, e: &AppEvent) -> Usually<bool> {
|
||||
state.track_mut()
|
||||
.and_then(|(_, track)|track.device_mut())
|
||||
state.arranger.track()
|
||||
.and_then(|track|track.device_mut())
|
||||
.map(|mut device|device.handle(e))
|
||||
.transpose()
|
||||
.map(|x|x.unwrap_or(false))
|
||||
|
|
@ -58,15 +58,15 @@ pub const KEYMAP_GLOBAL: &'static [KeyBinding<App>] = keymap!(App {
|
|||
Ok(true)
|
||||
}],
|
||||
[Char('r'), NONE, "record_toggle", "toggle recording", |app: &mut App| {
|
||||
app.track_mut().map(|t|t.1.toggle_record());
|
||||
app.arranger.track_mut().map(|t|t.toggle_record());
|
||||
Ok(true)
|
||||
}],
|
||||
[Char('o'), NONE, "overdub_toggle", "toggle overdub", |app: &mut App| {
|
||||
app.track_mut().map(|t|t.1.toggle_overdub());
|
||||
app.arranger.track_mut().map(|t|t.toggle_overdub());
|
||||
Ok(true)
|
||||
}],
|
||||
[Char('m'), NONE, "monitor_toggle", "toggle monitor", |app: &mut App| {
|
||||
app.track_mut().map(|t|t.1.toggle_monitor());
|
||||
app.arranger.track_mut().map(|t|t.toggle_monitor());
|
||||
Ok(true)
|
||||
}],
|
||||
[Char('+'), NONE, "quant_inc", "quantize coarser", |app: &mut App| {
|
||||
|
|
@ -86,12 +86,12 @@ pub const KEYMAP_GLOBAL: &'static [KeyBinding<App>] = keymap!(App {
|
|||
Ok(true)
|
||||
}],
|
||||
[Char('x'), NONE, "extend", "double the current clip", |app: &mut App| {
|
||||
if let Some(phrase) = app.phrase_mut() {
|
||||
app.arranger.phrase_mut().map(|phrase|{
|
||||
let mut notes = phrase.notes.clone();
|
||||
notes.extend_from_slice(&mut phrase.notes);
|
||||
phrase.notes = notes;
|
||||
phrase.length = phrase.length * 2;
|
||||
}
|
||||
});
|
||||
Ok(true)
|
||||
}],
|
||||
[Char('l'), NONE, "loop_toggle", "toggle looping", |_app: &mut App| {
|
||||
|
|
@ -115,11 +115,11 @@ pub const KEYMAP_GLOBAL: &'static [KeyBinding<App>] = keymap!(App {
|
|||
Ok(true)
|
||||
}],
|
||||
[Char('a'), CONTROL, "scene_add", "add a new scene", |app: &mut App| {
|
||||
app.add_scene(None)?;
|
||||
app.arranger.scene_add(None)?;
|
||||
Ok(true)
|
||||
}],
|
||||
[Char('t'), CONTROL, "track_add", "add a new track", |app: &mut App| {
|
||||
app.add_track(None)?;
|
||||
app.arranger.track_add(None)?;
|
||||
Ok(true)
|
||||
}],
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue