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#include <wx/window.h>
11
13{
14 static wxString key("LastUsedDuration");
15 return key;
16}
17
19
21
23
25
27{
28 return mSettings;
29}
30
32 std::unique_ptr<Message>)
33{
34 mSettings = std::move(settings);
35}
36
37void SimpleEffectSettingsAccess::Set(std::unique_ptr<Message>)
38{
39}
40
42{
43}
44
46 const EffectSettingsAccess &other) const
47{
48 if (auto pOther =
49 dynamic_cast<const SimpleEffectSettingsAccess*>(&other))
50 return &this->mSettings == &pOther->mSettings;
51 return false;
52}
53
55{
56 // Get rid of leading and trailing white space
57 auto name = ident.GET();
58 name.Trim(true).Trim(false);
59
60 if (name.empty())
61 return {};
62
63 wxStringTokenizer st(name, wxT(" "));
64 wxString id;
65
66 // CamelCase the name
67 while (st.HasMoreTokens()) {
68 wxString tok = st.GetNextToken();
69 id += tok.Left(1).MakeUpper() + tok.Mid(1).MakeLower();
70 }
71
72 return id;
73}
74
76
78{
79 return GetType();
80}
81
83{
84 return false;
85}
86
88{
89 return {};
90}
91
93{
94 return {};
95}
96
98{
99 return false;
100}
101
103
106{
107 return false;
108}
109
111 ConstSettingsVisitor &, const EffectSettings &) const
112{
113 return false;
114}
115
117{
118 return {};
119}
120
122 -> std::unique_ptr<EffectOutputs>
123{
124 return nullptr;
125}
126
128 const EffectSettings &, EffectSettings &) const
129{
130 return true;
131}
132
134
136{
137 return true;
138}
139
141{
142 return false;
143}
144
146 EffectSettings &, EffectOutputs *, unsigned, float)
147{
148 return true;
149}
150
152{
153 return true;
154}
155
157{
158 return true;
159}
160
161auto EffectInstance::MakeMessage() const -> std::unique_ptr<Message>
162{
163 return nullptr;
164}
165
167{
168 return true;
169}
170
172 const float *const *, float *const *, size_t)
173{
174 return 0;
175}
176
178{
179 return true;
180}
181
183{
184 return true;
185}
186
188{
189 return 0;
190}
191
193 -> SampleCount
194{
195 return 0;
196}
197
199
201
203{
204 return mBlockSize;
205}
206
208{
209 return (mBlockSize = maxBlockSize);
210}
211
213
216 : mEffect{effect}
217 , mAccess{access}
218{}
219
221
223{
224 return true;
225}
226
228{
229 return false;
230}
231
233{
234}
235
237{
238 if (!mUIClosed)
239 {
241 mUIClosed = true;
242 }
243}
244
246
248{
249 static RegistryPath id{ "CurrentSettings" };
250 return id;
251}
252
254{
255 static RegistryPath id{ "FactoryDefaults" };
256 return id;
257}
258
260{
261 RegistryPath group = wxT("UserPresets");
262 if (!name.empty())
263 group += wxCONFIG_PATH_SEPARATOR + name;
264 return group;
265}
wxT("CloseDown"))
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
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()
~EffectInstanceEx() override
virtual ~EffectInstanceFactory()
virtual size_t GetTailSize() const
virtual bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
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 SampleCount GetLatency(const EffectSettings &settings, double sampleRate) const
virtual std::unique_ptr< Message > MakeMessage() const
Called on the main thread, in which the result may be cloned.
uint64_t SampleCount
virtual bool RealtimeProcessStart(MessagePackage &package)
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)
size_t SetBlockSize(size_t maxBlockSize) override
~EffectInstanceWithBlockSize() override
size_t GetBlockSize() const override
Hold values to send to effect output meters.
virtual ~EffectOutputs()
Type of messages to send from main thread to processing.
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 std::unique_ptr< EffectOutputs > MakeOutputs() const
Produce an object to hold values to send to effect output meters.
virtual EffectSettings MakeSettings() const
EffectUIClientInterface is an abstract base class to populate a UI and validate UI values....
virtual bool CloseUI()=0
virtual ~EffectUIClientInterface()
virtual bool IsGraphicalUI()
virtual void OnClose()
EffectUIValidator(EffectUIClientInterface &effect, EffectSettingsAccess &access)
virtual bool UpdateUI()
Update appearance of the panel for changes in settings.
virtual ~EffectUIValidator()
virtual void Disconnect()
On the first call only, may disconnect from further event handling.
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 Flush() override
Make the last Set changes "persistent" in underlying storage.
bool IsSameAs(const EffectSettingsAccess &other) const override
const EffectSettings & Get() override
~SimpleEffectSettingsAccess() override
void Set(EffectSettings &&settings, std::unique_ptr< Message > pMessage) override
STL namespace.
Externalized state of a plug-in.