17#include <wx/filename.h>
26using namespace Vamp::HostExt;
27using namespace Vamp::HostExt;
42 return std::make_unique<VampEffectsModule>();
75 return XO(
"Vamp Effects");
80 return XO(
"The Audacity Team");
91 return XO(
"Provides Vamp Effects support to Audacity");
133 PluginLoader *loader = PluginLoader::getInstance();
135 PluginLoader::PluginKeyList keys = loader->listPlugins();
137 for (PluginLoader::PluginKeyList::iterator i = keys.begin(); i != keys.end(); ++i)
139 std::unique_ptr<Plugin> vp{ PluginLoader::getInstance()->loadPlugin(*i, 48000) };
164 Plugin::OutputList outputs = vp->getOutputDescriptors();
168 for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
170 if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
171 j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
172 !j->hasFixedBinCount ||
181 wxString
name = wxString::FromUTF8(vp->getName().c_str());
183 if (outputs.size() > 1)
188 wxString outputName = wxString::FromUTF8(j->name.c_str());
189 if (outputName !=
name)
191 name = wxString::Format(
wxT(
"%s: %s"),
196 wxString path = wxString::FromUTF8(i->c_str()) +
wxT(
"/") +
name;
197 names.push_back(path);
214 auto vp =
FindPlugin(path, output, hasParameters);
217 VampEffect effect(std::move(vp), path, output, hasParameters);
219 callback(
this, &effect );
224 errMsg =
XO(
"Could not load the library");
228std::unique_ptr<ComponentInterface>
235 if (
auto vp =
FindPlugin(path, output, hasParameters))
236 return std::make_unique<VampEffect>(std::move(vp), path, output, hasParameters);
242 PluginLoader::PluginKey
key = path.BeforeFirst(
wxT(
'/')).ToUTF8().data();
243 const auto libraryPathUTF8 = PluginLoader::getInstance()->getLibraryPathForPlugin(
key);
244 if(!libraryPathUTF8.empty())
245 return wxFileName::FileExists(wxString::FromUTF8(libraryPathUTF8));
246 return wxFileName::FileExists(path);
253 bool & hasParameters)
255 PluginLoader::PluginKey
key = path.BeforeFirst(
wxT(
'/')).ToUTF8().data();
257 std::unique_ptr<Plugin> vp{ PluginLoader::getInstance()->loadPlugin(
key, 48000) };
282 Plugin::OutputList outputs = vp->getOutputDescriptors();
286 hasParameters = !vp->getParameterDescriptors().empty();
288 for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
290 if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
291 j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
292 !j->hasFixedBinCount ||
301 wxString
name = wxString::FromUTF8(vp->getName().c_str());
303 if (outputs.size() > 1)
308 wxString outputName = wxString::FromUTF8(j->name.c_str());
309 if (outputName !=
name)
311 name = wxString::Format(
wxT(
"%s: %s"),
316 if (wxString::FromUTF8(
key.c_str()) +
wxT(
"/") +
name == path)
std::vector< PluginPath > PluginPaths
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
DECLARE_PROVIDER_ENTRY(AudacityModule)
DECLARE_BUILTIN_PROVIDER(VampsEffectBuiltin)
#define VAMPEFFECTS_FAMILY
#define VAMPEFFECTS_VERSION
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
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.
bool Initialize() override
Called immediately after creation. Let provider initialize.
VendorSymbol GetVendor() const override
virtual ~VampEffectsModule()
const FileExtensions & GetFileExtensions() override
File types associated with this protocol.
ComponentInterfaceSymbol GetSymbol() const override
unsigned DiscoverPluginsAtPath(const PluginPath &path, TranslatableString &errMsg, const RegistrationCallback &callback) override
EffectFamilySymbol GetOptionalFamilySymbol() override
A symbol identifying the family of plug-ins provided by this.
PluginPaths FindModulePaths(PluginManagerInterface &pm) override
PluginPath GetPath() const override
std::unique_ptr< Vamp::Plugin > FindPlugin(const PluginPath &wpath, int &output, bool &hasParameters)
void Terminate() override
Called just prior to deletion to allow releasing any resources.
bool CheckPluginExist(const PluginPath &path) const override
Performs plugin/module existence check, still plugin may fail to load. Implementation should avoid lo...
TranslatableString GetDescription() const override
void AutoRegisterPlugins(PluginManagerInterface &pm) override
Called so that a provider of a static set of plug-ins can register them.
std::unique_ptr< ComponentInterface > LoadPlugin(const PluginPath &path) override
Load the plug-in at a path reported by DiscoverPluginsAtPath.
wxString GetVersion() const override
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.