Add auto connecting for JACK MIDI ports
This commit is contained in:
parent
5cd4bb8de0
commit
e967e04856
2 changed files with 23 additions and 1 deletions
|
@ -133,7 +133,6 @@ impl Jack {
|
||||||
outputs.push(port);
|
outputs.push(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: CLI arguments to connect the MIDI input and output ports
|
|
||||||
let midi_input = if P::MIDI_INPUT >= MidiConfig::Basic {
|
let midi_input = if P::MIDI_INPUT >= MidiConfig::Basic {
|
||||||
Some(Arc::new(client.register_port("midi_input", MidiIn)?))
|
Some(Arc::new(client.register_port("midi_input", MidiIn)?))
|
||||||
} else {
|
} else {
|
||||||
|
@ -168,6 +167,17 @@ impl Jack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let (Some(port), Some(port_name)) = (&midi_input, config.connect_jack_midi_input) {
|
||||||
|
if let Err(err) = client.connect_ports_by_name(&port_name, &port.name()?) {
|
||||||
|
nih_error!("Could not connect to '{port_name}': {err}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let (Some(port), Some(port_name)) = (&midi_output, config.connect_jack_midi_output) {
|
||||||
|
if let Err(err) = client.connect_ports_by_name(&port.borrow().name()?, &port_name) {
|
||||||
|
nih_error!("Could not connect to '{port_name}': {err}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
client: Some(client),
|
client: Some(client),
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,18 @@ pub struct WrapperConfig {
|
||||||
#[clap(value_parser, long)]
|
#[clap(value_parser, long)]
|
||||||
pub connect_jack_inputs: Option<String>,
|
pub connect_jack_inputs: Option<String>,
|
||||||
|
|
||||||
|
/// If set, then the plugin's MIDI input port will be connected to this JACK MIDI output port.
|
||||||
|
///
|
||||||
|
/// This option is only used with the JACK backend.
|
||||||
|
#[clap(value_parser, long)]
|
||||||
|
pub connect_jack_midi_input: Option<String>,
|
||||||
|
|
||||||
|
/// If set, then the plugin's MIDI output port will be connected to this JACK MIDI input port.
|
||||||
|
///
|
||||||
|
/// This option is only used with the JACK backend.
|
||||||
|
#[clap(value_parser, long)]
|
||||||
|
pub connect_jack_midi_output: Option<String>,
|
||||||
|
|
||||||
/// The editor's DPI scaling factor.
|
/// The editor's DPI scaling factor.
|
||||||
///
|
///
|
||||||
/// This option is ignored on macOS.
|
/// This option is ignored on macOS.
|
||||||
|
|
Loading…
Add table
Reference in a new issue