29#include <wx/weakref.h>
32#include "../widgets/valnum.h"
118 auto result = std::make_unique<Editor>(*
this, access, myEffSettings);
119 result->PopulateOrExchange(
S);
125 mUIParent =
S.GetParent();
126 auto& ms = mSettings;
131 S.StartMultiColumn(3, wxEXPAND);
136 .Validator<FloatingPointValidator<double>>(
137 5, &ms.mFreq, NumValidatorStyle::ONE_TRAILING_ZERO,
Freq.
min,
Freq.
max)
138 .AddTextBox(
XXO(
"LFO Freq&uency (Hz):"), L
"", 12);
142 .Name(
XO(
"LFO frequency in hertz"))
143 .Style(wxSL_HORIZONTAL)
144 .MinSize( { 100, -1 } )
149 .Validator<FloatingPointValidator<double>>(
151 .AddTextBox(
XXO(
"LFO Sta&rt Phase (deg.):"), L
"", 12);
155 .Name(
XO(
"LFO start phase in degrees"))
156 .Style(wxSL_HORIZONTAL)
157 .MinSize( { 100, -1 } )
159 mPhaseS->SetLineSize(10);
163 .Validator<IntegerValidator<int>>(
165 .AddTextBox(
XXO(
"Dept&h (%):"), L
"", 12);
169 .Name(
XO(
"Depth in percent"))
170 .Style(wxSL_HORIZONTAL)
171 .MinSize( { 100, -1 } )
176 .Validator<FloatingPointValidator<double>>(
177 1, &ms.mRes, NumValidatorStyle::DEFAULT,
Res.
min,
Res.
max)
178 .AddTextBox(
XXO(
"Reso&nance:"), L
"", 12);
182 .Name(
XO(
"Resonance"))
183 .Style(wxSL_HORIZONTAL)
184 .MinSize( { 100, -1 } )
189 .Validator<IntegerValidator<int>>(
191 .AddTextBox(
XXO(
"Wah Frequency Offse&t (%):"), L
"", 12);
195 .Name(
XO(
"Wah frequency offset in percent"))
196 .Style(wxSL_HORIZONTAL)
197 .MinSize( { 100, -1 } )
202 .Validator<FloatingPointValidator<double>>(
204 .AddTextBox(
XXO(
"&Output gain (dB):"), L
"", 12);
208 .Name(
XO(
"Output gain (dB)"))
209 .Style(wxSL_HORIZONTAL)
210 .MinSize( { 100, -1 } )
220 const auto&
settings = mAccess.Get();
224 auto& ms = mSettings;
226 mFreqS->SetValue((
int)(ms.mFreq *
Freq.
scale));
227 mPhaseS->SetValue((
int)(ms.mPhase *
Phase.
scale));
228 mDepthS->SetValue((
int)(ms.mDepth *
Depth.
scale));
229 mResS->SetValue((
int)(ms.mRes *
Res.
scale));
230 mFreqOfsS->SetValue((
int)(ms.mFreqOfs *
FreqOfs.
scale));
231 mOutGainS->SetValue((
int)(ms.mOutGain *
OutGain.
scale));
238 auto& ms = mSettings;
240 ms.mFreq = (double)evt.GetInt() /
Freq.
scale;
241 mFreqT->GetValidator()->TransferToWindow();
243 EnableApplyFromValidate();
250 auto& ms = mSettings;
252 int val = ((evt.GetInt() + 5) / 10) * 10;
254 mPhaseS->SetValue(val);
256 mPhaseT->GetValidator()->TransferToWindow();
258 EnableApplyFromValidate();
265 auto& ms = mSettings;
268 mDepthT->GetValidator()->TransferToWindow();
270 EnableApplyFromValidate();
277 auto& ms = mSettings;
279 ms.mRes = (double)evt.GetInt() /
Res.
scale;
280 mResT->GetValidator()->TransferToWindow();
282 EnableApplyFromValidate();
289 auto& ms = mSettings;
292 mFreqOfsT->GetValidator()->TransferToWindow();
294 EnableApplyFromValidate();
301 auto& ms = mSettings;
304 mOutGainT->GetValidator()->TransferToWindow();
306 EnableApplyFromValidate();
313 auto& ms = mSettings;
315 if (!EnableApplyFromTransferDataToWindow())
320 mFreqS->SetValue((
int)(ms.mFreq *
Freq.
scale));
327 auto& ms = mSettings;
329 if (!EnableApplyFromTransferDataToWindow())
334 mPhaseS->SetValue((
int)(ms.mPhase *
Phase.
scale));
341 auto& ms = mSettings;
343 if (!EnableApplyFromTransferDataToWindow())
348 mDepthS->SetValue((
int)(ms.mDepth *
Depth.
scale));
355 auto& ms = mSettings;
357 if (!EnableApplyFromTransferDataToWindow())
362 mResS->SetValue((
int)(ms.mRes *
Res.
scale));
369 auto& ms = mSettings;
371 if (!EnableApplyFromTransferDataToWindow())
376 mFreqOfsS->SetValue((
int)(ms.mFreqOfs *
FreqOfs.
scale));
383 auto& ms = mSettings;
385 if (!EnableApplyFromTransferDataToWindow())
390 mOutGainS->SetValue((
int)(ms.mOutGain *
OutGain.
scale));
XXO("&Cut/Copy/Paste Toolbar")
static Settings & settings()
bool ValidateUI(const EffectPlugin &context, EffectSettings &) const override
static bool EnableApply(wxWindow *parent, bool enable=true)
Enable or disable the Apply button of the dialog that contains parent.
EffectSettingsAccess & mAccess
Performs effect computation.
Hold values to send to effect output meters.
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
virtual const EffectSettings & Get()=0
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.
static EffectWahwahSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
static constexpr EffectParameter OutGain
static constexpr EffectParameter FreqOfs
static constexpr EffectParameter Phase
static constexpr EffectParameter Freq
static constexpr EffectParameter Depth
static constexpr EffectParameter Res
BuiltinEffectsModule::Registration< EffectWahwah > reg
const Type scale
Scaling factor, for slider control.
const Type def
Default value.
const Type min
Minimum value.
const Type max
Maximum value.
Message sent by EffectEditor when a setting is changed by the user.
Externalized state of a plug-in.
void EnableApplyFromValidate()
virtual ~Editor()=default
void OnFreqOffText(wxCommandEvent &evt)
Editor(const EffectUIServices &services, EffectSettingsAccess &access, const EffectWahwahSettings &settings)
void OnResonanceSlider(wxCommandEvent &evt)
void OnGainSlider(wxCommandEvent &evt)
void OnFreqOffSlider(wxCommandEvent &evt)
EffectWahwahSettings mSettings
bool UpdateUI() override
Update appearance of the panel for changes in settings.
bool EnableApplyFromTransferDataToWindow()
void OnPhaseSlider(wxCommandEvent &evt)
void OnFreqSlider(wxCommandEvent &evt)
void OnDepthSlider(wxCommandEvent &evt)
void OnDepthText(wxCommandEvent &evt)
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
void OnFreqText(wxCommandEvent &evt)
void OnGainText(wxCommandEvent &evt)
void PopulateOrExchange(ShuttleGui &S)
void OnResonanceText(wxCommandEvent &evt)
void OnPhaseText(wxCommandEvent &evt)
wxWeakRef< wxWindow > mUIParent