Audacity 3.2.0
LoadEffects.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 LoadEffects.h
6
7 Dominic Mazzoni
8
9**********************************************************************/
10
11#ifndef __AUDACITY_LOAD_EFFECTS__
12#define __AUDACITY_LOAD_EFFECTS__
13
14#include "PluginProvider.h"
15
16#include <functional>
17#include <memory>
18#include <unordered_map>
19#include <memory>
20
21class Effect;
22
24//
25// BuiltinEffectsModule
26//
28
29class EFFECTS_API BuiltinEffectsModule final : public PluginProvider
30{
31public:
33 virtual ~BuiltinEffectsModule();
34
35 using Factory = std::function< std::unique_ptr<Effect> () >;
36
37 // Typically you make a static object of this type in the .cpp file that
38 // also implements the Effect subclass.
39 template< typename Subclass >
40 struct Registration final { Registration( bool excluded = false ) {
41 DoRegistration(
42 Subclass::Symbol, []{ return std::make_unique< Subclass >(); },
43 excluded );
44 } };
45
46 // ComponentInterface implementation
47
48 PluginPath GetPath() const override;
49 ComponentInterfaceSymbol GetSymbol() const override;
50 VendorSymbol GetVendor() const override;
51 wxString GetVersion() const override;
52 TranslatableString GetDescription() const override;
53
54 // PluginProvider implementation
55
56 bool Initialize() override;
57 void Terminate() override;
59
60 const FileExtensions &GetFileExtensions() override;
61 FilePath InstallPath() override { return {}; }
62
65 unsigned DiscoverPluginsAtPath(
66 const PluginPath & path, TranslatableString &errMsg,
67 const RegistrationCallback &callback)
68 override;
69
70 bool CheckPluginExist(const PluginPath& path) const override;
71
72 std::unique_ptr<ComponentInterface>
73 LoadPlugin(const PluginPath & path) override;
74
75private:
76 // BuiltinEffectModule implementation
77
78 std::unique_ptr<Effect> Instantiate(const PluginPath & path);
79
80private:
81 static void DoRegistration(
82 const ComponentInterfaceSymbol &name, const Factory &factory,
83 bool excluded );
84
85 struct Entry;
86 using EffectHash = std::unordered_map< wxString, const Entry* > ;
88};
89
90#endif
static RegisteredToolbarFactory factory
std::vector< PluginPath > PluginPaths
Definition: Identifier.h:215
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
Definition: Identifier.h:214
Generalized interface for discovery of plug-ins for one protocol.
wxString FilePath
Definition: Project.h:21
wxString name
Definition: TagsEditor.cpp:166
Internal module to auto register all built in effects.
Definition: LoadEffects.h:30
EffectHash mEffects
Definition: LoadEffects.h:87
std::function< std::unique_ptr< Effect >() > Factory
Definition: LoadEffects.h:35
FilePath InstallPath() override
Where plug-in files should be copied to install them.
Definition: LoadEffects.h:61
std::unordered_map< wxString, const Entry * > EffectHash
Definition: LoadEffects.h:86
virtual wxString GetVersion() const =0
virtual PluginPath GetPath() const =0
virtual VendorSymbol GetVendor() const =0
virtual ComponentInterfaceSymbol GetSymbol() const =0
virtual TranslatableString GetDescription() const =0
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Base class for many of the effects in Audacity.
Definition: Effect.h:26
virtual EffectFamilySymbol GetOptionalFamilySymbol()=0
A symbol identifying the family of plug-ins provided by this.
virtual unsigned DiscoverPluginsAtPath(const PluginPath &path, TranslatableString &errMsg, const RegistrationCallback &callback)=0
virtual void Terminate()=0
Called just prior to deletion to allow releasing any resources.
virtual PluginPaths FindModulePaths(PluginManagerInterface &pluginManager)=0
virtual std::unique_ptr< ComponentInterface > LoadPlugin(const PluginPath &path)=0
Load the plug-in at a path reported by DiscoverPluginsAtPath.
virtual void AutoRegisterPlugins(PluginManagerInterface &pluginManager)=0
Called so that a provider of a static set of plug-ins can register them.
virtual const FileExtensions & GetFileExtensions()=0
File types associated with this protocol.
virtual bool Initialize()=0
Called immediately after creation. Let provider initialize.
virtual bool CheckPluginExist(const PluginPath &path) const =0
Performs plugin/module existence check, still plugin may fail to load. Implementation should avoid lo...
Holds a msgid for the translation catalog; may also bind format arguments.
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
Registration(bool excluded=false)
Definition: LoadEffects.h:40