bool LadspaEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxString & path) { // Since we now have builtin VST support, ignore the VST bridge as it // causes duplicate menu entries to appear. wxFileName f(path); if (f.GetName().CmpNoCase(wxT("vst-bridge")) == 0) { return false; } // As a courtesy to some plug-ins that might be bridges to // open other plug-ins, we set the current working // directory to be the plug-in's directory. wxString saveOldCWD = ::wxGetCwd(); wxString prefix = ::wxPathOnly(path); ::wxSetWorkingDirectory(prefix); int index = 0; LADSPA_Descriptor_Function mainFn = NULL; wxDynamicLibrary lib; if (lib.Load(path, wxDL_NOW)) { wxLogNull logNo; mainFn = (LADSPA_Descriptor_Function) lib.GetSymbol(wxT("ladspa_descriptor")); if (mainFn) { const LADSPA_Descriptor *data; for (data = mainFn(index); data; data = mainFn(++index)) { #if defined(USE_LIBLRDF) && defined(EFFECT_CATEGORIES) std::set<wxString> categories; std::multimap<unsigned long, wxString>::const_iterator iter; iter = gPluginCategories.lower_bound(data->UniqueID); for ( ; (iter != gPluginCategories.end() && iter->first == data->UniqueID); ++iter) categories.insert(iter->second); #endif LadspaEffect effect(path, index); if (effect.SetHost(NULL)) { pm.RegisterEffectPlugin(this, &effect); } } } } if (lib.IsLoaded()) { lib.Unload(); } ::wxSetWorkingDirectory(saveOldCWD); return index > 0; }