Audacity 3.2.0
EffectInterface.cpp
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file EffectInterface.cpp
6
7**********************************************************************/
8#include "EffectInterface.h"
9#include <wx/tokenzr.h>
10
12{
13 static wxString key("LastUsedDuration");
14 return key;
15}
16
18
20
22{
23 return mSettings;
24}
25
27{
28 mSettings = std::move(settings);
29}
30
32{
33}
34
36 const EffectSettingsAccess &other) const
37{
38 if (auto pOther =
39 dynamic_cast<const SimpleEffectSettingsAccess*>(&other))
40 return &this->mSettings == &pOther->mSettings;
41 return false;
42}
43
45{
46 // Get rid of leading and trailing white space
47 auto name = ident.GET();
48 name.Trim(true).Trim(false);
49
50 if (name.empty())
51 return {};
52
53 wxStringTokenizer st(name, wxT(" "));
54 wxString id;
55
56 // CamelCase the name
57 while (st.HasMoreTokens()) {
58 wxString tok = st.GetNextToken();
59 id += tok.Left(1).MakeUpper() + tok.Mid(1).MakeLower();
60 }
61
62 return id;
63}
64
66
68{
69 return GetType();
70}
71
73{
74 return false;
75}
76
78{
79 return {};
80}
81
83{
84 return {};
85}
86
88{
89 return false;
90}
91
93
96{
97 return false;
98}
99
101 ConstSettingsVisitor &, const EffectSettings &) const
102{
103 return false;
104}
105
107{
108 return {};
109}
110
112 const EffectSettings &, EffectSettings &) const
113{
114 return true;
115}
116
118
120{
121 return true;
122}
123
125{
126 return false;
127}
128
130{
131 return true;
132}
133
135{
136 return true;
137}
138
140{
141 return true;
142}
143
145{
146 return true;
147}
148
150 const float *const *, float *const *, size_t)
151{
152 return 0;
153}
154
156{
157 return true;
158}
159
161{
162 return true;
163}
164
166{
167 return 0;
168}
169
171
173{
174 return mBlockSize;
175}
176
178{
179 return (mBlockSize = maxBlockSize);
180}
181
183
185{
186 return 0;
187}
188
190{
191 return 0;
192}
193
196 : mEffect{effect}
197 , mAccess{access}
198{}
199
201{
203}
204
206{
207 return true;
208}
209
211
213{
214 bool result {};
216 result = mEffect.ValidateUI(settings);
217 });
218 return result;
219}
220
222
224{
225 static RegistryPath id{ "CurrentSettings" };
226 return id;
227}
228
230{
231 static RegistryPath id{ "FactoryDefaults" };
232 return id;
233}
234
236{
237 RegistryPath group = wxT("UserPresets");
238 if (!name.empty())
239 group += wxCONFIG_PATH_SEPARATOR + name;
240 return group;
241}
static const AudacityProject::AttachedObjects::RegisteredFactory key
const TranslatableString name
Definition: Distortion.cpp:82
RegistryPath UserPresetsGroup(const RegistryPath &name)
Compute part of a registry path, given a name which may be empty.
const RegistryPath & FactoryDefaultsGroup()
Component of a configuration key path, for default state of MakeSettings()
const RegistryPath & CurrentSettingsGroup()
Component of a configuration key path, for last-used destructive settings.
EffectType
wxString RegistryPath
Definition: Identifier.h:218
static CommandHandlerObject & ident(AudacityProject &project)
wxString FilePath
Definition: Project.h:20
static Settings & settings()
Definition: TrackInfo.cpp:87
int id
bool ValidateUI() override
Calls mEffect.ValidateUI()
~DefaultEffectUIValidator() override
virtual EffectType GetType() const =0
Type determines how it behaves.
virtual bool IsHiddenFromMenus() const
Default is false.
virtual bool EnablesDebug() const
Whether the effect dialog should have a Debug button; default, always false.
virtual FilePath HelpPage() const
Fully qualified local help file name, default is empty.
virtual EffectType GetClassification() const
Determines which menu it appears in; default same as GetType().
virtual ManualPageID ManualPage() const
Name of a page in the Audacity alpha manual, default is empty.
static Identifier GetSquashedName(const Identifier &ident)
A utility that strips spaces and CamelCases a name.
virtual ~EffectDefinitionInterface()
virtual int GetMidiInCount() const
Function that has not yet found a use.
virtual ~EffectInstanceFactory()
virtual int GetMidiOutCount() const
Function that has not yet found a use.
virtual size_t GetTailSize() const
virtual bool RealtimeSuspend()
virtual bool RealtimeResume()
virtual bool Init()
Call once to set up state for whole list of tracks to be processed.
virtual bool RealtimeInitialize(EffectSettings &settings, double sampleRate)
virtual bool RealtimeProcessEnd(EffectSettings &settings) noexcept
settings can be updated to let a dialog change appearance at idle
virtual bool RealtimeFinalize(EffectSettings &settings) noexcept
virtual bool RealtimeProcessStart(EffectSettings &settings)
settings are possibly changed, since last call, by an asynchronous dialog
virtual ~EffectInstance()
virtual size_t RealtimeProcess(size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
virtual bool RealtimeAddProcessor(EffectSettings &settings, unsigned numChannels, float sampleRate)
size_t SetBlockSize(size_t maxBlockSize) override
~EffectInstanceWithBlockSize() override
size_t GetBlockSize() const override
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
virtual ~EffectSettingsAccess()
static const RegistryPath & DurationKey()
virtual bool VisitSettings(SettingsVisitor &visitor, EffectSettings &settings)
virtual ~EffectSettingsManager()
virtual bool CopySettingsContents(const EffectSettings &src, EffectSettings &dst) const
Update one settings object from another.
virtual EffectSettings MakeSettings() const
EffectUIClientInterface is an abstract base class to populate a UI and validate UI values....
virtual bool CloseUI()=0
virtual bool ValidateUI(EffectSettings &settings)=0
virtual ~EffectUIClientInterface()
EffectSettingsAccess & mAccess
EffectUIValidator(EffectUIClientInterface &effect, EffectSettingsAccess &access)
virtual bool UpdateUI()
Update appearance of the panel for changes in settings.
virtual ~EffectUIValidator()
EffectUIClientInterface & mEffect
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
Visitor of effect or command parameters. This is a base class with lots of virtual functions that do ...
Definition: Shuttle.h:115
Implementation of EffectSettings for cases where there is only one thread.
void Set(EffectSettings &&settings) override
void Flush() override
Make the last Set changes "persistent" in underlying storage.
bool IsSameAs(const EffectSettingsAccess &other) const override
const EffectSettings & Get() override
~SimpleEffectSettingsAccess() override
Externalized state of a plug-in.