1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 07:59:27 +02:00

Fix (hopefully final) for bug #1010.

This commit is contained in:
Leland Lucius 2015-06-12 23:10:23 -05:00
parent 60956bad79
commit 1b369be614
4 changed files with 127 additions and 28 deletions

View File

@ -56,7 +56,7 @@ class PluginManagerInterface
public:
virtual ~PluginManagerInterface() {};
virtual bool IsPluginRegistered(const PluginID & ID) = 0;
virtual bool IsPluginRegistered(const wxString & path) = 0;
virtual const PluginID & RegisterPlugin(ModuleInterface *module) = 0;
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, EffectIdentInterface *effect) = 0;

View File

@ -53,6 +53,14 @@ effects from this one class.
#include "../../ShuttleGui.h"
#include "../../widgets/valnum.h"
// ============================================================================
// List of effects that ship with Audacity. These will be autoregistered.
// ============================================================================
const static wxChar *kShippedEffects[] =
{
wxT("sc4_1882.dll"),
};
// ============================================================================
// Module registration entry point
//
@ -144,34 +152,36 @@ void LadspaEffectsModule::Terminate()
return;
}
bool LadspaEffectsModule::AutoRegisterPlugins(PluginManagerInterface & WXUNUSED(pm))
bool LadspaEffectsModule::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 = GetSearchPaths();
wxArrayString files;
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;
}
wxArrayString LadspaEffectsModule::FindPlugins(PluginManagerInterface & pm)
{
wxArrayString pathList;
wxArrayString pathList = GetSearchPaths();
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);
@ -183,11 +193,6 @@ wxArrayString LadspaEffectsModule::FindPlugins(PluginManagerInterface & pm)
#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);
@ -270,6 +275,46 @@ void LadspaEffectsModule::DeleteInstance(IdentInterface *instance)
}
}
wxArrayString LadspaEffectsModule::GetSearchPaths()
{
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);
#elif defined(__WXMSW__)
// No special paths...probably should look in %CommonProgramFiles%\LADSPA
#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"));
#endif
return pathList;
}
///////////////////////////////////////////////////////////////////////////////
//
// LadspaEffectOptionsDialog

View File

@ -233,7 +233,7 @@ public:
// LadspaEffectModule implementation
static void Check(const wchar_t *path);
wxArrayString GetSearchPaths();
private:
ModuleManagerInterface *mModMan;

View File

@ -16,6 +16,37 @@
#include "LoadNyquist.h"
// ============================================================================
// List of effects that ship with Audacity. These will be autoregistered.
// ============================================================================
const static wxChar *kShippedEffects[] =
{
wxT("adjustable-fade.ny"),
wxT("beat.ny"),
wxT("clicktrack.ny"),
wxT("clipfix.ny"),
wxT("crossfadeclips.ny"),
wxT("crossfadetracks.ny"),
wxT("delay.ny"),
wxT("equalabel.ny"),
wxT("highpass.ny"),
wxT("limiter.ny"),
wxT("lowpass.ny"),
wxT("notch.ny"),
wxT("pluck.ny"),
wxT("rissetdrum.ny"),
wxT("sample-data-export.ny"),
wxT("SilenceMarker.ny"),
wxT("SoundFinder.ny"),
wxT("SpectralEditMulti.ny"),
wxT("SpectralEditParametricEQ.ny"),
wxT("SpectralEditShelves.ny"),
wxT("StudioFadeOut.ny"),
wxT("tremolo.ny"),
wxT("vocalremover.ny"),
wxT("vocoder.ny"),
};
// ============================================================================
// Module registration entry point
//
@ -125,9 +156,32 @@ void NyquistEffectsModule::Terminate()
return;
}
bool NyquistEffectsModule::AutoRegisterPlugins(PluginManagerInterface & WXUNUSED(pm))
bool NyquistEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{
// Nothing to do here
// 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;
}