wip: EdnKeymap loads

This commit is contained in:
🪞👃🪞 2025-01-12 01:57:00 +01:00
parent 364d617d37
commit f485a068a8
13 changed files with 14 additions and 8 deletions

0
midi/edn/midi-view.edn Normal file
View file

View file

View file

View file

@ -14,8 +14,9 @@ pub trait HasEditor {
}
/// Contains state for viewing and editing a clip
pub struct MidiEditor {
pub mode: PianoHorizontal,
pub size: Measure<TuiOut>
pub mode: PianoHorizontal,
pub size: Measure<TuiOut>,
pub keymap: EdnKeymap,
}
from!(|clip: &Arc<RwLock<MidiClip>>|MidiEditor = {
let model = Self::from(Some(clip.clone()));
@ -30,9 +31,14 @@ from!(|clip: Option<Arc<RwLock<MidiClip>>>|MidiEditor = {
});
impl Default for MidiEditor {
fn default () -> Self {
let mode = PianoHorizontal::new(None);
mode.redraw();
Self { mode, size: Measure::new() }
Self {
mode: PianoHorizontal::new(None),
size: Measure::new(),
keymap: EdnKeymap(
EdnItem::<String>::read_all(include_str!("../edn/midi-keys.edn"))
.expect("failed to load keymap for MidiEditor")
)
}
}
}
has_size!(<TuiOut>|self: MidiEditor|&self.size);

View file

View file

View file

@ -33,7 +33,7 @@ impl App {
midi_tos: &[PortConnection],
) -> Self {
Self {
edn: include_str!("../edn/sequencer.edn").to_string(),
edn: include_str!("../edn/sequencer-view.edn").to_string(),
jack: jack.clone(),
pool: Some(pool),
editor: Some(editor),
@ -56,7 +56,7 @@ impl App {
audio_tos: &[&[PortConnection]],
) -> Self {
Self {
edn: include_str!("../edn/groovebox.edn").to_string(),
edn: include_str!("../edn/groovebox-view.edn").to_string(),
sampler: Some(sampler),
..Self::sequencer(
jack, pool, editor,
@ -78,7 +78,7 @@ impl App {
track_width: usize,
) -> Self {
let mut arranger = Self {
edn: include_str!("../edn/arranger.edn").to_string(),
edn: include_str!("../edn/arranger-view.edn").to_string(),
..Self::groovebox(
jack, pool, editor,
None, midi_froms, midi_tos,