diff --git a/crates/app/src/api.rs b/crates/app/src/api.rs index ada08eb1..4eb728af 100644 --- a/crates/app/src/api.rs +++ b/crates/app/src/api.rs @@ -21,39 +21,6 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm fn _todo_isize_stub (&self) -> isize { todo!() } - fn _todo_clip_cmd_stub (&self) -> ClipCommand { - todo!() - } - fn _todo_clock_cmd_stub (&self) -> ClockCommand { - todo!() - } - fn _todo_sampler_cmd_stub (&self) -> SamplerCommand { - todo!() - } - fn _todo_pool_cmd_stub (&self) -> PoolCommand { - todo!() - } - fn _todo_output_cmd_stub (&self) -> OutputCommand { - todo!() - } - fn _todo_input_cmd_stub (&self) -> InputCommand { - todo!() - } - fn _todo_midi_edit_cmd_stub (&self) -> MidiEditCommand { - todo!() - } - fn _todo_message_cmd_stub (&self) -> MessageCommand { - todo!() - } - fn _todo_scene_cmd_stub (&self) -> SceneCommand { - todo!() - } - fn _todo_device_cmd_stub (&self) -> DeviceCommand { - todo!() - } - fn _todo_track_cmd_stub (&self) -> TrackCommand { - todo!() - } fn _todo_item_theme_stub (&self) -> ItemTheme { todo!() } @@ -209,18 +176,6 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm fn _todo_arc_str_stub (&self) -> Arc { todo!() } - fn _todo_clip_command_stub (&self) -> PoolClipCommand { - todo!() - } - fn _todo_file_command_stub (&self) -> FileBrowserCommand { - todo!() - } - fn _todo_length_command_stub (&self) -> ClipLengthCommand { - todo!() - } - fn _todo_rename_command_stub (&self) -> ClipRenameCommand { - todo!() - } fn clip_new (&self) -> MidiClip { self.new_clip() } @@ -352,6 +307,35 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm None }) } + fn color (app: &mut App, theme: ItemTheme) -> Perhaps { + Ok(app.set_color(Some(theme)).map(|theme|Self::Color{theme})) + } + fn enqueue (app: &mut App, clip: Option>>) -> Perhaps { + todo!() + } + fn history (app: &mut App, delta: isize) -> Perhaps { + todo!() + } + fn zoom (app: &mut App, zoom: usize) -> Perhaps { + todo!() + } + fn launch (app: &mut App) -> Perhaps { + app.launch(); + Ok(None) + } + fn select (app: &mut App, selection: Selection) -> Perhaps { + app.select(selection); + Ok(None) + //("select" [t: usize, s: usize] Some(match (t.expect("no track"), s.expect("no scene")) { + //(0, 0) => Self::Select(Selection::Mix), + //(t, 0) => Self::Select(Selection::Track(t)), + //(0, s) => Self::Select(Selection::Scene(s)), + //(t, s) => Self::Select(Selection::TrackClip { track: t, scene: s }) }))) + } + fn stop_all (app: &mut App) -> Perhaps { + app.stop_all(); + Ok(None) + } fn sampler (app: &mut App, command: SamplerCommand) -> Perhaps { Ok(app.sampler_mut() .map(|s|command.delegate(s, |command|Self::Sampler{command})) @@ -382,34 +366,26 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm fn message (app: &mut App, command: MessageCommand) -> Perhaps { Ok(command.delegate(app, |command|Self::Message{command})?) } - fn color (app: &mut App, theme: ItemTheme) -> Perhaps { - Ok(app.set_color(Some(theme)).map(|theme|Self::Color{theme})) +} + +impl<'state> Context<'state, ClockCommand> for App { + fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option { + Context::get(&self.clock, iter) } - fn enqueue (app: &mut App, clip: Option>>) -> Perhaps { - todo!() +} +impl<'state> Context<'state, MidiEditCommand> for App { + fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option { + self.editor().map(|e|Context::get(e, iter)).flatten() } - fn history (app: &mut App, delta: isize) -> Perhaps { - todo!() +} +impl<'state> Context<'state, PoolCommand> for App { + fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option { + self.pool().map(|p|Context::get(p, iter)).flatten() } - fn zoom (app: &mut App, zoom: usize) -> Perhaps { - todo!() - } - fn launch (app: &mut App) -> Perhaps { - app.launch(); - Ok(None) - } - fn select (app: &mut App, selection: Selection) -> Perhaps { - app.select(selection); - Ok(None) - //("select" [t: usize, s: usize] Some(match (t.expect("no track"), s.expect("no scene")) { - //(0, 0) => Self::Select(Selection::Mix), - //(t, 0) => Self::Select(Selection::Track(t)), - //(0, s) => Self::Select(Selection::Scene(s)), - //(t, s) => Self::Select(Selection::TrackClip { track: t, scene: s }) }))) - } - fn stop_all (app: &mut App) -> Perhaps { - app.stop_all(); - Ok(None) +} +impl<'state> Context<'state, SamplerCommand> for App { + fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option { + self.sampler().map(|p|Context::get(p, iter)).flatten() } } diff --git a/crates/device/src/lv2.rs b/crates/device/src/lv2.rs index 47429b87..b1f0b505 100644 --- a/crates/device/src/lv2.rs +++ b/crates/device/src/lv2.rs @@ -2,15 +2,4 @@ mod lv2_model; pub use self::lv2_model::*; mod lv2_audio; pub use self::lv2_audio::*; mod lv2_gui; pub use self::lv2_gui::*; mod lv2_tui; pub use self::lv2_tui::*; - pub(self) use std::thread::JoinHandle; - -pub(self) use ::livi::{ - World, - Instance, - Plugin as LiviPlugin, - Features, - FeaturesBuilder, - Port as LiviPort, - event::LV2AtomSequence, -}; diff --git a/deps/tengri b/deps/tengri index 3bb38f2d..20ccff13 160000 --- a/deps/tengri +++ b/deps/tengri @@ -1 +1 @@ -Subproject commit 3bb38f2d27afc294349f72b1a2f7936bc9338d4f +Subproject commit 20ccff13de1957c1268c6fec64048d8ae1767fd5