1
0
Fork 0

Add a standalone cli arg to connect JACK inputs

This commit is contained in:
Robbert van der Helm 2022-06-14 20:08:36 +02:00
parent f30fe0dbc2
commit c7f6aa15f8
2 changed files with 28 additions and 1 deletions

View file

@ -125,7 +125,25 @@ impl Jack {
outputs.push(port);
}
// TODO: Command line argument to connect the inputs?
// This option can either be set to a single port all inputs should be connected to, or a
// comma separated list of ports
if let Some(port_name) = config.connect_jack_inputs {
if port_name.contains(',') {
for (port_name, input) in port_name.split(',').zip(&inputs) {
if let Err(err) = client.connect_ports_by_name(port_name, &input.name()?) {
nih_error!("Could not connect to '{port_name}': {err}");
break;
}
}
} else {
for input in &inputs {
if let Err(err) = client.connect_ports_by_name(&port_name, &input.name()?) {
nih_error!("Could not connect to '{port_name}': {err}");
break;
}
}
}
}
Ok(Self {
client: Some(client),

View file

@ -28,6 +28,15 @@ pub struct WrapperConfig {
#[clap(value_parser, short = 'p', long, default_value = "512")]
pub period_size: u32,
/// If set to a port name ('foo:bar_1'), then all all inputs will be connected to that port. If
/// the option is set to a comma separated list of port names ('foo:bar_1,foo:bar_2') then the
/// input ports will be connected in that order. No inputs will be connected if the port option
/// is not set.
///
/// This option is only used with the JACK backend.
#[clap(value_parser, long)]
pub connect_jack_inputs: Option<String>,
/// The editor's DPI scaling factor.
///
/// This option is ignored on macOS.