コード例 #1
0
ファイル: LoadNyquist.cpp プロジェクト: AthiVarathan/audacity
bool NyquistEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{
   // Autoregister effects that we "think" are ones that have been shipped with
   // Audacity.  A little simplistic, but it should suffice for now.
   wxArrayString pathList = NyquistEffect::GetNyquistSearchPath();
   wxArrayString files;

   if (!pm.IsPluginRegistered(NYQUIST_PROMPT_ID))
   {
      RegisterPlugin(pm, NYQUIST_PROMPT_ID);
   }

   for (int i = 0; i < WXSIZEOF(kShippedEffects); i++)
   {
      files.Clear();
      pm.FindFilesInPathList(kShippedEffects[i], pathList, files);
      for (size_t j = 0, cnt = files.GetCount(); j < cnt; j++)
      {
         if (!pm.IsPluginRegistered(files[j]))
         {
            RegisterPlugin(pm, files[j]);
         }
      }
   }

   // We still want to be called during the normal registration process
   return false;
}
コード例 #2
0
ファイル: LoadNyquist.cpp プロジェクト: AthiVarathan/audacity
wxArrayString NyquistEffectsModule::FindPlugins(PluginManagerInterface & pm)
{
   wxArrayString pathList = NyquistEffect::GetNyquistSearchPath();
   wxArrayString files;

   // Add the Nyquist prompt effect
   files.Add(NYQUIST_PROMPT_ID);
   
   // Load .ny plug-ins
   pm.FindFilesInPathList(wxT("*.ny"), pathList, files);
   // LLL:  Works for all platform with NEW plugin support (dups are removed)
   pm.FindFilesInPathList(wxT("*.NY"), pathList, files); // Ed's fix for bug 179

   return files;
}
コード例 #3
0
bool BuiltinEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxString & path)
{
   auto effect = Instantiate(path);
   if (effect)
   {
      pm.RegisterPlugin(this, effect.get());
      return true;
   }

   return false;
}
コード例 #4
0
ファイル: LoadNyquist.cpp プロジェクト: AthiVarathan/audacity
bool NyquistEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxString & path)
{
   NyquistEffect effect(path);
   if (effect.IsOk())
   {
      pm.RegisterPlugin(this, &effect);
      return true;
   }

   return false;
}
コード例 #5
0
ファイル: LadspaEffect.cpp プロジェクト: dot-Sean/audio
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;
}
コード例 #6
0
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 envpath;
   bool hadpath = wxGetEnv(wxT("PATH"), &envpath);
   wxSetEnv(wxT("PATH"), f.GetPath() + wxFILE_SEP_PATH + envpath);
   wxString saveOldCWD = f.GetCwd();
   f.SetCwd();
   
   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)) {
            LadspaEffect effect(path, index);
            if (effect.SetHost(NULL)) {
               pm.RegisterPlugin(this, &effect);
            }
         }
      }
   }

   if (lib.IsLoaded()) {
      // PRL:  I suspect Bug1257 -- Crash when enabling Amplio2 -- is the fault of a timing-
      // dependent multi-threading bug in the Amplio2 library itself, in case the unload of the .dll
      // comes too soon after the load.  I saw the bug in Release builds but not Debug.
      // A sleep of even 1 ms was enough to fix the problem for me, but let's be even more generous.
      ::wxMilliSleep(10);
      lib.Unload();
   }

   wxSetWorkingDirectory(saveOldCWD);
   hadpath ? wxSetEnv(wxT("PATH"), envpath) : wxUnsetEnv(wxT("PATH"));

   return index > 0;
}
コード例 #7
0
ファイル: LoadEffects.cpp プロジェクト: Azpidatziak/audacity
bool BuiltinEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{
   for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++)
   {
      wxString path(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);

      if (!pm.IsPluginRegistered(path))
      {
         RegisterPlugin(pm, path);
      }
   }

   // We still want to be called during the normal registration process
   return false;
}
コード例 #8
0
wxArrayString LadspaEffectsModule::FindPlugins(PluginManagerInterface & pm)
{
   wxArrayString pathList = GetSearchPaths();
   wxArrayString files;

#if defined(__WXMAC__)

   // 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
   
   // Recursively scan for all shared objects
   pm.FindFilesInPathList(wxT("*.so"), pathList, files, true);

#endif

   return files;
}
コード例 #9
0
ファイル: LoadVamp.cpp プロジェクト: LBoggino/audacity
bool VampEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxString & path)
{
   int output;
   bool hasParameters;

   Plugin *vp = FindPlugin(path, output, hasParameters);
   if (vp)
   {
      VampEffect effect(vp, path, output, hasParameters);
      pm.RegisterPlugin(this, &effect);

      return true;
   }

   return false;
}
コード例 #10
0
ファイル: LoadLV2.cpp プロジェクト: rbuj/audacity
bool LV2EffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxString & path)
{
   const LilvPlugin *plug = GetPlugin(path);
   if (!plug)
   {
      return false;
   }

   LV2Effect effect(plug);
   if (effect.SetHost(NULL))
   {
      pm.RegisterPlugin(this, &effect);
   }

   return true;
}
コード例 #11
0
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 envpath;
   bool hadpath = wxGetEnv(wxT("PATH"), &envpath);
   wxSetEnv(wxT("PATH"), f.GetPath() + wxFILE_SEP_PATH + envpath);
   wxString saveOldCWD = f.GetCwd();
   f.SetCwd();
   
   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)) {
            LadspaEffect effect(path, index);
            if (effect.SetHost(NULL)) {
               pm.RegisterPlugin(this, &effect);
            }
         }
      }
   }

   if (lib.IsLoaded()) {
      lib.Unload();
   }

   wxSetWorkingDirectory(saveOldCWD);
   hadpath ? wxSetEnv(wxT("PATH"), envpath) : wxUnsetEnv(wxT("PATH"));

   return index > 0;
}
コード例 #12
0
ファイル: LadspaEffect.cpp プロジェクト: dot-Sean/audio
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;
}