Fixed issue with crash when invalid get_connections request is made on invalid port...
[ardour.git] / libs / ardour / ladspa_plugin.cc
index fca37441af75ffd7c08f7aa4ebbe4d7bda6934d8..61149c78a01d61c81786aeddc9c2dede3f888560 100644 (file)
@@ -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,18 +504,6 @@ 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;
-       } else {
-               float delta = desc.upper - desc.lower;
-               desc.step = delta / 1000.0f;
-               desc.smallstep = delta / 10000.0f;
-               desc.largestep = delta/10.0f;
-       }
-
-
        if (LADSPA_IS_HINT_HAS_DEFAULT (prh.HintDescriptor)) {
                desc.normal = _default_value(which);
        } else {
@@ -534,6 +522,7 @@ 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;
 }
@@ -803,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;
@@ -841,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)