mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-07-17 07:46:57 +02:00
restruct: 6e
This commit is contained in:
parent
95ba0d6feb
commit
1e9a491b0c
3 changed files with 29 additions and 21 deletions
|
|
@ -78,13 +78,13 @@ use crate::*;
|
||||||
#[cfg(feature = "cli")]
|
#[cfg(feature = "cli")]
|
||||||
impl Cli {
|
impl Cli {
|
||||||
pub fn run (&self) -> Usually<()> {
|
pub fn run (&self) -> Usually<()> {
|
||||||
self.action.run(&Config::init_new(None)?)
|
self.action.run(Config::init_new(None)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "cli")]
|
#[cfg(feature = "cli")]
|
||||||
impl Action {
|
impl Action {
|
||||||
fn run (&self, config: &Config) -> Usually<()> {
|
fn run (&self, config: Config) -> Usually<()> {
|
||||||
use Action::*;
|
use Action::*;
|
||||||
match self {
|
match self {
|
||||||
Version => tek_show_version(),
|
Version => tek_show_version(),
|
||||||
|
|
@ -109,25 +109,32 @@ impl Action {
|
||||||
//return Ok(())
|
//return Ok(())
|
||||||
//}
|
//}
|
||||||
// Initialize the app state
|
// 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) {
|
//if matches!(self, Action::Headless) {
|
||||||
//// TODO: Headless mode (daemon + client over IPC, then over network...)
|
//// TODO: Headless mode (daemon + client over IPC, then over network...)
|
||||||
//println!("todo headless");
|
//println!("todo headless");
|
||||||
//return Ok(())
|
//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.
|
// Run the [Tui] and [Jack] threads with the [App] state.
|
||||||
Tui::new(Box::new(std::io::stdout()))?.run(true, &jack.run(move|jack|{
|
//Tui::new(Box::new(std::io::stdout()))?.run(true, &jack.run(move|jack|{
|
||||||
// Between jack init and app's first cycle:
|
//// Between jack init and app's first cycle:
|
||||||
jack.sync_lead(*sync_lead, |mut state|{
|
//jack.sync_lead(*sync_lead, |mut state|{
|
||||||
let clock = app.clock();
|
//let clock = app.clock();
|
||||||
clock.playhead.update_from_sample(state.position.frame() as f64);
|
//clock.playhead.update_from_sample(state.position.frame() as f64);
|
||||||
state.position.bbt = Some(clock.bbt());
|
//state.position.bbt = Some(clock.bbt());
|
||||||
state.position
|
//state.position
|
||||||
})?;
|
//})?;
|
||||||
jack.sync_follow(*sync_follow)?;
|
//jack.sync_follow(*sync_follow)?;
|
||||||
// FIXME: They don't work properly.
|
//// FIXME: They don't work properly.
|
||||||
Ok(app)
|
//Ok(app)
|
||||||
})?)?;
|
//})?)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
11
src/tek.rs
11
src/tek.rs
|
|
@ -95,11 +95,12 @@ pub fn main () -> Usually<()> {
|
||||||
let app = App::new(&jack, project, config, ":menu");
|
let app = App::new(&jack, project, config, ":menu");
|
||||||
Ok(app)
|
Ok(app)
|
||||||
})?;
|
})?;
|
||||||
let keyboard = tui_input(
|
let (keyboard, terminal) = tui_io(
|
||||||
exit.as_ref(), &state, Duration::from_millis(100)
|
exit.as_ref(),
|
||||||
)?;
|
&state,
|
||||||
let terminal = tui_output(
|
Duration::from_millis(100),
|
||||||
exit.as_ref(), &state, Duration::from_millis(10), std::io::stdout(),
|
Duration::from_millis(10),
|
||||||
|
std::io::stdout(),
|
||||||
)?;
|
)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
|
|
||||||
2
tengri
2
tengri
|
|
@ -1 +1 @@
|
||||||
Subproject commit 53c9438f7d9990d60adc1a25cccfdd2971a07500
|
Subproject commit 4e6c62a7f1edd9e173065afbb8e9cf897baa2ead
|
||||||
Loading…
Add table
Add a link
Reference in a new issue