void LoadLadspaPlugins() { wxArrayString audacityPathList = wxGetApp().audacityPathList; wxArrayString pathList; wxArrayString files; wxSortedArrayString uniq; wxString pathVar; unsigned int i; #if defined(USE_LIBLRDF) && defined(EFFECT_CATEGORIES) EffectManager& em = EffectManager::Get(); wxArrayString rdfPathList; wxString rdfPathVar; wxArrayString rdfFiles; InitCategoryMap(); lrdf_init(); rdfPathVar = wxGetenv(wxT("LADSPA_RDF_PATH")); if (rdfPathVar != wxT("")) wxGetApp().AddMultiPathsToPathList(rdfPathVar, rdfPathList); #ifdef __WXGTK__ wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), rdfPathList); wxGetApp().AddUniquePathToPathList(wxT("/usr/local/share/ladspa/rdf"), rdfPathList); #endif #ifdef __WXMAC__ wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), rdfPathList); // XXX Maybe other Mac paths here? #endif #ifdef __WXMSW__ //wxGetApp().AddUniquePathToPathList(wxT("WINDOWS LRDF PATH"), // rdfPathList); // XXX Other Windows paths here. #endif // Add the Audacity paths so we get ladspa.rdfs if we are using a local // liblrdf for(i=0; i<audacityPathList.GetCount(); i++) { wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH; wxGetApp().AddUniquePathToPathList(prefix + wxT("rdf"), rdfPathList); } wxGetApp().FindFilesInPathList(wxT("*.rdf"), rdfPathList, rdfFiles); wxGetApp().FindFilesInPathList(wxT("*.rdfs"), rdfPathList, rdfFiles); for(size_t i = 0; i < rdfFiles.GetCount(); ++i) { wxString fileUri(wxT("file://")); fileUri += rdfFiles[i]; lrdf_read_file(fileUri.mb_str(wxConvUTF8)); } // Add all plugin categories found by LRDF lrdf_uris* cats = lrdf_get_all_subclasses("http://ladspa.org/ontology#Plugin"); if (cats) { // Add the categories and find the plugins belonging to them for (size_t i = 0; i < cats->count; ++i) { char* label = lrdf_get_label(cats->items[i]); if (!label) continue; wxString uri = MapCategoryUri(wxString::FromAscii(cats->items[i])); em.AddCategory(uri, wxString::FromUTF8(label)); std::free(label); lrdf_uris* plugs = lrdf_get_instances(cats->items[i]); if (plugs) { for (size_t j = 0; j < plugs->count; ++j) { unsigned long uid = lrdf_get_uid(plugs->items[j]); gPluginCategories.insert(std::make_pair(uid, uri)); } lrdf_free_uris(plugs); } } // And their relationships for (size_t i = 0; i < cats->count; ++i) { EffectCategory* p = em.LookupCategory(MapCategoryUri(wxString::FromAscii(cats-> items[i]))); if (!p) continue; lrdf_uris* subs = lrdf_get_subclasses(cats->items[i]); if (subs) { for (size_t j = 0; j < subs->count; ++j) { EffectCategory* c = em.LookupCategory(MapCategoryUri(wxString::FromAscii(subs->items[j]))); if (c) em.AddCategoryParent(c, p); } lrdf_free_uris(subs); } } lrdf_free_uris(cats); } #endif pathVar = wxGetenv(wxT("LADSPA_PATH")); if (pathVar != wxT("")) wxGetApp().AddMultiPathsToPathList(pathVar, pathList); #ifdef __WXGTK__ wxGetApp().AddUniquePathToPathList(wxT(INSTALL_PREFIX) wxT("/ladspa"), pathList); wxGetApp().AddUniquePathToPathList(wxT("/usr/local/lib/ladspa"), pathList); wxGetApp().AddUniquePathToPathList(wxT(LIBDIR) wxT("/ladspa"), pathList); #endif #ifdef __WXMAC__ wxGetApp().AddUniquePathToPathList(wxT("~/Library/Audio/Plug-Ins/LADSPA"), pathList); wxGetApp().AddUniquePathToPathList(wxT("/Library/Audio/Plug-Ins/LADSPA"), pathList); #endif for(i=0; i<audacityPathList.GetCount(); i++) { wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH; wxGetApp().AddUniquePathToPathList(prefix + wxT("ladspa"), pathList); wxGetApp().AddUniquePathToPathList(prefix + wxT("plugins"), pathList); wxGetApp().AddUniquePathToPathList(prefix + wxT("plug-ins"), pathList); } #ifdef __WXMSW__ wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, files); #else wxGetApp().FindFilesInPathList(wxT("*.so"), pathList, files); #endif for(i=0; i<files.GetCount(); i++) LoadLadspaEffect(uniq, files[i], ladspa_dls); }
wxArrayString LadspaEffectsModule::FindPlugins(PluginManagerInterface & pm) { #if defined(USE_LIBLRDF) && defined(EFFECT_CATEGORIES) EffectManager& em = EffectManager::Get(); wxArrayString rdfPathList; wxString rdfPathVar; wxArrayString rdfFiles; InitCategoryMap(); lrdf_init(); rdfPathVar = wxGetenv(wxT("LADSPA_RDF_PATH")); if (rdfPathVar != wxT("")) wxGetApp().AddMultiPathsToPathList(rdfPathVar, rdfPathList); #ifdef __WXGTK__ wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), rdfPathList); wxGetApp().AddUniquePathToPathList(wxT("/usr/local/share/ladspa/rdf"), rdfPathList); #endif #ifdef __WXMAC__ wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), rdfPathList); // XXX Maybe other Mac paths here? #endif #ifdef __WXMSW__ //wxGetApp().AddUniquePathToPathList(wxT("WINDOWS LRDF PATH"), // rdfPathList); // XXX Other Windows paths here. #endif // Add the Audacity paths so we get ladspa.rdfs if we are using a local // liblrdf for(i=0; i<audacityPathList.GetCount(); i++) { wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH; wxGetApp().AddUniquePathToPathList(prefix + wxT("rdf"), rdfPathList); } wxGetApp().FindFilesInPathList(wxT("*.rdf"), rdfPathList, rdfFiles); wxGetApp().FindFilesInPathList(wxT("*.rdfs"), rdfPathList, rdfFiles); for(size_t i = 0; i < rdfFiles.GetCount(); ++i) { wxString fileUri(wxT("file://")); fileUri += rdfFiles[i]; lrdf_read_file(fileUri.mb_str(wxConvUTF8)); } // Add all plugin categories found by LRDF lrdf_uris* cats = lrdf_get_all_subclasses("http://ladspa.org/ontology#Plugin"); if (cats) { // Add the categories and find the plugins belonging to them for (size_t i = 0; i < cats->count; ++i) { char* label = lrdf_get_label(cats->items[i]); if (!label) continue; wxString uri = MapCategoryUri(wxString::FromAscii(cats->items[i])); em.AddCategory(uri, wxString::FromUTF8(label)); std::free(label); lrdf_uris* plugs = lrdf_get_instances(cats->items[i]); if (plugs) { for (size_t j = 0; j < plugs->count; ++j) { unsigned long uid = lrdf_get_uid(plugs->items[j]); gPluginCategories.insert(std::make_pair(uid, uri)); } lrdf_free_uris(plugs); } } // And their relationships for (size_t i = 0; i < cats->count; ++i) { EffectCategory* p = em.LookupCategory(MapCategoryUri(wxString::FromAscii(cats-> items[i]))); if (!p) continue; lrdf_uris* subs = lrdf_get_subclasses(cats->items[i]); if (subs) { for (size_t j = 0; j < subs->count; ++j) { EffectCategory* c = em.LookupCategory(MapCategoryUri(wxString::FromAscii(subs->items[j]))); if (c) em.AddCategoryParent(c, p); } lrdf_free_uris(subs); } } lrdf_free_uris(cats); } #endif wxArrayString pathList; wxArrayString files; wxString pathVar; // Check for the LADSPA_PATH environment variable pathVar = wxString::FromUTF8(getenv("LADSPA_PATH")); if (!pathVar.empty()) { wxStringTokenizer tok(pathVar); while (tok.HasMoreTokens()) { pathList.Add(tok.GetNextToken()); } } #if defined(__WXMAC__) #define LADSPAPATH wxT("/Library/Audio/Plug-Ins/LADSPA") // Look in ~/Library/Audio/Plug-Ins/LADSPA and /Library/Audio/Plug-Ins/LADSPA pathList.Add(wxGetHomeDir() + wxFILE_SEP_PATH + LADSPAPATH); pathList.Add(LADSPAPATH); // Recursively scan for all shared objects pm.FindFilesInPathList(wxT("*.so"), pathList, files, true); #elif defined(__WXMSW__) // Recursively scan for all DLLs pm.FindFilesInPathList(wxT("*.dll"), pathList, files, true); #else pathList.Add(wxGetHomeDir() + wxFILE_SEP_PATH + wxT(".ladspa")); pathList.Add(wxT("/usr/local/lib/ladspa")); pathList.Add(wxT("/usr/lib/ladspa")); pathList.Add(wxT(LIBDIR) wxT("/ladspa")); // Recursively scan for all shared objects pm.FindFilesInPathList(wxT("*.so"), pathList, files, true); #endif return files; }