separate input handling for sampler

This commit is contained in:
🪞👃🪞 2025-04-25 20:50:32 +03:00
parent b58fbdfd30
commit b376d75396
11 changed files with 114 additions and 36 deletions

View file

@ -1,10 +1,12 @@
pub(crate) use tek::*;
pub(crate) use std::sync::{Arc, RwLock};
pub(crate) use clap::{self, Parser, Subcommand};
/// Application entrypoint.
pub fn main () -> Usually<()> {
Cli::parse().run()
}
#[derive(Debug, Parser)]
#[command(version, about = Some(HEADER), long_about = Some(HEADER))]
pub struct Cli {
@ -37,7 +39,10 @@ pub struct Cli {
/// Audio ins to connect from right output
#[arg(short='R', long)] right_to: Vec<String>,
}
#[derive(Debug, Clone, Subcommand)] pub enum Mode {
/// Application modes
#[derive(Debug, Clone, Subcommand)]
pub enum Mode {
/// ⏯️ A standalone transport clock.
Clock,
/// 🎼 A MIDI sequencer.
@ -62,6 +67,7 @@ pub struct Cli {
/// TODO: An audio plugin host
Plugin,
}
impl Cli {
pub fn run (&self) -> Usually<()> {
let name = self.name.as_ref().map_or("tek", |x|x.as_str());
@ -122,11 +128,12 @@ impl Cli {
},
color: ItemPalette::random(),
clock: Clock::new(jack, self.bpm)?,
keys: SourceIter(include_str!("./edn/arranger_keys.edn")),
keys_clip: SourceIter(include_str!("./edn/arranger_keys_clip.edn")),
keys_track: SourceIter(include_str!("./edn/arranger_keys_track.edn")),
keys_scene: SourceIter(include_str!("./edn/arranger_keys_scene.edn")),
keys_mix: SourceIter(include_str!("./edn/arranger_keys_mix.edn")),
handler: Some(match mode {
Mode::Sampler => handle_sampler,
_ => handle_arranger,
}),
tracks: match mode {
Mode::Sequencer => vec![
@ -196,6 +203,7 @@ impl Cli {
}
}
/// CLI header
const HEADER: &'static str = r#"