PluginInfo () { };
PluginInfo (const PluginInfo &o)
: name(o.name), n_inputs(o.n_inputs), n_outputs(o.n_outputs),
- path (o.path), index(o.index) {}
+ unique_id(o.unique_id), path (o.path), index(o.index) {}
~PluginInfo () { };
string name;
string category;
uint32_t n_outputs;
Type type;
+ long unique_id;
+
private:
friend class PluginManager;
string path;
/* this is actually defined in plugin_manager.cc */
-Plugin * find_plugin(ARDOUR::Session&, string name, PluginInfo::Type);
+Plugin * find_plugin(ARDOUR::Session&, string name, long unique_id, PluginInfo::Type);
} // namespace ARDOUR
node->add_property ("type", _plugins[0]->state_node_name());
snprintf(buf, sizeof(buf), "%s", _plugins[0]->name());
node->add_property("id", string(buf));
+ if (_plugins[0]->state_node_name() == "ladspa") {
+ char buf[32];
+ snprintf (buf, 31, "%d", _plugins[0]->get_info().unique_id);
+ node->add_property("unique-id", string(buf));
+ }
node->add_property("count", string_compose("%1", _plugins.size()));
node->add_child_nocopy (_plugins[0]->get_state());
XMLNodeIterator niter;
XMLPropertyList plist;
const XMLProperty *prop;
+ long unique = 0;
PluginInfo::Type type;
if ((prop = node.property ("type")) == 0) {
return -1;
}
+ prop = node.property ("unique-id");
+ if (prop != 0) {
+ unique = atol(prop->value().c_str());
+ }
+
if ((prop = node.property ("id")) == 0) {
error << _("XML node describing insert is missing the `id' field") << endmsg;
return -1;
Plugin* plugin;
- if ((plugin = find_plugin (_session, prop->value(), type)) == 0) {
+ if (unique != 0) {
+ plugin = find_plugin (_session, "", unique, type);
+ } else {
+ plugin = find_plugin (_session, prop->value(), 0, type);
+ }
+
+ if (plugin == 0) {
error << string_compose(_("Found a reference to a plugin (\"%1\") that is unknown.\n"
"Perhaps it was removed or moved since it was last used."), prop->value())
<< endmsg;
info->n_inputs = 0;
info->n_outputs = 0;
info->type = PluginInfo::LADSPA;
+ info->unique_id = descriptor->UniqueID;
for (uint32_t n=0; n < descriptor->PortCount; ++n) {
if ( LADSPA_IS_PORT_AUDIO (descriptor->PortDescriptors[n]) ) {
}
Plugin *
-ARDOUR::find_plugin(Session& session, string name, PluginInfo::Type type)
+ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::Type type)
{
PluginManager *mgr = PluginManager::the_manager();
list<PluginInfo *>::iterator i;
break;
case PluginInfo::VST:
plugs = &mgr->vst_plugin_info();
+ unique_id = 0; // VST plugins don't have a unique id.
break;
}
for (i = plugs->begin(); i != plugs->end(); ++i) {
- if ((*i)->name == name) {
+ if ((name == "" || (*i)->name == name) &&
+ (unique_id == 0 || (*i)->unique_id == unique_id)) {
return mgr->load (session, *i);
}
}