wip: refactor into api and app

This commit is contained in:
🪞👃🪞 2024-11-09 19:50:22 +01:00
parent 051c3d3663
commit 70fc3c97d1
61 changed files with 453 additions and 255 deletions

View file

@ -0,0 +1,22 @@
//! Multi-track mixer
include!("lib.rs");
use tek_core::clap::{self, Parser};
pub fn main () -> Usually<()> { MixerCli::parse().run() }
#[derive(Debug, Parser)] #[command(version, about, long_about = None)] pub struct MixerCli {
/// Name of JACK client
#[arg(short, long)] name: Option<String>,
/// Number of tracks
#[arg(short, long)] channels: Option<usize>,
}
impl MixerCli {
fn run (&self) -> Usually<()> {
Tui::run(JackClient::new("tek_mixer")?.activate_with(|jack|{
let mut mixer = Mixer::new(jack, self.name.as_ref().map(|x|x.as_str()).unwrap_or("mixer"))?;
for channel in 0..self.channels.unwrap_or(8) {
mixer.track_add(&format!("Track {}", channel + 1), 1)?;
}
Ok(mixer)
})?)?;
Ok(())
}
}