commits 6001-6525 inclusive from 2.X applied to 3.0
[ardour.git] / libs / ardour / lv2_plugin.cc
index 6c593a869aa8ed741a026a1478f3dbe51fae2d10..9ba453345616b62275222654f2b93ed03efad9bf 100644 (file)
@@ -181,8 +181,6 @@ LV2Plugin::~LV2Plugin ()
        deactivate ();
        cleanup ();
 
-       drop_references ();
-
        slv2_instance_free(_instance);
        slv2_value_free(_name);
        slv2_value_free(_author);
@@ -238,8 +236,8 @@ LV2Plugin::set_parameter (uint32_t which, float val)
 
        } else {
                warning << string_compose (_("Illegal parameter number used with plugin \"%1\"."
-                               "This is a bug in either Ardour or the LV2 plugin (%2)"),
-                               name(), unique_id()) << endmsg;
+                                             "This is a bug in either %2 or the LV2 plugin (%3)"),
+                                           name(), PROGRAM_NAME, unique_id()) << endmsg;
        }
 }
 
@@ -321,7 +319,7 @@ LV2Plugin::get_presets()
 }
 
 bool
-LV2Plugin::load_preset(const string uri)
+LV2Plugin::load_preset(const string& uri)
 {
        const string query = string(
                        "PREFIX lv2p: <http://lv2plug.in/ns/dev/presets#>\n"
@@ -354,7 +352,7 @@ LV2Plugin::has_editor() const
 }
 
 int
-LV2Plugin::set_state(const XMLNode& node, int /*version*/)
+LV2Plugin::set_state(const XMLNode& node, int version)
 {
        XMLNodeList nodes;
        XMLProperty *prop;
@@ -370,8 +368,12 @@ LV2Plugin::set_state(const XMLNode& node, int /*version*/)
                return -1;
        }
 
-       nodes = node.children ("Port");
-
+       if (version < 3000){
+               nodes = node.children ("port");
+       } else {
+               nodes = node.children ("Port");
+       }
+       
        for (iter = nodes.begin(); iter != nodes.end(); ++iter){
 
                child = *iter;
@@ -384,6 +386,7 @@ LV2Plugin::set_state(const XMLNode& node, int /*version*/)
                }
 
                map<string,uint32_t>::iterator i = _port_indices.find(sym);
+               
                if (i != _port_indices.end()) {
                        port_id = i->second;
                } else {
@@ -677,6 +680,7 @@ LV2PluginInfo::LV2PluginInfo (void* lv2_world, void* slv2_plugin)
        : _lv2_world(lv2_world)
        , _slv2_plugin(slv2_plugin)
 {
+        type = ARDOUR::LV2;
 }
 
 LV2PluginInfo::~LV2PluginInfo()
@@ -724,6 +728,8 @@ LV2PluginInfo::discover (void* lv2_world)
                        continue;
                }
 
+               info->type = LV2;
+
                info->name = string(slv2_value_as_string(name));
                slv2_value_free(name);