mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
whatever the fuck is up with the groovebox mode
This commit is contained in:
parent
fa9f7f8aaf
commit
71f4194cdf
3 changed files with 58 additions and 37 deletions
|
|
@ -2,19 +2,40 @@ include!("./lib.rs");
|
|||
pub fn main () -> Usually<()> { GrooveboxCli::parse().run() }
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(version, about, long_about = None)]
|
||||
pub struct GrooveboxCli;
|
||||
pub struct GrooveboxCli {
|
||||
/// Name of JACK client
|
||||
#[arg(short, long)]
|
||||
name: Option<String>,
|
||||
|
||||
/// Whether to include a transport toolbar (default: true)
|
||||
#[arg(short, long, default_value_t = true)]
|
||||
transport: bool,
|
||||
|
||||
/// MIDI outs to connect to (multiple accepted)
|
||||
#[arg(short='i', long)]
|
||||
midi_from: Vec<String>,
|
||||
|
||||
/// MIDI ins to connect to (multiple accepted)
|
||||
#[arg(short='o', long)]
|
||||
midi_to: Vec<String>,
|
||||
|
||||
/// Audio ins to connect to (multiple accepted)
|
||||
#[arg(short='I', long)]
|
||||
audio_from: Vec<String>,
|
||||
|
||||
/// Audio outs to connect to (multiple accepted)
|
||||
#[arg(short='O', long)]
|
||||
audio_to: Vec<String>,
|
||||
}
|
||||
impl GrooveboxCli {
|
||||
fn run (&self) -> Usually<()> {
|
||||
Tui::run(JackClient::new("tek_groovebox")?.activate_with(|jack|{
|
||||
let app = tek::tui::GrooveboxTui::try_from(jack)?;
|
||||
let jack = jack.read().unwrap();
|
||||
let _midi_out = jack.register_port("out", MidiOut::default())?;
|
||||
let _midi_in_1 = jack.register_port("in1", MidiIn::default())?;
|
||||
let _midi_in_2 = jack.register_port("in2", MidiIn::default())?;
|
||||
let _audio_in_1 = jack.register_port("inL", AudioIn::default())?;
|
||||
let _audio_in_2 = jack.register_port("inR", AudioIn::default())?;
|
||||
let _audio_out_1 = jack.register_port("out1", AudioOut::default())?;
|
||||
let _audio_out_2 = jack.register_port("out2", AudioOut::default())?;
|
||||
let mut app = tek::tui::GrooveboxTui::try_from(jack)?;
|
||||
let jack = jack.read().unwrap();
|
||||
let midi_in = jack.register_port("i", MidiIn::default())?;
|
||||
let midi_out = jack.register_port("o", MidiOut::default())?;
|
||||
app.sequencer.player.midi_ins.push(midi_in);
|
||||
app.sequencer.player.midi_outs.push(midi_out);
|
||||
Ok(app)
|
||||
})?)?;
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -42,30 +42,3 @@ impl SequencerCli {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_from (jack: &JackClient, input: &Port<MidiIn>, ports: &[String]) -> Usually<()> {
|
||||
for port in ports.iter() {
|
||||
if let Some(port) = jack.port_by_name(port).as_ref() {
|
||||
jack.client().connect_ports(port, input)?;
|
||||
} else {
|
||||
panic!("Missing MIDI output: {port}. Use jack_lsp to list all port names.");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn connect_to (jack: &JackClient, output: &Port<MidiOut>, ports: &[String]) -> Usually<()> {
|
||||
for port in ports.iter() {
|
||||
if let Some(port) = jack.port_by_name(port).as_ref() {
|
||||
jack.client().connect_ports(output, port)?;
|
||||
} else {
|
||||
panic!("Missing MIDI input: {port}. Use jack_lsp to list all port names.");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test] fn verify_sequencer_cli () {
|
||||
use clap::CommandFactory;
|
||||
SequencerCli::command().debug_assert();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,30 @@
|
|||
#[allow(unused_imports)] use std::sync::Arc;
|
||||
#[allow(unused_imports)] use clap::{self, Parser};
|
||||
#[allow(unused_imports)] use tek::{*, jack::*};
|
||||
|
||||
fn connect_from (jack: &JackClient, input: &Port<MidiIn>, ports: &[String]) -> Usually<()> {
|
||||
for port in ports.iter() {
|
||||
if let Some(port) = jack.port_by_name(port).as_ref() {
|
||||
jack.client().connect_ports(port, input)?;
|
||||
} else {
|
||||
panic!("Missing MIDI output: {port}. Use jack_lsp to list all port names.");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn connect_to (jack: &JackClient, output: &Port<MidiOut>, ports: &[String]) -> Usually<()> {
|
||||
for port in ports.iter() {
|
||||
if let Some(port) = jack.port_by_name(port).as_ref() {
|
||||
jack.client().connect_ports(output, port)?;
|
||||
} else {
|
||||
panic!("Missing MIDI input: {port}. Use jack_lsp to list all port names.");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test] fn verify_sequencer_cli () {
|
||||
use clap::CommandFactory;
|
||||
SequencerCli::command().debug_assert();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue