mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
update Justfile
This commit is contained in:
parent
88ed2c160c
commit
bcdb5f51f5
4 changed files with 70 additions and 21 deletions
|
|
@ -6,31 +6,46 @@ 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)
|
||||
/// MIDI outs to connect to MIDI input
|
||||
#[arg(short='i', long)]
|
||||
midi_from: Vec<String>,
|
||||
|
||||
/// MIDI ins to connect to (multiple accepted)
|
||||
/// MIDI ins to connect from MIDI output
|
||||
#[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>,
|
||||
/// Audio outs to connect to left input
|
||||
#[arg(short='l', long)]
|
||||
l_from: Vec<String>,
|
||||
/// Audio outs to connect to right input
|
||||
#[arg(short='r', long)]
|
||||
r_from: Vec<String>,
|
||||
/// Audio ins to connect from left output
|
||||
#[arg(short='L', long)]
|
||||
l_to: Vec<String>,
|
||||
/// Audio ins to connect from right output
|
||||
#[arg(short='R', long)]
|
||||
r_to: Vec<String>,
|
||||
}
|
||||
impl GrooveboxCli {
|
||||
fn run (&self) -> Usually<()> {
|
||||
Tui::run(JackClient::new("tek_groovebox")?
|
||||
.activate_with(|jack|tek::GrooveboxTui::try_from(jack))?)?;
|
||||
Tui::run(JackClient::new("tek_groovebox")?.activate_with(|jack|{
|
||||
let app = tek::GrooveboxTui::try_from(jack)?;
|
||||
let jack = jack.read().unwrap();
|
||||
|
||||
jack.client().connect_ports(&app.player.midi_outs[0], &app.sampler.midi_in)?;
|
||||
|
||||
connect_from(&jack, &app.player.midi_ins[0], &self.midi_from)?;
|
||||
connect_to(&jack, &app.player.midi_outs[0], &self.midi_to)?;
|
||||
|
||||
connect_audio_from(&jack, &app.sampler.audio_ins[0], &self.l_from)?;
|
||||
connect_audio_from(&jack, &app.sampler.audio_ins[1], &self.r_from)?;
|
||||
connect_audio_to(&jack, &app.sampler.audio_outs[0], &self.l_to)?;
|
||||
connect_audio_to(&jack, &app.sampler.audio_outs[1], &self.r_to)?;
|
||||
|
||||
Ok(app)
|
||||
})?)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,15 +11,12 @@ pub struct SequencerCli {
|
|||
/// 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 instances accepted)
|
||||
#[arg(short='i', long)]
|
||||
midi_from: Vec<String>,
|
||||
|
||||
/// MIDI ins to connect to (multiple instances accepted)
|
||||
#[arg(short='o', long)]
|
||||
midi_to: Vec<String>,
|
||||
|
|
@ -33,7 +30,7 @@ impl SequencerCli {
|
|||
let jack = jack.read().unwrap();
|
||||
let midi_in = jack.register_port("i", MidiIn::default())?;
|
||||
let midi_out = jack.register_port("o", MidiOut::default())?;
|
||||
connect_from(&jack, &midi_in, &self.midi_from)?;
|
||||
connect_from(&jack, &midi_in, &self.midi_from)?;
|
||||
connect_to(&jack, &midi_out, &self.midi_to)?;
|
||||
app.player.midi_ins.push(midi_in);
|
||||
app.player.midi_outs.push(midi_out);
|
||||
|
|
|
|||
|
|
@ -25,3 +25,27 @@ fn connect_to (jack: &JackClient, output: &Port<MidiOut>, ports: &[String]) -> U
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn connect_audio_from (jack: &JackClient, input: &Port<AudioIn>, 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(())
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn connect_audio_to (jack: &JackClient, output: &Port<AudioOut>, 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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue