feat: default meters + update state on link
CI / Rust CI (push) Failing after 47s

This commit is contained in:
2026-09-20 21:39:47 +02:00
parent a98be2f8e3
commit 3cf7c279a8
2 changed files with 83 additions and 11 deletions
+50 -6
View File
@@ -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)
}