diff options
author | Robin Gareus <robin@gareus.org> | 2017-06-19 00:57:53 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-06-21 18:12:04 +0200 |
commit | 567c0a8f5321f70f13e8e0c4c78725ce4521608b (patch) | |
tree | 343c5178af230a8ca1ec7644500ffc17344cd3c5 /libs/ardour | |
parent | e91b80eb85452586f226f4b7eb84d8be36ea1a3c (diff) |
Switch to PBD control-math and prefer Controllable API
Note: Control-surfaces should always use interface_to_internal()
and internal_to_interface().
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/gain_control.cc | 4 | ||||
-rw-r--r-- | libs/ardour/parameter_descriptor.cc | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/libs/ardour/gain_control.cc b/libs/ardour/gain_control.cc index 7b0f4e404c..35f666bdf1 100644 --- a/libs/ardour/gain_control.cc +++ b/libs/ardour/gain_control.cc @@ -50,7 +50,7 @@ double GainControl::internal_to_interface (double v) const { if (_desc.type == GainAutomation) { - return gain_to_slider_position (v); + return gain_to_slider_position_with_max (v, _desc.upper); } else { return (accurate_coefficient_to_dB (v) - lower_db) / range_db; } @@ -60,7 +60,7 @@ double GainControl::interface_to_internal (double v) const { if (_desc.type == GainAutomation) { - return slider_position_to_gain (v); + return slider_position_to_gain_with_max (v, _desc.upper); } else { return dB_to_coefficient (lower_db + v * range_db); } diff --git a/libs/ardour/parameter_descriptor.cc b/libs/ardour/parameter_descriptor.cc index 16c618dec6..f6460a514e 100644 --- a/libs/ardour/parameter_descriptor.cc +++ b/libs/ardour/parameter_descriptor.cc @@ -19,6 +19,8 @@ #include <boost/algorithm/string.hpp> +#include "pbd/control_math.h" + #include "ardour/amp.h" #include "ardour/dB.h" #include "ardour/parameter_descriptor.h" @@ -157,8 +159,8 @@ ParameterDescriptor::update_steps() /* dB_coeff_step gives a step normalized for [0, max_gain]. This is like "slider position", so we convert from "slider position" to gain to have the correct unit here. */ - largestep = slider_position_to_gain(dB_coeff_step(upper)); - step = slider_position_to_gain(largestep / 10.0); + largestep = position_to_gain (dB_coeff_step(upper)); + step = position_to_gain (largestep / 10.0); smallstep = step; } else { /* note that LV2Plugin::get_parameter_descriptor () |