restruct: 6e

This commit is contained in:
i do not exist 2026-06-29 20:38:23 +03:00
parent 95ba0d6feb
commit 1e9a491b0c
3 changed files with 29 additions and 21 deletions

View file

@ -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(())

View file

@ -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(())
})

2
tengri

@ -1 +1 @@
Subproject commit 53c9438f7d9990d60adc1a25cccfdd2971a07500
Subproject commit 4e6c62a7f1edd9e173065afbb8e9cf897baa2ead