summaryrefslogtreecommitdiff
path: root/libs/ardour/ladspa_plugin.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-10-01 16:42:02 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-10-01 16:42:02 +0000
commitc279da57ffaabce2c435820118c4629a75fb89d8 (patch)
treea7517b113ece60c7db72cf9a3f7e1ec209a30bb8 /libs/ardour/ladspa_plugin.cc
parent57ac4cb2235e15f856716b2b38a340974398e856 (diff)
LADSPA logarithmic handling patches from nickm and robsch
git-svn-id: svn://localhost/ardour2/branches/3.0@5705 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ladspa_plugin.cc')
-rw-r--r--libs/ardour/ladspa_plugin.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index 852587896e..06a67aca08 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -178,34 +178,44 @@ LadspaPlugin::default_value (uint32_t port)
ret = prh[port].LowerBound;
bounds_given = true;
sr_scaling = true;
- earlier_hint = true;
}
/* FIXME: add support for logarithmic defaults */
else if (LADSPA_IS_HINT_DEFAULT_LOW(prh[port].HintDescriptor)) {
- ret = prh[port].LowerBound * 0.75f + prh[port].UpperBound * 0.25f;
+ if (LADSPA_IS_HINT_LOGARITHMIC(prh[port].HintDescriptor)) {
+ ret = exp(log(prh[port].LowerBound) * 0.75f + log(prh[port].UpperBound) * 0.25f);
+ }
+ else {
+ ret = prh[port].LowerBound * 0.75f + prh[port].UpperBound * 0.25f;
+ }
bounds_given = true;
sr_scaling = true;
- earlier_hint = true;
}
else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(prh[port].HintDescriptor)) {
- ret = prh[port].LowerBound * 0.50f + prh[port].UpperBound * 0.50f;
+ if (LADSPA_IS_HINT_LOGARITHMIC(prh[port].HintDescriptor)) {
+ ret = exp(log(prh[port].LowerBound) * 0.5f + log(prh[port].UpperBound) * 0.5f);
+ }
+ else {
+ ret = prh[port].LowerBound * 0.5f + prh[port].UpperBound * 0.5f;
+ }
bounds_given = true;
sr_scaling = true;
- earlier_hint = true;
}
else if (LADSPA_IS_HINT_DEFAULT_HIGH(prh[port].HintDescriptor)) {
- ret = prh[port].LowerBound * 0.25f + prh[port].UpperBound * 0.75f;
+ if (LADSPA_IS_HINT_LOGARITHMIC(prh[port].HintDescriptor)) {
+ ret = exp(log(prh[port].LowerBound) * 0.25f + log(prh[port].UpperBound) * 0.75f);
+ }
+ else {
+ ret = prh[port].LowerBound * 0.25f + prh[port].UpperBound * 0.75f;
+ }
bounds_given = true;
sr_scaling = true;
- earlier_hint = true;
}
else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(prh[port].HintDescriptor)) {
ret = prh[port].UpperBound;
bounds_given = true;
sr_scaling = true;
- earlier_hint = true;
}
else if (LADSPA_IS_HINT_DEFAULT_0(prh[port].HintDescriptor)) {
ret = 0.0f;