mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
Piano+LibDSP: Move Track to LibDSP
This is a tangly commit and it fixes all the bugs that a plain move would have caused (i.e. we need to touch other logic which had wrong assumptions).
This commit is contained in:
parent
125122a9ab
commit
4941cffdd0
29 changed files with 322 additions and 413 deletions
|
@ -30,13 +30,16 @@ ProcessorParameterSlider::ProcessorParameterSlider(Orientation orientation, DSP:
|
|||
m_value_label->set_text(String::formatted("{:.2f}", static_cast<double>(m_parameter)));
|
||||
|
||||
on_change = [this](auto value) {
|
||||
if (m_currently_setting_from_ui)
|
||||
return;
|
||||
m_currently_setting_from_ui = true;
|
||||
DSP::ParameterFixedPoint real_value;
|
||||
real_value.raw() = value;
|
||||
if (is_logarithmic())
|
||||
// FIXME: Implement exponential for fixed point
|
||||
real_value = exp(static_cast<double>(real_value));
|
||||
real_value = exp2(static_cast<double>(real_value));
|
||||
|
||||
m_parameter.set_value_sneaky(real_value, DSP::Detail::ProcessorParameterSetValueTag {});
|
||||
m_parameter.set_value(real_value);
|
||||
if (m_value_label) {
|
||||
double value = static_cast<double>(m_parameter);
|
||||
String label_text = String::formatted("{:.2f}", value);
|
||||
|
@ -47,11 +50,12 @@ ProcessorParameterSlider::ProcessorParameterSlider(Orientation orientation, DSP:
|
|||
else
|
||||
m_value_label->set_text(label_text);
|
||||
}
|
||||
m_currently_setting_from_ui = false;
|
||||
};
|
||||
m_parameter.did_change_value = [this](auto value) {
|
||||
m_parameter.register_change_listener([this](auto value) {
|
||||
if (!is_logarithmic())
|
||||
set_value(value.raw());
|
||||
else
|
||||
set_value(value.log2().raw());
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue