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");
173 for (
size_t j = 0, cnt = files.size(); j < cnt; j++)
190#if defined(__WXMAC__)
195#elif defined(__WXMSW__)
207 return { files.begin(), files.end() };
218 if (ff.GetName().CmpNoCase(
wxT(
"vst-bridge")) == 0) {
219 errMsg =
XO(
"Audacity no longer uses vst-bridge");
227 bool hadpath = wxGetEnv(
wxT(
"PATH"), &envpath);
228 wxSetEnv(
wxT(
"PATH"), ff.GetPath() + wxFILE_SEP_PATH + envpath);
229 wxString saveOldCWD = ff.GetCwd();
236#if defined(__WXMSW__)
237 wxDynamicLibrary lib;
238 if (lib.Load(path, wxDL_NOW))
240 void *lib = dlopen((
const char *)path.ToUTF8(), RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
245#if defined(__WXMSW__)
256 for (data = mainFn(index); data; data = mainFn(++index)) {
261 callback(
this, &effect );
264 errMsg =
XO(
"Could not load the library");
269 errMsg =
XO(
"Could not load the library");
271#if defined(__WXMSW__)
272 if (lib.IsLoaded()) {
277 using namespace std::chrono;
278 std::this_thread::sleep_for(10ms);
287 wxSetWorkingDirectory(saveOldCWD);
288 hadpath ? wxSetEnv(
wxT(
"PATH"), envpath) : wxUnsetEnv(
wxT(
"PATH"));
293std::unique_ptr<ComponentInterface>
301 wxString realPath = path.BeforeFirst(
wxT(
';'));
302 path.AfterFirst(
wxT(
';')).ToLong(&index);
304 result->InitializePlugin();
310 const auto realPath = path.BeforeFirst(
wxT(
';'));
311 return wxFileName::FileExists(realPath);
320 pathVar = wxString::FromUTF8(getenv(
"LADSPA_PATH"));
321 if (!pathVar.empty())
323 wxStringTokenizer tok(pathVar, wxPATH_SEP);
324 while (tok.HasMoreTokens())
326 pathList.push_back(tok.GetNextToken());
330#if defined(__WXMAC__)
331#define LADSPAPATH wxT("/Library/Audio/Plug-Ins/LADSPA")
334 pathList.push_back(wxGetHomeDir() + wxFILE_SEP_PATH +
LADSPAPATH);
337#elif defined(__WXMSW__)
343 pathList.push_back(wxGetHomeDir() + wxFILE_SEP_PATH +
wxT(
".ladspa"));
345 pathList.push_back(
wxT(
"/usr/local/lib64/ladspa"));
346 pathList.push_back(
wxT(
"/usr/lib64/ladspa"));
348 pathList.push_back(
wxT(
"/usr/local/lib/ladspa"));
349 pathList.push_back(
wxT(
"/usr/lib/ladspa"));
350 pathList.push_back(
wxT(LIBDIR)
wxT(
"/ladspa"));
356 std::copy(customPaths.begin(), customPaths.end(), std::back_inserter(pathList));
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
FilePaths GetSearchPaths(PluginManagerInterface &pluginManager)
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.
bool SupportsCustomModulePaths() const override
unsigned DiscoverPluginsAtPath(const PluginPath &path, TranslatableString &errMsg, const RegistrationCallback &callback) override
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 PluginPaths ReadCustomPaths(const PluginProvider &provider)=0
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)
void copy(const T *src, T *dst, int32_t n)
_LADSPA_Descriptor is a structure that provides the API to a LADSPA (Linux Audio Plugin Architecture)...