mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
53 lines
2.1 KiB
Rust
53 lines
2.1 KiB
Rust
//! Phrase editor.
|
|
|
|
pub(crate) use tek_core::*;
|
|
pub(crate) use tek_core::ratatui::prelude::*;
|
|
pub(crate) use tek_core::crossterm::event::{KeyCode, KeyModifiers};
|
|
pub(crate) use tek_core::midly::{num::u7, live::LiveEvent, MidiMessage};
|
|
pub(crate) use tek_jack::{*, jack::*};
|
|
pub(crate) use tek_timer::*;
|
|
pub(crate) use std::sync::{Arc, RwLock};
|
|
|
|
submod! { midi phrase arranger sequencer sequencer_track }
|
|
|
|
/// Key bindings for phrase editor.
|
|
pub const KEYMAP_SEQUENCER: &'static [KeyBinding<Sequencer>] = keymap!(Sequencer {
|
|
[Up, NONE, "seq_cursor_up", "move cursor up", |sequencer: &mut Sequencer| {
|
|
match sequencer.entered {
|
|
true => { sequencer.note_axis.point_dec(); },
|
|
false => { sequencer.note_axis.start_dec(); },
|
|
}
|
|
Ok(true)
|
|
}],
|
|
[Down, NONE, "seq_cursor_down", "move cursor down", |sequencer: &mut Sequencer| {
|
|
match sequencer.entered {
|
|
true => { sequencer.note_axis.point_inc(); },
|
|
false => { sequencer.note_axis.start_inc(); },
|
|
}
|
|
Ok(true)
|
|
}],
|
|
[Left, NONE, "seq_cursor_left", "move cursor up", |sequencer: &mut Sequencer| {
|
|
match sequencer.entered {
|
|
true => { sequencer.time_axis.point_dec(); },
|
|
false => { sequencer.time_axis.start_dec(); },
|
|
}
|
|
Ok(true)
|
|
}],
|
|
[Right, NONE, "seq_cursor_right", "move cursor up", |sequencer: &mut Sequencer| {
|
|
match sequencer.entered {
|
|
true => { sequencer.time_axis.point_inc(); },
|
|
false => { sequencer.time_axis.start_inc(); },
|
|
}
|
|
Ok(true)
|
|
}],
|
|
[Char('`'), NONE, "seq_mode_switch", "switch the display mode", |sequencer: &mut Sequencer| {
|
|
sequencer.mode = !sequencer.mode;
|
|
Ok(true)
|
|
}],
|
|
/*
|
|
[Char('a'), NONE, "note_add", "Add note", note_add],
|
|
[Char('z'), NONE, "note_del", "Delete note", note_del],
|
|
[CapsLock, NONE, "advance", "Toggle auto advance", nop],
|
|
[Char('w'), NONE, "rest", "Advance by note duration", nop],
|
|
*/
|
|
});
|