diff --git a/src/app/cli.rs b/src/app/cli.rs index 78dea7a7..8c03d5b7 100644 --- a/src/app/cli.rs +++ b/src/app/cli.rs @@ -78,13 +78,13 @@ use crate::*; #[cfg(feature = "cli")] impl Cli { pub fn run (&self) -> Usually<()> { - self.action.run(&Config::init_new(None)?) + self.action.run(Config::init_new(None)?) } } #[cfg(feature = "cli")] impl Action { - fn run (&self, config: &Config) -> Usually<()> { + fn run (&self, config: Config) -> Usually<()> { use Action::*; match self { Version => tek_show_version(), @@ -109,25 +109,32 @@ impl Action { //return Ok(()) //} // Initialize the app state - let app = tek(&jack, proj, config, ":menu"); + let app = App::new_shared(&jack, proj, config, ":menu"); //if matches!(self, Action::Headless) { //// TODO: Headless mode (daemon + client over IPC, then over network...) //println!("todo headless"); //return Ok(()) //} + let (_keyboard, _terminal) = Exit::run(|exited|tui_io( + exited.as_ref(), + &app, + Duration::from_millis(100), + Duration::from_millis(10), + std::io::stdout() + ))?; // Run the [Tui] and [Jack] threads with the [App] state. - Tui::new(Box::new(std::io::stdout()))?.run(true, &jack.run(move|jack|{ - // Between jack init and app's first cycle: - jack.sync_lead(*sync_lead, |mut state|{ - let clock = app.clock(); - clock.playhead.update_from_sample(state.position.frame() as f64); - state.position.bbt = Some(clock.bbt()); - state.position - })?; - jack.sync_follow(*sync_follow)?; - // FIXME: They don't work properly. - Ok(app) - })?)?; + //Tui::new(Box::new(std::io::stdout()))?.run(true, &jack.run(move|jack|{ + //// Between jack init and app's first cycle: + //jack.sync_lead(*sync_lead, |mut state|{ + //let clock = app.clock(); + //clock.playhead.update_from_sample(state.position.frame() as f64); + //state.position.bbt = Some(clock.bbt()); + //state.position + //})?; + //jack.sync_follow(*sync_follow)?; + //// FIXME: They don't work properly. + //Ok(app) + //})?)?; } } Ok(()) diff --git a/src/tek.rs b/src/tek.rs index 7efe2fe4..43eed2e1 100644 --- a/src/tek.rs +++ b/src/tek.rs @@ -95,11 +95,12 @@ pub fn main () -> Usually<()> { let app = App::new(&jack, project, config, ":menu"); Ok(app) })?; - let keyboard = tui_input( - exit.as_ref(), &state, Duration::from_millis(100) - )?; - let terminal = tui_output( - exit.as_ref(), &state, Duration::from_millis(10), std::io::stdout(), + let (keyboard, terminal) = tui_io( + exit.as_ref(), + &state, + Duration::from_millis(100), + Duration::from_millis(10), + std::io::stdout(), )?; Ok(()) }) diff --git a/tengri b/tengri index 53c9438f..4e6c62a7 160000 --- a/tengri +++ b/tengri @@ -1 +1 @@ -Subproject commit 53c9438f7d9990d60adc1a25cccfdd2971a07500 +Subproject commit 4e6c62a7f1edd9e173065afbb8e9cf897baa2ead