Audacity 3.2.0
Echo.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 Dominic Mazzoni
6 Vaughan Johnson (dialog)
7
8*******************************************************************//****************************************************************//*******************************************************************/
19
20
21#include "Echo.h"
22#include "EffectEditor.h"
23#include "LoadEffects.h"
24
25#include "ShuttleGui.h"
26#include "AudacityMessageBox.h"
27#include "../widgets/valnum.h"
28
30
31std::shared_ptr<EffectInstance> EffectEcho::MakeInstance() const
32{
33 return std::make_shared<Instance>(*this);
34}
35
38{
39 Editor(const EffectUIServices& services,
41 ) : EffectEditor{ services, access }
43 {}
44 virtual ~Editor() = default;
45
46 bool ValidateUI() override;
47 bool UpdateUI() override;
48
50
52};
53
54
55
56std::unique_ptr<EffectEditor> EffectEcho::MakeEditor(
58 const EffectOutputs *) const
59{
60 auto& settings = access.Get();
61 auto& myEffSettings = GetSettings(settings);
62 auto result = std::make_unique<Editor>(*this, access, myEffSettings);
63 result->PopulateOrExchange(S);
64 return result;
65}
66
67
69{
70 auto& echoSettings = mSettings;
71
72 S.AddSpace(0, 5);
73
74 S.StartMultiColumn(2, wxALIGN_CENTER);
75 {
76 S.Validator<FloatingPointValidator<double>>(
77 3, &echoSettings.delay, NumValidatorStyle::NO_TRAILING_ZEROES,
79 .AddTextBox(XXO("&Delay time (seconds):"), L"", 10);
80
81 S.Validator<FloatingPointValidator<double>>(
82 3, &echoSettings.decay, NumValidatorStyle::NO_TRAILING_ZEROES,
84 .AddTextBox(XXO("D&ecay factor:"), L"", 10);
85 }
86 S.EndMultiColumn();
87}
88
89
91{
92 mAccess.ModifySettings
93 (
95 {
96 // pass back the modified settings to the MessageBuffer
97
99 return nullptr;
100 }
101 );
102
103 return true;
104}
105
106
108{
109 // get the settings from the MessageBuffer and write them to our local copy
110 const auto& settings = mAccess.Get();
111
112 mSettings = GetSettings(settings);
113
114 return true;
115}
116
XXO("&Cut/Copy/Paste Toolbar")
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:51
static constexpr EffectParameter Decay
Definition: EchoBase.h:102
static constexpr EffectParameter Delay
Definition: EchoBase.h:96
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
Definition: Echo.cpp:31
std::unique_ptr< EffectEditor > MakeEditor(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
Called only from PopulateUI, to add controls to effect panel.
Definition: Echo.cpp:56
Performs effect computation.
Hold values to send to effect output meters.
virtual const EffectSettings & Get()=0
static EchoSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Definition: Effect.h:166
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
BuiltinEffectsModule::Registration< EffectEcho > reg
Definition: Echo.cpp:29
void PopulateOrExchange(ShuttleGui &S)
Definition: Echo.cpp:68
EchoSettings mSettings
Definition: Echo.cpp:51
bool UpdateUI() override
Update appearance of the panel for changes in settings.
Definition: Echo.cpp:107
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
Definition: Echo.cpp:90
Editor(const EffectUIServices &services, EffectSettingsAccess &access, const EchoSettings &settings)
Definition: Echo.cpp:39
virtual ~Editor()=default
const Type min
Minimum value.
const Type max
Maximum value.
Externalized state of a plug-in.