fix: round trip value before putting in state so hardware and software stay in sync
CI / Rust CI (push) Successful in 45s
CI / Rust CI (push) Successful in 45s
This commit is contained in:
+41
-32
@@ -604,8 +604,9 @@ impl DSP408 {
|
|||||||
|
|
||||||
// Shared authoritative state update.
|
// Shared authoritative state update.
|
||||||
let current_index = self.state().presets.current_index;
|
let current_index = self.state().presets.current_index;
|
||||||
|
let name = mapper::raw_to_preset_name(&raw_name)?;
|
||||||
|
|
||||||
self.state_mut().presets.names[current_index - 1] = name.to_string();
|
self.state_mut().presets.names[current_index - 1] = name;
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
@@ -892,11 +893,11 @@ impl DSP408 {
|
|||||||
.current_config
|
.current_config
|
||||||
.output_state_mut(channel)
|
.output_state_mut(channel)
|
||||||
.compressor = types::Compressor {
|
.compressor = types::Compressor {
|
||||||
threshold,
|
threshold: mapper::raw_to_threshold_db(raw_threshold)?,
|
||||||
ratio,
|
ratio: mapper::raw_to_ratio(raw_ratio)?,
|
||||||
attack,
|
attack: mapper::raw_to_attack_ms(raw_attack)?,
|
||||||
release,
|
release: mapper::raw_to_release_ms(raw_release)?,
|
||||||
knee,
|
knee: mapper::raw_to_knee_db(raw_knee)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
@@ -953,8 +954,8 @@ impl DSP408 {
|
|||||||
.input_state_mut(input)
|
.input_state_mut(input)
|
||||||
.crossover
|
.crossover
|
||||||
.low_pass = types::Crossover {
|
.low_pass = types::Crossover {
|
||||||
frequency: freq,
|
frequency: mapper::raw_to_frequency_hz(raw_freq)?,
|
||||||
slope: filter_type,
|
slope: mapper::raw_to_crossover_filter(raw_filter)?,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -964,8 +965,8 @@ impl DSP408 {
|
|||||||
.output_state_mut(output)
|
.output_state_mut(output)
|
||||||
.crossover
|
.crossover
|
||||||
.low_pass = types::Crossover {
|
.low_pass = types::Crossover {
|
||||||
frequency: freq,
|
frequency: mapper::raw_to_frequency_hz(raw_freq)?,
|
||||||
slope: filter_type,
|
slope: mapper::raw_to_crossover_filter(raw_filter)?,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1024,8 +1025,8 @@ impl DSP408 {
|
|||||||
.input_state_mut(input)
|
.input_state_mut(input)
|
||||||
.crossover
|
.crossover
|
||||||
.high_pass = types::Crossover {
|
.high_pass = types::Crossover {
|
||||||
frequency: freq,
|
frequency: mapper::raw_to_frequency_hz(raw_freq)?,
|
||||||
slope: filter_type,
|
slope: mapper::raw_to_crossover_filter(raw_filter)?,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1035,8 +1036,8 @@ impl DSP408 {
|
|||||||
.output_state_mut(output)
|
.output_state_mut(output)
|
||||||
.crossover
|
.crossover
|
||||||
.high_pass = types::Crossover {
|
.high_pass = types::Crossover {
|
||||||
frequency: freq,
|
frequency: mapper::raw_to_frequency_hz(raw_freq)?,
|
||||||
slope: filter_type,
|
slope: mapper::raw_to_crossover_filter(raw_filter)?,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1106,10 +1107,10 @@ impl DSP408 {
|
|||||||
let state = self.state_mut();
|
let state = self.state_mut();
|
||||||
|
|
||||||
let peq = types::PEQ {
|
let peq = types::PEQ {
|
||||||
gain: gain_db,
|
gain: mapper::raw_to_eq_gain(raw_gain)?,
|
||||||
frequency: freq_hz,
|
frequency: mapper::raw_to_frequency_hz(raw_frequency)?,
|
||||||
q,
|
q: mapper::raw_to_peq_q(raw_q)?,
|
||||||
filter_type,
|
filter_type: mapper::raw_to_peq_filter(raw_filter)?,
|
||||||
bypass,
|
bypass,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1176,11 +1177,11 @@ impl DSP408 {
|
|||||||
|
|
||||||
match channel {
|
match channel {
|
||||||
types::Channel::Input(input) => {
|
types::Channel::Input(input) => {
|
||||||
state.current_config.input_state_mut(input).gain = db;
|
state.current_config.input_state_mut(input).gain = mapper::raw_to_gain(raw_db)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
types::Channel::Output(output) => {
|
types::Channel::Output(output) => {
|
||||||
state.current_config.output_state_mut(output).gain = db;
|
state.current_config.output_state_mut(output).gain = mapper::raw_to_gain(raw_db)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1384,7 +1385,10 @@ impl DSP408 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.state_mut().current_config.input_source = input_source;
|
self.state_mut().current_config.input_source = types::InputSource {
|
||||||
|
r#type: mapper::raw_to_input_source(raw_source)?,
|
||||||
|
frequency: mapper::raw_to_frequency_value(raw_frequency)?,
|
||||||
|
};
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
@@ -1677,11 +1681,13 @@ impl DSP408 {
|
|||||||
|
|
||||||
match channel {
|
match channel {
|
||||||
types::Channel::Input(input) => {
|
types::Channel::Input(input) => {
|
||||||
state.current_config.input_state_mut(input).name = name.to_string();
|
state.current_config.input_state_mut(input).name =
|
||||||
|
mapper::raw_to_channel_name(&raw_name)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
types::Channel::Output(output) => {
|
types::Channel::Output(output) => {
|
||||||
state.current_config.output_state_mut(output).name = name.to_string();
|
state.current_config.output_state_mut(output).name =
|
||||||
|
mapper::raw_to_channel_name(&raw_name)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1744,10 +1750,10 @@ impl DSP408 {
|
|||||||
.current_config
|
.current_config
|
||||||
.input_state_mut(channel)
|
.input_state_mut(channel)
|
||||||
.gate = types::Gate {
|
.gate = types::Gate {
|
||||||
attack,
|
attack: mapper::raw_to_attack_ms(raw_attack)?,
|
||||||
release,
|
release: mapper::raw_to_release_ms(raw_release)?,
|
||||||
hold,
|
hold: mapper::raw_to_hold_ms(raw_hold)?,
|
||||||
threshold,
|
threshold: mapper::raw_to_gate_threshold_db(raw_threshold)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
@@ -1806,9 +1812,9 @@ impl DSP408 {
|
|||||||
.current_config
|
.current_config
|
||||||
.output_state_mut(channel)
|
.output_state_mut(channel)
|
||||||
.limiter = types::Limiter {
|
.limiter = types::Limiter {
|
||||||
threshold,
|
threshold: mapper::raw_to_threshold_db(raw_threshold)?,
|
||||||
attack,
|
attack: mapper::raw_to_attack_ms(raw_attack)?,
|
||||||
release,
|
release: mapper::raw_to_release_ms(raw_release)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
@@ -1895,7 +1901,7 @@ impl DSP408 {
|
|||||||
.output_state_mut(output_channel)
|
.output_state_mut(output_channel)
|
||||||
.matrix_routes
|
.matrix_routes
|
||||||
.gains
|
.gains
|
||||||
.insert(input_channel, gain);
|
.insert(input_channel, mapper::raw_to_matrix_gain(raw_gain)?);
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
@@ -1948,7 +1954,10 @@ impl DSP408 {
|
|||||||
.input_state_mut(input_channel)
|
.input_state_mut(input_channel)
|
||||||
.geq
|
.geq
|
||||||
.gains
|
.gains
|
||||||
.insert(frequency_band, gain);
|
.insert(
|
||||||
|
mapper::raw_to_frequency_value(raw_frequency_band)?,
|
||||||
|
mapper::raw_to_eq_gain(raw_gain)?,
|
||||||
|
);
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user