X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fladspa_plugin.cc;h=61149c78a01d61c81786aeddc9c2dede3f888560;hb=239da0efb58849e545ec44aeb839d41b8e4792cf;hp=8b089929b50c53ff021e59f64ea6b90de332d8d2;hpb=f4b5f4c72ee60b6f509e307c5bfd164108d1f30b;p=ardour.git diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index 8b089929b5..61149c78a0 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; @@ -351,7 +351,7 @@ LadspaPlugin::add_state (XMLNode* root) const { XMLNode *child; char buf[16]; - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); for (uint32_t i = 0; i < parameter_count(); ++i){ @@ -384,7 +384,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version) const char *data; uint32_t port_id; #endif - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); if (node.name() != state_node_name()) { error << _("Bad node sent to LadspaPlugin::set_state") << endmsg; @@ -434,7 +434,7 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */) const char *data; uint32_t port_id; #endif - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); if (node.name() != state_node_name()) { error << _("Bad node sent to LadspaPlugin::set_state") << endmsg; @@ -504,15 +504,14 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des desc.upper = 4; /* completely arbitrary */ } - if (LADSPA_IS_HINT_INTEGER (prh.HintDescriptor)) { - desc.step = 1.0; - desc.smallstep = 0.1; - desc.largestep = 10.0; + if (LADSPA_IS_HINT_HAS_DEFAULT (prh.HintDescriptor)) { + desc.normal = _default_value(which); } else { - float delta = desc.upper - desc.lower; - desc.step = delta / 1000.0f; - desc.smallstep = delta / 10000.0f; - desc.largestep = delta/10.0f; + /* 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); @@ -522,6 +521,9 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des desc.label = port_names()[which]; + desc.scale_points = get_scale_points(which); + desc.update_steps(); + return 0; } @@ -640,10 +642,10 @@ LadspaPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const } } -boost::shared_ptr +boost::shared_ptr LadspaPlugin::get_scale_points(uint32_t port_index) const { - boost::shared_ptr ret; + boost::shared_ptr ret; #ifdef HAVE_LRDF const uint32_t id = atol(unique_id().c_str()); lrdf_defaults* points = lrdf_get_scale_values(id, port_index); @@ -652,7 +654,7 @@ LadspaPlugin::get_scale_points(uint32_t port_index) const return ret; } - ret = boost::shared_ptr(new ScalePoints()); + ret = boost::shared_ptr(new ScalePoints()); for (uint32_t i = 0; i < points->count; ++i) { ret->insert(make_pair(points->items[i].label, @@ -790,11 +792,11 @@ LadspaPlugin::load_preset (PresetRecord r) return true; } +#ifdef HAVE_LRDF /* XXX: should be in liblrdf */ static void lrdf_remove_preset (const char* /*source*/, const char *setting_uri) { -#ifdef HAVE_LRDF lrdf_statement p; lrdf_statement *q; lrdf_statement *i; @@ -828,8 +830,8 @@ lrdf_remove_preset (const char* /*source*/, const char *setting_uri) p.predicate = NULL; p.object = NULL; lrdf_remove_matches (&p); -#endif } +#endif void LadspaPlugin::do_remove_preset (string name)