diff options
author | Robin Gareus <robin@gareus.org> | 2014-11-29 22:57:46 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-11-30 15:05:39 +0100 |
commit | bd85c8ec43b540ca5b98e61dee0c20f295be5b56 (patch) | |
tree | b23973bf65d40ae6e2286396662205972ae0ba16 /libs/ardour/ladspa_plugin.cc | |
parent | cf859270e04979f83e824498a162f858172af891 (diff) |
fix ladpsa default value.
because get_parameter_descriptor() is const, also wrap
default_value() in a const function.
Diffstat (limited to 'libs/ardour/ladspa_plugin.cc')
-rw-r--r-- | libs/ardour/ladspa_plugin.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index 4866516b1a..fca37441af 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -145,7 +145,7 @@ LadspaPlugin::init (string module_path, uint32_t index, framecnt_t rate) continue; } - _shadow_data[i] = default_value (i); + _shadow_data[i] = _default_value (i); } } @@ -173,7 +173,7 @@ LadspaPlugin::unique_id() const } float -LadspaPlugin::default_value (uint32_t port) +LadspaPlugin::_default_value (uint32_t port) const { const LADSPA_PortRangeHint *prh = port_range_hints(); float ret = 0.0f; @@ -515,6 +515,17 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des desc.largestep = delta/10.0f; } + + if (LADSPA_IS_HINT_HAS_DEFAULT (prh.HintDescriptor)) { + desc.normal = _default_value(which); + } else { + /* if there is no explicit hint for the default + * value, use lower bound. This is not great but + * better than just assuming '0' which may be out-of range. + */ + desc.normal = desc.lower; + } + desc.toggled = LADSPA_IS_HINT_TOGGLED (prh.HintDescriptor); desc.logarithmic = LADSPA_IS_HINT_LOGARITHMIC (prh.HintDescriptor); desc.sr_dependent = LADSPA_IS_HINT_SAMPLE_RATE (prh.HintDescriptor); |