mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-04-03 21:00:44 +02:00
parent
54f0a95f3a
commit
0577309b19
4 changed files with 92 additions and 69 deletions
28
app/tek.rs
28
app/tek.rs
|
|
@ -20,6 +20,12 @@ pub(crate) use ::midly::{Smf, TrackEventKind, MidiMessage, Error as MidiError, n
|
|||
pub extern crate tengri;
|
||||
pub(crate) use tengri::{
|
||||
*,
|
||||
lang::*,
|
||||
play::*,
|
||||
sing::*,
|
||||
time::*,
|
||||
draw::*,
|
||||
tui::*,
|
||||
crossterm::event::{Event, KeyEvent},
|
||||
ratatui::{
|
||||
self,
|
||||
|
|
@ -62,8 +68,26 @@ pub(crate) use ConnectStatus::*;
|
|||
|
||||
/// Command-line entrypoint.
|
||||
#[cfg(feature = "cli")] pub fn main () -> Usually<()> {
|
||||
use clap::Parser;
|
||||
Cli::parse().run()
|
||||
Config::watch(|config|{
|
||||
Exit::enter(|exit|{
|
||||
Jack::connect("tek", |jack|{
|
||||
let state = Arc::new(RwLock::new(App {
|
||||
color: ItemTheme::random(),
|
||||
config: Config::init(),
|
||||
dialog: Dialog::welcome(),
|
||||
jack: jack.clone(),
|
||||
mode: ":menu",
|
||||
project: Arrangement::new(&jack, &Clock::new(&jack, 51)),
|
||||
..Default::default()
|
||||
}));
|
||||
// TODO: Sync these timings with main clock, so that things
|
||||
// "accidentally" fall on the beat in overload conditions.
|
||||
let keyboard = run_tui_in(&exit, &state, Duration::from_millis(100))?;
|
||||
let terminal = run_tui_out(&exit, &state, Duration::from_millis(10))?;
|
||||
(keyboard, terminal)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// Create a new application from a backend, project, config, and mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue