fix naming of destructive track audio files
[ardour.git] / libs / ardour / plugin_manager.cc
index e214e56ebc8068ff4e22645d6286c52281b2671b..e1f34199d6a42a2a6420a2c1b4dc472a45a2b69a 100644 (file)
@@ -183,14 +183,14 @@ PluginManager::add_presets(string domain)
                return;
        }
 
-       string path = compose("%1/.%2/rdf", envvar, domain);
+       string path = string_compose("%1/.%2/rdf", envvar, domain);
        presets = scanner (path, rdf_filter, 0, true, true);
 
        if (presets) {
                for (x = presets->begin(); x != presets->end (); ++x) {
                        string file = "file:" + **x;
                        if (lrdf_read_file(file.c_str())) {
-                               warning << compose(_("Could not parse rdf file: %1"), *x) << endmsg;
+                               warning << string_compose(_("Could not parse rdf file: %1"), *x) << endmsg;
                        }
                }
        }
@@ -198,7 +198,6 @@ PluginManager::add_presets(string domain)
        vector_delete (presets);
 }
 
-
 void
 PluginManager::add_lrdf_data (const string &path)
 {
@@ -232,14 +231,14 @@ PluginManager::ladspa_discover (string path)
        const char *errstr;
 
        if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) {
-               error << compose(_("LADSPA: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg;
+               error << string_compose(_("LADSPA: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg;
                return -1;
        }
 
        dfunc = (LADSPA_Descriptor_Function) dlsym (module, "ladspa_descriptor");
 
        if ((errstr = dlerror()) != 0) {
-               error << compose(_("LADSPA: module \"%1\" has no descriptor function."), path) << endmsg;
+               error << string_compose(_("LADSPA: module \"%1\" has no descriptor function."), path) << endmsg;
                error << errstr << endmsg;
                dlclose (module);
                return -1;
@@ -258,6 +257,7 @@ PluginManager::ladspa_discover (string path)
                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]) ) {
@@ -293,7 +293,7 @@ PluginManager::load (Session& session, PluginInfo *info)
                                FSTHandle* handle;
                                
                                if ((handle = fst_load (info->path.c_str())) == 0) {
-                                       error << compose(_("VST: cannot load module from \"%1\""), info->path) << endmsg;
+                                       error << string_compose(_("VST: cannot load module from \"%1\""), info->path) << endmsg;
                                } else {
                                        plugin = new VSTPlugin (_engine, session, handle);
                                }
@@ -308,7 +308,7 @@ PluginManager::load (Session& session, PluginInfo *info)
                } else {
 
                        if ((module = dlopen (info->path.c_str(), RTLD_NOW)) == 0) {
-                               error << compose(_("LADSPA: cannot load module from \"%1\""), info->path) << endmsg;
+                               error << string_compose(_("LADSPA: cannot load module from \"%1\""), info->path) << endmsg;
                                error << dlerror() << endmsg;
                        } else {
                                plugin = new LadspaPlugin (module, _engine, session, info->index, session.frame_rate());
@@ -326,7 +326,7 @@ PluginManager::load (Session& session, PluginInfo *info)
 }
 
 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;
@@ -338,11 +338,16 @@ ARDOUR::find_plugin(Session& session, string name, PluginInfo::Type type)
                break;
        case PluginInfo::VST:
                plugs = &mgr->vst_plugin_info();
+               unique_id = 0; // VST plugins don't have a unique id.
                break;
+       case PluginInfo::AudioUnit:
+       default:
+               return 0;
        }
 
        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);
                }
        }
@@ -455,7 +460,7 @@ PluginManager::vst_discover (string path)
        }
 
        if (!finfo->canProcessReplacing) {
-               warning << compose (_("VST plugin %1 does not support processReplacing, and so cannot be used in ardour at this time"),
+               warning << string_compose (_("VST plugin %1 does not support processReplacing, and so cannot be used in ardour at this time"),
                                    finfo->name)
                        << endl;
        }