mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
midi: add pgup/pgdn; cleanup
This commit is contained in:
parent
22155f7acf
commit
397e71edee
15 changed files with 96 additions and 212 deletions
|
|
@ -1,19 +1,28 @@
|
|||
(@up note/pos :note-pos-next)
|
||||
(@w note/pos :note-pos-next)
|
||||
(@down note/pos :note-pos-prev)
|
||||
(@s note/pos :note-pos-prev)
|
||||
(@comma note/len :note-len-prev)
|
||||
(@period note/len :note-len-next)
|
||||
(@plus note/range :note-range-next-)
|
||||
(@underscore note/range :note-range-prev-)
|
||||
(@up note/pos :note-pos-next)
|
||||
(@w note/pos :note-pos-next)
|
||||
(@down note/pos :note-pos-prev)
|
||||
(@s note/pos :note-pos-prev)
|
||||
|
||||
(@left time/pos :time-pos-prev)
|
||||
(@a time/pos :time-pos-prev)
|
||||
(@right time/pos :time-pos-next)
|
||||
(@d time/pos :time-pos-next)
|
||||
(@equal time/zoom :time-zoom-prev)
|
||||
(@minus time/zoom :time-zoom-next)
|
||||
(@z time/lock)
|
||||
(@pgup note/pos :note-pos-next-octave)
|
||||
(@pgdn note/pos :note-pos-prev-octave)
|
||||
|
||||
(@comma note/len :note-len-prev)
|
||||
(@period note/len :note-len-next)
|
||||
(@lt note/len :note-len-prev)
|
||||
(@gt note/len :note-len-next)
|
||||
|
||||
(@plus note/range :note-range-next)
|
||||
(@underscore note/range :note-range-prev)
|
||||
|
||||
(@left time/pos :time-pos-prev)
|
||||
(@a time/pos :time-pos-prev)
|
||||
(@right time/pos :time-pos-next)
|
||||
(@d time/pos :time-pos-next)
|
||||
|
||||
(@equal time/zoom :time-zoom-prev)
|
||||
(@minus time/zoom :time-zoom-next)
|
||||
|
||||
(@z time/lock)
|
||||
|
||||
(@enter note/put)
|
||||
(@shift-enter note/append)
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
(@t length begin)
|
||||
(@m import begin)
|
||||
(@x export begin)
|
||||
(@c clip color :current :random-color)
|
||||
(@openbracket select :previous)
|
||||
(@closebracket select :next)
|
||||
(@lt swap :current :previous)
|
||||
(@gt swap :current :next)
|
||||
(@delete clip/delete :current)
|
||||
(@c clip color :clip :random-color)
|
||||
(@openbracket select :clip-prev)
|
||||
(@closebracket select :clip-next)
|
||||
(@lt swap :clip :clip-prev)
|
||||
(@gt swap :clip :clip-next)
|
||||
(@delete clip/delete :clip)
|
||||
(@shift-A clip/add :after :new-clip)
|
||||
(@shift-D clip/add :after :cloned-clip)
|
||||
|
|
|
|||
|
|
@ -1,53 +1,4 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//fn to_clips_command (state: &MidiPool, input: &Event) -> Option<PoolCommand> {
|
||||
//use KeyCode::{Up, Down, Delete, Char};
|
||||
//use PoolCommand as Cmd;
|
||||
//let index = state.clip_index();
|
||||
//let count = state.clips().len();
|
||||
//Some(match input {
|
||||
//kpat!(Char('n')) => Cmd::Rename(ClipRenameCommand::Begin),
|
||||
//kpat!(Char('t')) => Cmd::Length(ClipLengthCommand::Begin),
|
||||
//kpat!(Char('m')) => Cmd::Import(FileBrowserCommand::Begin),
|
||||
//kpat!(Char('x')) => Cmd::Export(FileBrowserCommand::Begin),
|
||||
//kpat!(Char('c')) => Cmd::Clip(PoolClipCommand::SetColor(index, ItemColor::random())),
|
||||
//kpat!(Char('[')) | kpat!(Up) => Cmd::Select(
|
||||
//index.overflowing_sub(1).0.min(state.clips().len() - 1)
|
||||
//),
|
||||
//kpat!(Char(']')) | kpat!(Down) => Cmd::Select(
|
||||
//index.saturating_add(1) % state.clips().len()
|
||||
//),
|
||||
//kpat!(Char('<')) => if index > 1 {
|
||||
//state.set_clip_index(state.clip_index().saturating_sub(1));
|
||||
//Cmd::Clip(PoolClipCommand::Swap(index - 1, index))
|
||||
//} else {
|
||||
//return None
|
||||
//},
|
||||
//kpat!(Char('>')) => if index < count.saturating_sub(1) {
|
||||
//state.set_clip_index(state.clip_index() + 1);
|
||||
//Cmd::Clip(PoolClipCommand::Swap(index + 1, index))
|
||||
//} else {
|
||||
//return None
|
||||
//},
|
||||
//kpat!(Delete) => if index > 0 {
|
||||
//state.set_clip_index(index.min(count.saturating_sub(1)));
|
||||
//Cmd::Clip(PoolClipCommand::Delete(index))
|
||||
//} else {
|
||||
//return None
|
||||
//},
|
||||
//kpat!(Char('a')) | kpat!(Shift-Char('A')) => Cmd::Clip(PoolClipCommand::Add(count, MidiClip::new(
|
||||
//"Clip", true, 4 * PPQ, None, Some(ItemTheme::random())
|
||||
//))),
|
||||
//kpat!(Char('i')) => Cmd::Clip(PoolClipCommand::Add(index + 1, MidiClip::new(
|
||||
//"Clip", true, 4 * PPQ, None, Some(ItemTheme::random())
|
||||
//))),
|
||||
//kpat!(Char('d')) | kpat!(Shift-Char('D')) => {
|
||||
//let mut clip = state.clips()[index].read().unwrap().duplicate();
|
||||
//clip.color = ItemTheme::random_near(clip.color, 0.25);
|
||||
//Cmd::Clip(PoolClipCommand::Add(index + 1, clip))
|
||||
//},
|
||||
//_ => return None
|
||||
//})
|
||||
//}
|
||||
//keymap!(KEYS_MIDI_EDITOR = |s: MidiEditor, _input: Event| MidiEditCommand {
|
||||
//key(Up) => SetNoteCursor(s.note_pos() + 1),
|
||||
//key(Char('w')) => SetNoteCursor(s.note_pos() + 1),
|
||||
|
|
@ -74,12 +25,6 @@
|
|||
//key(Char('_')) => SetTimeZoom(if s.time_lock().get() { s.time_zoom().get() } else { NoteDuration::next(s.time_zoom().get()) }),
|
||||
//key(Char('=')) => SetTimeZoom(if s.time_lock().get() { s.time_zoom().get() } else { NoteDuration::prev(s.time_zoom().get()) }),
|
||||
//key(Char('+')) => SetTimeZoom(if s.time_lock().get() { s.time_zoom().get() } else { NoteDuration::prev(s.time_zoom().get()) }),
|
||||
//key(Enter) => PutNote,
|
||||
//ctrl(key(Enter)) => AppendNote,
|
||||
//key(Char(',')) => SetNoteLength(NoteDuration::prev(s.note_len())),
|
||||
//key(Char('.')) => SetNoteLength(NoteDuration::next(s.note_len())),
|
||||
//key(Char('<')) => SetNoteLength(NoteDuration::prev(s.note_len())),
|
||||
//key(Char('>')) => SetNoteLength(NoteDuration::next(s.note_len())),
|
||||
////// TODO: kpat!(Char('/')) => // toggle 3plet
|
||||
////// TODO: kpat!(Char('?')) => // toggle dotted
|
||||
//});
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ provide!(usize: |self: MidiEditor| {
|
|||
":note-pos" => self.note_pos(),
|
||||
":note-pos-next" => self.note_pos() + 1,
|
||||
":note-pos-prev" => self.note_pos().saturating_sub(1),
|
||||
":note-pos-next-octave" => self.note_pos() + 12,
|
||||
":note-pos-prev-octave" => self.note_pos().saturating_sub(12),
|
||||
|
||||
":note-len" => self.note_len(),
|
||||
":note-len-next" => self.note_len() + 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue