mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-07-17 15:56: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")]
|
||||
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(())
|
||||
|
|
|
|||
11
src/tek.rs
11
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(())
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue