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

   return false;
}
コード例 #2
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;
}
コード例 #3
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;
}
コード例 #4
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;
}
コード例 #5
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;
}
コード例 #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()) {
      lib.Unload();
   }

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

   return index > 0;
}