summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2014-09-18 16:35:03 -0500
committerBen Loftis <ben@harrisonconsoles.com>2014-09-18 16:35:03 -0500
commit41f13c0109316f8264788f0c11e9dd6b4d2e928c (patch)
tree981372568aa50cdf091d249026ba8c32a09aa2bc /libs/ardour
parente9ab53402c9263b21303388bc203b50b50876455 (diff)
Fix some inconsistent usage of a Controllables Interface value.
This breaks a lot of controls, because they are misusing it as well.
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/automation_control.h12
-rw-r--r--libs/ardour/plugin_insert.cc26
2 files changed, 8 insertions, 30 deletions
diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h
index aeee9dab30..3603ea2e72 100644
--- a/libs/ardour/ardour/automation_control.h
+++ b/libs/ardour/ardour/automation_control.h
@@ -78,18 +78,6 @@ public:
void set_value (double);
double get_value () const;
- virtual double internal_to_interface (double v) const {
- return v;
- }
-
- virtual double interface_to_internal (double v) const {
- return v;
- }
-
- virtual double internal_to_user (double v) const {
- return v;
- }
-
double lower() const { return parameter().min(); }
double upper() const { return parameter().max(); }
double normal() const { return parameter().normal(); }
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index 5279a36962..b98706a3d0 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -1230,24 +1230,13 @@ PluginInsert::PluginControl::set_value (double user_val)
double
PluginInsert::PluginControl::internal_to_interface (double val) const
{
+ val = Controllable::internal_to_interface(val);
+
if (_logarithmic) {
- /* some plugins have a log-scale range "0.."
- * ideally we'd map the range down to infinity somehow :)
- *
- * one solution could be to use
- * val = exp(lower + log(range) * value);
- * (log(val) - lower) / range)
- * This approach would require access to the actual range (ie
- * Plugin::ParameterDescriptor) and also require handling
- * of unbound ranges..
- *
- * currently an arbitrarly low number is assumed to represnt
- * log(0) as hot-fix solution.
- */
if (val > 0) {
- val = log (val);
+ val = pow (val, 1/1.5);
} else {
- val = -8; // ~ -70dB = 20 * log10(exp(-8))
+ val = 0;
}
}
@@ -1258,14 +1247,15 @@ double
PluginInsert::PluginControl::interface_to_internal (double val) const
{
if (_logarithmic) {
- if (val <= -8) {
- /* see note in PluginInsert::PluginControl::internal_to_interface() */
+ if (val <= 0) {
val= 0;
} else {
- val = exp (val);
+ val = pow (val, 1.5);
}
}
+ val = Controllable::interface_to_internal(val);
+
return val;
}