diff options
author | Robin Gareus <robin@gareus.org> | 2014-01-06 00:01:24 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-01-06 00:01:24 +0100 |
commit | 00fbc9c3427e61d231c9fc87a7801c1bdf7e2372 (patch) | |
tree | 7a829f11809284fadef1de615fa0518647f6cf7c /libs/ardour/plugin_insert.cc | |
parent | 9dec0724385c3b39b67a9bbca9ff14acf9951ec9 (diff) |
fix plugin log-sliders for ranges [0..]
Diffstat (limited to 'libs/ardour/plugin_insert.cc')
-rw-r--r-- | libs/ardour/plugin_insert.cc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index c25f8962ac..10368bfb42 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -1212,10 +1212,23 @@ double PluginInsert::PluginControl::internal_to_interface (double val) const { 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); } else { - val = 0; + val = -8; // ~ -70dB = 20 * log10(exp(-8)) } } @@ -1226,7 +1239,12 @@ double PluginInsert::PluginControl::interface_to_internal (double val) const { if (_logarithmic) { - val = exp (val); + if (val <= -8) { + /* see note in PluginInsert::PluginControl::internal_to_interface() */ + val= 0; + } else { + val = exp (val); + } } return val; |