From 51351a16dc001bf9384f71cab592647991209b76 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Fri, 13 Dec 2024 00:12:36 +0100 Subject: [PATCH] prepare sampler entrypoint --- crates/tek/Cargo.toml | 8 ++++---- crates/tek/src/cli/cli_groovebox.rs | 0 crates/tek/src/cli/cli_sampler.rs | 22 ++++++++++++++++++++++ crates/tek/src/core/audio.rs | 14 +++++++------- crates/tek/src/tui/app_sampler.rs | 5 +++++ 5 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 crates/tek/src/cli/cli_groovebox.rs create mode 100644 crates/tek/src/cli/cli_sampler.rs diff --git a/crates/tek/Cargo.toml b/crates/tek/Cargo.toml index 2a39075e..77967f73 100644 --- a/crates/tek/Cargo.toml +++ b/crates/tek/Cargo.toml @@ -43,6 +43,10 @@ path = "src/cli/cli_sequencer.rs" name = "tek_transport" path = "src/cli/cli_transport.rs" +[[bin]] +name = "tek_sampler" +path = "src/cli/cli_sampler.rs" + #[[bin]] #name = "tek_mixer" #path = "src/cli_mixer.rs" @@ -51,10 +55,6 @@ path = "src/cli/cli_transport.rs" #name = "tek_track" #path = "src/cli_track.rs" -#[[bin]] -#name = "tek_sampler" -#path = "src/cli_sampler.rs" - #[[bin]] #name = "tek_plugin" #path = "src/cli_plugin.rs" diff --git a/crates/tek/src/cli/cli_groovebox.rs b/crates/tek/src/cli/cli_groovebox.rs new file mode 100644 index 00000000..e69de29b diff --git a/crates/tek/src/cli/cli_sampler.rs b/crates/tek/src/cli/cli_sampler.rs new file mode 100644 index 00000000..4b882fb9 --- /dev/null +++ b/crates/tek/src/cli/cli_sampler.rs @@ -0,0 +1,22 @@ +include!("../lib.rs"); + +pub fn main () -> Usually<()> { + SamplerCli::parse().run() +} + +#[derive(Debug, Parser)] #[command(version, about, long_about = None)] pub struct SamplerCli { + /// Name of JACK client + #[arg(short, long)] name: Option, + /// Path to plugin + #[arg(short, long)] path: Option, +} + +impl SamplerCli { + fn run (&self) -> Usually<()> { + Tui::run(JackClient::new("tek_sampler")?.activate_with(|x|{ + let sampler = SamplerTui::try_from(x)?; + Ok(sampler) + })?)?; + Ok(()) + } +} diff --git a/crates/tek/src/core/audio.rs b/crates/tek/src/core/audio.rs index 60939f6e..e9a50577 100644 --- a/crates/tek/src/core/audio.rs +++ b/crates/tek/src/core/audio.rs @@ -51,21 +51,21 @@ pub trait AudioEngine { fn thread_init (&self, _: &Client) {} - unsafe fn shutdown (&mut self, status: ClientStatus, reason: &str) {} + unsafe fn shutdown (&mut self, _status: ClientStatus, _reason: &str) {} - fn freewheel (&mut self, _: &Client, enabled: bool) {} + fn freewheel (&mut self, _: &Client, _enabled: bool) {} - fn client_registration (&mut self, _: &Client, name: &str, reg: bool) {} + fn client_registration (&mut self, _: &Client, _name: &str, _reg: bool) {} - fn port_registration (&mut self, _: &Client, id: PortId, reg: bool) {} + fn port_registration (&mut self, _: &Client, _id: PortId, _reg: bool) {} - fn ports_connected (&mut self, _: &Client, a: PortId, b: PortId, are: bool) {} + fn ports_connected (&mut self, _: &Client, _a: PortId, _b: PortId, _are: bool) {} - fn sample_rate (&mut self, _: &Client, frames: Frames) -> Control { + fn sample_rate (&mut self, _: &Client, _frames: Frames) -> Control { Control::Continue } - fn port_rename (&mut self, _: &Client, id: PortId, old: &str, new: &str) -> Control { + fn port_rename (&mut self, _: &Client, _id: PortId, _old: &str, _new: &str) -> Control { Control::Continue } diff --git a/crates/tek/src/tui/app_sampler.rs b/crates/tek/src/tui/app_sampler.rs index f733577b..92b3843d 100644 --- a/crates/tek/src/tui/app_sampler.rs +++ b/crates/tek/src/tui/app_sampler.rs @@ -93,6 +93,11 @@ impl SamplerTui { None } } +impl Audio for SamplerTui { + #[inline] fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control { + todo!() + } +} pub struct AddSampleModal { exited: bool,