This commit is contained in:
@@ -10,8 +10,7 @@ use std::{
|
||||
use crate::{
|
||||
common::errors::DSPError,
|
||||
dsp408::{
|
||||
default::default_input_meters,
|
||||
default::default_output_meters,
|
||||
default::{default_input_meters, default_output_meters},
|
||||
default_dsp_state,
|
||||
mapper::{
|
||||
self,
|
||||
@@ -19,7 +18,7 @@ use crate::{
|
||||
response::map_response,
|
||||
},
|
||||
protocol::{commands, config::decode_config, frame::extract_frame},
|
||||
types::{self},
|
||||
types::self,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1514,9 +1513,6 @@ impl DSP408 {
|
||||
if !self.request_acknowledgement()? {
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
let config = self.read_config_state()?;
|
||||
self.state_mut().current_config = config;
|
||||
}
|
||||
|
||||
types::DSPMode::Demo => {
|
||||
@@ -1528,6 +1524,54 @@ impl DSP408 {
|
||||
}
|
||||
}
|
||||
|
||||
let state = self.state_mut();
|
||||
|
||||
match source {
|
||||
types::Channel::Input(s) => {
|
||||
let input_destinations: Vec<types::InputChannel> = destinations
|
||||
.iter()
|
||||
.filter_map(|destination| match destination {
|
||||
types::Channel::Input(input) => Some(*input),
|
||||
types::Channel::Output(_) => None,
|
||||
})
|
||||
.collect();
|
||||
|
||||
let states = &mut state.current_config.input_states;
|
||||
|
||||
// Remove the source and destinations from all existing links.
|
||||
for channel_state in states.values_mut() {
|
||||
channel_state
|
||||
.linked_channels
|
||||
.retain(|channel| *channel != s && !input_destinations.contains(channel));
|
||||
}
|
||||
|
||||
// Link source -> destinations.
|
||||
states.get_mut(&s).unwrap().linked_channels = input_destinations;
|
||||
}
|
||||
|
||||
types::Channel::Output(s) => {
|
||||
let output_destinations: Vec<types::OutputChannel> = destinations
|
||||
.iter()
|
||||
.filter_map(|destination| match destination {
|
||||
types::Channel::Output(output) => Some(*output),
|
||||
types::Channel::Input(_) => None,
|
||||
})
|
||||
.collect();
|
||||
|
||||
let states = &mut state.current_config.output_states;
|
||||
|
||||
// Remove the source and destinations from all existing links.
|
||||
for channel_state in states.values_mut() {
|
||||
channel_state
|
||||
.linked_channels
|
||||
.retain(|channel| *channel != s && !output_destinations.contains(channel));
|
||||
}
|
||||
|
||||
// Link source -> destinations.
|
||||
states.get_mut(&s).unwrap().linked_channels = output_destinations;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
|
||||
+33
-5
@@ -75,16 +75,44 @@ fn default_config() -> DSPConfigState {
|
||||
|
||||
fn default_input_states() -> HashMap<InputChannel, InputChannelState> {
|
||||
[
|
||||
(InputChannel::InA, default_input_channel_state("In A")),
|
||||
(InputChannel::InB, default_input_channel_state("In B")),
|
||||
(InputChannel::InC, default_input_channel_state("In C")),
|
||||
(InputChannel::InD, default_input_channel_state("In D")),
|
||||
(
|
||||
InputChannel::InA,
|
||||
default_input_channel_state("In A", false),
|
||||
),
|
||||
(InputChannel::InB, default_input_channel_state("In B", true)),
|
||||
(
|
||||
InputChannel::InC,
|
||||
default_input_channel_state("In C", false),
|
||||
),
|
||||
(
|
||||
InputChannel::InD,
|
||||
default_input_channel_state("In D", false),
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn default_input_channel_state(name: &str) -> InputChannelState {
|
||||
fn default_input_channel_state(name: &str, a: bool) -> InputChannelState {
|
||||
if a {
|
||||
return InputChannelState {
|
||||
name: name.to_string(),
|
||||
|
||||
gain: 0.0,
|
||||
phase_inverted: false,
|
||||
delay: 0.0,
|
||||
|
||||
gate: default_gate(),
|
||||
geq: default_graphic_eq(),
|
||||
peq_chain: default_peq_chain(),
|
||||
crossover: default_crossover_filters(),
|
||||
|
||||
linked_channels: vec![InputChannel::InA],
|
||||
// linked_channels: Vec::new(),
|
||||
mute: false,
|
||||
};
|
||||
}
|
||||
|
||||
InputChannelState {
|
||||
name: name.to_string(),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user