Audacity 3.2.0
EffectManager.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 EffectManager.h
6
7 Audacity(R) is copyright (c) 1999-2008 Audacity Team.
8 License: GPL v2 or later. See License.txt.
9
10**********************************************************************/
11
12#ifndef __AUDACITY_EFFECTMANAGER__
13#define __AUDACITY_EFFECTMANAGER__
14
15#include "EffectInterface.h"
16#include "Identifier.h"
17
18#include <functional>
19#include <memory>
20#include <unordered_map>
21#include <variant>
22#include <vector>
23
24class AudacityProject;
25class CommandContext;
27class wxString;
28typedef wxString PluginID;
29class Effect;
30class EffectPlugin;
31class EffectSettings;
32class EffectInstance;
33
37};
38
39using EffectMap = std::unordered_map<wxString, EffectAndDefaultSettings>;
40using EffectOwnerMap = std::unordered_map< wxString, std::shared_ptr<EffectPlugin> >;
41
42EFFECTS_API
44
45EFFECTS_API
47
48EFFECTS_API
50
51class EFFECTS_API EffectManager
52{
53public:
54
55 enum : unsigned {
56 // No flags specified
57 kNone = 0x00,
58 // Flag used to disable prompting for configuration parameteres.
59 kConfigured = 0x01,
60 // Flag used to disable saving the state after processing.
61 kSkipState = 0x02,
62 // Flag used to disable "Repeat Last Effect"
63 kDontRepeatLast = 0x04,
64 // Flag used to disable "Select All during Repeat Generator Effect"
65 kRepeatGen = 0x08,
66 // Flag used for repeating Nyquist Prompt
67 kRepeatNyquistPrompt = 0x10,
68 };
69
71 static const EffectInstanceFactory*
72 GetInstanceFactory(const PluginID& ID);
73
76 static EffectManager& Get();
77
78 //
79 // public methods
80 //
81 // Used by the outside program to register the list of effects and retrieve
82 // them by index number, usually when the user selects one from a menu.
83 //
84public:
85 using EffectPresetDialog = std::function<std::optional<wxString>(
86 EffectPlugin&, const wxString& preset)>;
87
89
91 const PluginID & RegisterEffect(std::unique_ptr<EffectPlugin> uEffect);
93 void UnregisterEffect(const PluginID & ID);
94
95 TranslatableString GetEffectFamilyName(const PluginID & ID);
96 TranslatableString GetVendorName(const PluginID & ID);
97
98 bool IsHidden(const PluginID & ID);
99
100 bool HasPresets(const PluginID & ID);
101 wxString
102 GetPreset(const PluginID& ID, const wxString& params, EffectPresetDialog);
103 wxString GetDefaultPreset(const PluginID & ID);
104
106 void SetSkipStateFlag(bool flag);
107 bool GetSkipStateFlag();
108
110 EffectPlugin* GetEffect(const PluginID& ID);
111
113 EffectSettings* GetDefaultSettings(const PluginID& ID);
114
120 std::pair<EffectPlugin*, EffectSettings*>
121 GetEffectAndDefaultSettings(const PluginID& ID);
122
123private:
124 EffectAndDefaultSettings& DoGetEffect(const PluginID& ID);
125
128
130
131 // Set true if we want to skip pushing state
132 // after processing at effect run time.
134};
135
136#endif
wxString PluginID
EffectDistortionSettings params
EFFECTS_API bool HasCurrentSettings(EffectPlugin &host)
EFFECTS_API bool HasFactoryDefaults(EffectPlugin &host)
std::unordered_map< wxString, std::shared_ptr< EffectPlugin > > EffectOwnerMap
Definition: EffectManager.h:40
std::unordered_map< wxString, EffectAndDefaultSettings > EffectMap
Definition: EffectManager.h:39
wxString PluginID
Definition: EffectManager.h:27
EFFECTS_API RegistryPaths GetUserPresets(EffectPlugin &host)
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
ReverbSettings preset
Definition: ReverbBase.cpp:25
static std::once_flag flag
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Base class for many of the effects in Audacity.
Definition: Effect.h:26
Performs effect computation.
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:52
std::function< std::optional< wxString >(EffectPlugin &, const wxString &preset)> EffectPresetDialog
Definition: EffectManager.h:86
EffectOwnerMap mHostEffects
EffectMap mEffects
Factory of instances of an effect.
Definition: EffectPlugin.h:36
Holds a msgid for the translation catalog; may also bind format arguments.
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202
EffectSettings settings
Definition: EffectManager.h:36
Externalized state of a plug-in.