18#if !defined(__WXMSW__)
22#define RTLD_DEEPBIND 0
29#include <wx/tokenzr.h>
55 return std::make_unique<LadspaEffectsModule>();
87 return XO(
"LADSPA Effects");
92 return XO(
"The Audacity Team");
103 return XO(
"Provides LADSPA Effects");
168 for (
size_t j = 0, cnt = files.size(); j < cnt; j++)
185#if defined(__WXMAC__)
190#elif defined(__WXMSW__)
202 return { files.begin(), files.end() };
213 if (ff.GetName().CmpNoCase(
wxT(
"vst-bridge")) == 0) {
214 errMsg =
XO(
"Audacity no longer uses vst-bridge");
222 bool hadpath = wxGetEnv(
wxT(
"PATH"), &envpath);
223 wxSetEnv(
wxT(
"PATH"), ff.GetPath() + wxFILE_SEP_PATH + envpath);
224 wxString saveOldCWD = ff.GetCwd();
231#if defined(__WXMSW__)
232 wxDynamicLibrary lib;
233 if (lib.Load(path, wxDL_NOW))
235 void *lib = dlopen((
const char *)path.ToUTF8(), RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
240#if defined(__WXMSW__)
251 for (data = mainFn(index); data; data = mainFn(++index)) {
256 callback(
this, &effect );
259 errMsg =
XO(
"Could not load the library");
264 errMsg =
XO(
"Could not load the library");
266#if defined(__WXMSW__)
267 if (lib.IsLoaded()) {
272 using namespace std::chrono;
273 std::this_thread::sleep_for(10ms);
282 wxSetWorkingDirectory(saveOldCWD);
283 hadpath ? wxSetEnv(
wxT(
"PATH"), envpath) : wxUnsetEnv(
wxT(
"PATH"));
288std::unique_ptr<ComponentInterface>
296 wxString realPath = path.BeforeFirst(
wxT(
';'));
297 path.AfterFirst(
wxT(
';')).ToLong(&index);
299 result->InitializePlugin();
305 const auto realPath = path.BeforeFirst(
wxT(
';'));
306 return wxFileName::FileExists(realPath);
315 pathVar = wxString::FromUTF8(getenv(
"LADSPA_PATH"));
316 if (!pathVar.empty())
318 wxStringTokenizer tok(pathVar, wxPATH_SEP);
319 while (tok.HasMoreTokens())
321 pathList.push_back(tok.GetNextToken());
325#if defined(__WXMAC__)
326#define LADSPAPATH wxT("/Library/Audio/Plug-Ins/LADSPA")
329 pathList.push_back(wxGetHomeDir() + wxFILE_SEP_PATH +
LADSPAPATH);
332#elif defined(__WXMSW__)
338 pathList.push_back(wxGetHomeDir() + wxFILE_SEP_PATH +
wxT(
".ladspa"));
340 pathList.push_back(
wxT(
"/usr/local/lib64/ladspa"));
341 pathList.push_back(
wxT(
"/usr/lib64/ladspa"));
343 pathList.push_back(
wxT(
"/usr/local/lib/ladspa"));
344 pathList.push_back(
wxT(
"/usr/lib/ladspa"));
345 pathList.push_back(
wxT(LIBDIR)
wxT(
"/ladspa"));
std::vector< PluginPath > PluginPaths
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
#define LADSPAEFFECTS_VERSION
#define LADSPAEFFECTS_FAMILY
DECLARE_PROVIDER_ENTRY(AudacityModule)
static const wxChar * kShippedEffects[]
DECLARE_BUILTIN_PROVIDER(LadspaBuiltin)
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
static result_type Call(Arguments &&...arguments)
Null check of the installed function is done for you.
An Effect that calls up a LADSPA plug in, i.e. many possible effects from this one class.
PluginPaths FindModulePaths(PluginManagerInterface &pm) override
virtual ~LadspaEffectsModule()
ComponentInterfaceSymbol GetSymbol() const override
std::unique_ptr< ComponentInterface > LoadPlugin(const PluginPath &path) override
Load the plug-in at a path reported by DiscoverPluginsAtPath.
FilePath InstallPath() override
Where plug-in files should be copied to install them.
TranslatableString GetDescription() const override
EffectFamilySymbol GetOptionalFamilySymbol() override
A symbol identifying the family of plug-ins provided by this.
unsigned DiscoverPluginsAtPath(const PluginPath &path, TranslatableString &errMsg, const RegistrationCallback &callback) override
FilePaths GetSearchPaths()
const FileExtensions & GetFileExtensions() override
File types associated with this protocol.
VendorSymbol GetVendor() const override
void Terminate() override
Called just prior to deletion to allow releasing any resources.
wxString GetVersion() const override
bool Initialize() override
Called immediately after creation. Let provider initialize.
PluginPath GetPath() const override
bool CheckPluginExist(const PluginPath &path) const override
Performs plugin/module existence check, still plugin may fail to load. Implementation should avoid lo...
void AutoRegisterPlugins(PluginManagerInterface &pm) override
Called so that a provider of a static set of plug-ins can register them.
virtual void FindFilesInPathList(const wxString &pattern, const FilePaths &pathList, FilePaths &files, bool directories=false)=0
virtual bool IsPluginRegistered(const PluginPath &path, const TranslatableString *pName=nullptr)=0
Was the plugin registry already populated for a path (maybe from loading the config file)?
static const PluginID & DefaultRegistrationCallback(PluginProvider *provider, ComponentInterface *ident)
std::function< const PluginID &(PluginProvider *, ComponentInterface *) > RegistrationCallback
Further expand a path reported by FindModulePaths.
Holds a msgid for the translation catalog; may also bind format arguments.
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
const LADSPA_Descriptor *(* LADSPA_Descriptor_Function)(unsigned long Index)
FILES_API FilePath PlugInDir()
The user plug-in directory (not a system one)
_LADSPA_Descriptor is a structure that provides the API to a LADSPA (Linux Audio Plugin Architecture)...