Restore click track connections
This commit is contained in:
parent
21f835f6b2
commit
77b09b385b
@ -14,7 +14,6 @@ impl ConnectionManager {
|
|||||||
notification_rx: broadcast::Receiver<JackNotification>,
|
notification_rx: broadcast::Receiver<JackNotification>,
|
||||||
jack_client_name: String,
|
jack_client_name: String,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
// Create a dedicated client for making connections
|
|
||||||
let (jack_client, _status) = jack::Client::new(
|
let (jack_client, _status) = jack::Client::new(
|
||||||
&format!("{}_connector", jack_client_name),
|
&format!("{}_connector", jack_client_name),
|
||||||
jack::ClientOptions::NO_START_SERVER,
|
jack::ClientOptions::NO_START_SERVER,
|
||||||
@ -42,7 +41,6 @@ impl ConnectionManager {
|
|||||||
async fn restore_connections(&self) {
|
async fn restore_connections(&self) {
|
||||||
let state = self.state_rx.borrow();
|
let state = self.state_rx.borrow();
|
||||||
|
|
||||||
// MIDI and audio inputs: connect FROM external TO our port
|
|
||||||
for external_port in &state.connections.midi_in {
|
for external_port in &state.connections.midi_in {
|
||||||
let our_port = format!("{}:midi_in", self.jack_client_name);
|
let our_port = format!("{}:midi_in", self.jack_client_name);
|
||||||
let result = self
|
let result = self
|
||||||
@ -65,7 +63,6 @@ impl ConnectionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audio output: connect FROM our port TO external
|
|
||||||
for external_port in &state.connections.audio_out {
|
for external_port in &state.connections.audio_out {
|
||||||
let our_port = format!("{}:audio_out", self.jack_client_name);
|
let our_port = format!("{}:audio_out", self.jack_client_name);
|
||||||
let result = self
|
let result = self
|
||||||
@ -76,5 +73,16 @@ impl ConnectionManager {
|
|||||||
Err(_) => log::debug!("Could not connect {} -> {}", our_port, external_port),
|
Err(_) => log::debug!("Could not connect {} -> {}", our_port, external_port),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for external_port in &state.connections.click_track_out {
|
||||||
|
let our_port = format!("{}:click_track", self.jack_client_name);
|
||||||
|
let result = self
|
||||||
|
.jack_client
|
||||||
|
.connect_ports_by_name(&our_port, external_port);
|
||||||
|
match result {
|
||||||
|
Ok(_) => log::info!("Connected {} -> {}", our_port, external_port),
|
||||||
|
Err(_) => log::debug!("Could not connect {} -> {}", our_port, external_port),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ pub struct ConnectionState {
|
|||||||
pub midi_in: Vec<String>,
|
pub midi_in: Vec<String>,
|
||||||
pub audio_in: Vec<String>,
|
pub audio_in: Vec<String>,
|
||||||
pub audio_out: Vec<String>,
|
pub audio_out: Vec<String>,
|
||||||
|
pub click_track_out: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for State {
|
impl Default for State {
|
||||||
@ -19,6 +20,7 @@ impl Default for State {
|
|||||||
midi_in: Vec::new(),
|
midi_in: Vec::new(),
|
||||||
audio_in: Vec::new(),
|
audio_in: Vec::new(),
|
||||||
audio_out: Vec::new(),
|
audio_out: Vec::new(),
|
||||||
|
click_track_out: Vec::new(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,7 @@ impl StateManager {
|
|||||||
"midi_in" => &mut connections.midi_in,
|
"midi_in" => &mut connections.midi_in,
|
||||||
"audio_in" => &mut connections.audio_in,
|
"audio_in" => &mut connections.audio_in,
|
||||||
"audio_out" => &mut connections.audio_out,
|
"audio_out" => &mut connections.audio_out,
|
||||||
|
"click_track" => &mut connections.click_track_out,
|
||||||
_ => {
|
_ => {
|
||||||
log::warn!("Unknown port: {}", our_port_name);
|
log::warn!("Unknown port: {}", our_port_name);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user