1
0
Fork 0

Sorta fix stock widget usage in gain_gui_egui

The parameter changed from storing its value as decibels to storing gain
at some point.
This commit is contained in:
Robbert van der Helm 2023-01-10 20:24:51 +01:00
parent 838e1bfd2d
commit 6e7ee125b6

View file

@ -117,13 +117,16 @@ impl Plugin for Gain {
ui.add( ui.add(
egui::widgets::Slider::from_get_set(-30.0..=30.0, |new_value| { egui::widgets::Slider::from_get_set(-30.0..=30.0, |new_value| {
match new_value { match new_value {
Some(new_value) => { Some(new_value_db) => {
let new_value = util::gain_to_db(new_value_db as f32);
setter.begin_set_parameter(&params.gain); setter.begin_set_parameter(&params.gain);
setter.set_parameter(&params.gain, new_value as f32); setter.set_parameter(&params.gain, new_value);
setter.end_set_parameter(&params.gain); setter.end_set_parameter(&params.gain);
new_value
new_value_db
} }
None => params.gain.value() as f64, None => util::gain_to_db(params.gain.value()) as f64,
} }
}) })
.suffix(" dB"), .suffix(" dB"),