mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
finish applying port autoconnect refactor, move entry point to top level, update usage
This commit is contained in:
parent
fe70b57dc1
commit
c3de403645
9 changed files with 126 additions and 102 deletions
25
.old/todo_cli_mixer.rs
Normal file
25
.old/todo_cli_mixer.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
include!("./lib.rs");
|
||||
|
||||
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(JackConnection::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(())
|
||||
}
|
||||
}
|
||||
26
.old/todo_cli_plugin.rs
Normal file
26
.old/todo_cli_plugin.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
include!("./lib.rs");
|
||||
|
||||
pub fn main () -> Usually<()> {
|
||||
PluginCli::parse().run()
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)] #[command(version, about, long_about = None)] pub struct PluginCli {
|
||||
/// Name of JACK client
|
||||
#[arg(short, long)] name: Option<String>,
|
||||
/// Path to plugin
|
||||
#[arg(short, long)] path: Option<String>,
|
||||
}
|
||||
|
||||
impl PluginCli {
|
||||
fn run (&self) -> Usually<()> {
|
||||
Tui::run(JackConnection::new("tek_plugin")?.activate_with(|jack|{
|
||||
let mut plugin = Plugin::new_lv2(
|
||||
jack,
|
||||
self.name.as_ref().map(|x|x.as_str()).unwrap_or("mixer"),
|
||||
self.path.as_ref().expect("pass --path /to/lv2/plugin.so")
|
||||
)?;
|
||||
Ok(plugin)
|
||||
})?)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
26
.old/todo_cli_sampler.rs
Normal file
26
.old/todo_cli_sampler.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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<String>,
|
||||
/// Path to plugin
|
||||
#[arg(short, long)] path: Option<String>,
|
||||
}
|
||||
|
||||
impl SamplerCli {
|
||||
fn run (&self) -> Usually<()> {
|
||||
Tui::run(JackConnection::new("tek_sampler")?.activate_with(|jack|{
|
||||
let mut plugin = Sampler::new(
|
||||
jack,
|
||||
self.name.as_ref().map(|x|x.as_str()).unwrap_or("mixer"),
|
||||
None,
|
||||
)?;
|
||||
Ok(plugin)
|
||||
})?)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue