mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
EdnProvide
This commit is contained in:
parent
794d4210c6
commit
fc06fb863b
7 changed files with 126 additions and 61 deletions
|
|
@ -1,22 +1,37 @@
|
|||
use crate::*;
|
||||
use self::MidiEditCommand::*;
|
||||
use KeyCode::*;
|
||||
impl EdnCommand<MidiEditor> for MidiEditCommand {
|
||||
fn from_edn <'a> (state: &MidiEditor, head: &EdnItem<&str>, tail: &'a [EdnItem<String>]) -> Self {
|
||||
use EdnItem::*;
|
||||
match (head, tail) {
|
||||
(Key("note/put"), [a]) => Self::PutNote,
|
||||
(Key("note/del"), [a]) => Self::AppendNote,
|
||||
(Key("note/dur"), [a]) => Self::AppendNote,
|
||||
(Key("note/range"), [a]) => Self::AppendNote,
|
||||
(Key("note/pos"), [a]) => Self::AppendNote,
|
||||
(Key("time/pos"), [a]) => Self::AppendNote,
|
||||
(Key("time/zoom"), [a]) => Self::AppendNote,
|
||||
(Key("time/lock"), [a]) => Self::AppendNote,
|
||||
_ => todo!()
|
||||
}
|
||||
}
|
||||
}
|
||||
edn_provide!(bool: |self: MidiEditor|{
|
||||
":true" => true,
|
||||
":false" => false
|
||||
});
|
||||
edn_provide!(usize: |self: MidiEditor|{
|
||||
":note-length" => self.note_len(),
|
||||
":note-point" => self.note_point(),
|
||||
":time-point" => self.time_point(),
|
||||
":time-zoom" => self.time_zoom().get(),
|
||||
});
|
||||
edn_command!(MidiEditCommand: |state: MidiEditor| {
|
||||
("note/put" [a: bool] Self::PutNote)
|
||||
("note/del" [a: bool] Self::PutNote)
|
||||
("note/dur" [a: usize] Self::SetNoteCursor(a))
|
||||
});
|
||||
//impl EdnCommand<MidiEditor> for MidiEditCommand {
|
||||
//fn from_edn <'a> (state: &MidiEditor, head: &EdnItem<&str>, tail: &'a [EdnItem<String>]) -> Self {
|
||||
//use EdnItem::*;
|
||||
//match (head, tail) {
|
||||
//(Key("note/put"), [a]) => Self::PutNote,
|
||||
//(Key("note/del"), [a]) => Self::AppendNote,
|
||||
//(Key("note/dur"), [a]) => Self::AppendNote,
|
||||
//(Key("note/range"), [a]) => Self::AppendNote,
|
||||
//(Key("note/pos"), [a]) => Self::AppendNote,
|
||||
//(Key("time/pos"), [a]) => Self::AppendNote,
|
||||
//(Key("time/zoom"), [a]) => Self::AppendNote,
|
||||
//(Key("time/lock"), [a]) => Self::AppendNote,
|
||||
//_ => todo!()
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
#[derive(Clone, Debug)] pub enum MidiEditCommand {
|
||||
// TODO: 1-9 seek markers that by default start every 8th of the clip
|
||||
AppendNote,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue