20#include "../widgets/valnum.h"
21#include <wx/weakref.h>
97 auto result = std::make_unique<Editor>(*
this, access, myEffSettings);
98 result->PopulateOrExchange(
S);
110 S.StartMultiColumn(3, wxEXPAND);
115 .Validator<IntegerValidator<int>>(
117 .AddTextBox(
XXO(
"&Stages:"), L
"", 15);
122 .Style(wxSL_HORIZONTAL)
123 .MinSize( { 100, -1 } )
129 .Validator<IntegerValidator<int>>(
131 .AddTextBox(
XXO(
"&Dry/Wet:"), L
"", 15);
136 .Style(wxSL_HORIZONTAL)
137 .MinSize( { 100, -1 } )
142 .Validator<FloatingPointValidator<double>>(
143 5, &ms.mFreq, NumValidatorStyle::ONE_TRAILING_ZERO,
Freq.
min,
Freq.
max)
144 .AddTextBox(
XXO(
"LFO Freq&uency (Hz):"), L
"", 15);
148 .Name(
XO(
"LFO frequency in hertz"))
149 .Style(wxSL_HORIZONTAL)
150 .MinSize( { 100, -1 } )
155 .Validator<FloatingPointValidator<double>>(
157 .AddTextBox(
XXO(
"LFO Sta&rt Phase (deg.):"), L
"", 15);
161 .Name(
XO(
"LFO start phase in degrees"))
162 .Style(wxSL_HORIZONTAL)
163 .MinSize( { 100, -1 } )
169 .Validator<IntegerValidator<int>>(
171 .AddTextBox(
XXO(
"Dept&h:"), L
"", 15);
175 .Name(
XO(
"Depth in percent"))
176 .Style(wxSL_HORIZONTAL)
177 .MinSize( { 100, -1 } )
182 .Validator<IntegerValidator<int>>(
184 .AddTextBox(
XXO(
"Feedbac&k (%):"), L
"", 15);
188 .Name(
XO(
"Feedback in percent"))
189 .Style(wxSL_HORIZONTAL)
190 .MinSize( { 100, -1 } )
196 .Validator<FloatingPointValidator<double>>(
198 .AddTextBox(
XXO(
"&Output gain (dB):"), L
"", 12);
202 .Name(
XO(
"Output gain (dB)"))
203 .Style(wxSL_HORIZONTAL)
204 .MinSize( { 100, -1 } )
215 const auto&
settings = mAccess.Get();
219 if (!mUIParent->TransferDataToWindow())
224 mStagesS-> SetValue((
int) (mSettings.mStages *
Stages.
scale));
225 mDryWetS-> SetValue((
int) (mSettings.mDryWet *
DryWet.
scale));
226 mFreqS-> SetValue((
int) (mSettings.mFreq *
Freq.
scale));
227 mPhaseS-> SetValue((
int) (mSettings.mPhase *
Phase.
scale));
228 mDepthS-> SetValue((
int) (mSettings.mDepth *
Depth.
scale));
229 mFeedbackS->SetValue((
int) (mSettings.mFeedback *
Feedback.
scale));
230 mOutGainS-> SetValue((
int) (mSettings.mOutGain *
OutGain.
scale));
239 if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
244 auto& ms = mSettings;
249 mStagesT->GetValidator()->TransferToWindow();
252 mAccess.ModifySettings
268 auto& ms = mSettings;
271 mStagesT->GetValidator()->TransferToWindow();
272 EnableApplyFromValidate();
280 auto& ms = mSettings;
283 mDryWetT->GetValidator()->TransferToWindow();
284 EnableApplyFromValidate();
292 auto& ms = mSettings;
294 ms.mFreq = (double) evt.GetInt() /
Freq.
scale;
296 mFreqT->GetValidator()->TransferToWindow();
297 EnableApplyFromValidate();
305 auto& ms = mSettings;
307 int val = ((evt.GetInt() + 5) / 10) * 10;
309 mPhaseS->SetValue(val);
311 mPhaseT->GetValidator()->TransferToWindow();
312 EnableApplyFromValidate();
320 auto& ms = mSettings;
323 mDepthT->GetValidator()->TransferToWindow();
324 EnableApplyFromValidate();
332 auto& ms = mSettings;
334 int val = evt.GetInt();
335 val = ((val + (val > 0 ? 5 : -5)) / 10) * 10;
337 mFeedbackS->SetValue(val);
339 mFeedbackT->GetValidator()->TransferToWindow();
340 EnableApplyFromValidate();
348 auto& ms = mSettings;
351 mOutGainT->GetValidator()->TransferToWindow();
352 EnableApplyFromValidate();
360 auto& ms = mSettings;
362 if (!EnableApplyFromTransferDataFromWindow())
367 mStagesS->SetValue((
int) (ms.mStages *
Stages.
scale));
375 auto& ms = mSettings;
377 if (!EnableApplyFromTransferDataFromWindow())
382 mDryWetS->SetValue((
int) (ms.mDryWet *
DryWet.
scale));
390 auto& ms = mSettings;
392 if (!EnableApplyFromTransferDataFromWindow())
397 mFreqS->SetValue((
int) (ms.mFreq *
Freq.
scale));
405 auto& ms = mSettings;
407 if (!EnableApplyFromTransferDataFromWindow())
412 mPhaseS->SetValue((
int) (ms.mPhase *
Phase.
scale));
420 auto& ms = mSettings;
422 if (!EnableApplyFromTransferDataFromWindow())
427 mDepthS->SetValue((
int) (ms.mDepth *
Depth.
scale));
435 auto& ms = mSettings;
437 if (!EnableApplyFromTransferDataFromWindow())
450 auto& ms = mSettings;
452 if (!EnableApplyFromTransferDataFromWindow())
457 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.
void BindTo(wxEvtHandler &src, const EventTag &eventType, void(Class::*pmf)(Event &))
Performs effect computation.
Hold values to send to effect output meters.
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.
virtual const EffectSettings & Get()=0
static EffectPhaserSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
static constexpr EffectParameter Depth
static constexpr EffectParameter DryWet
static constexpr EffectParameter Feedback
static constexpr EffectParameter Freq
static constexpr EffectParameter Phase
static constexpr EffectParameter Stages
static constexpr EffectParameter OutGain
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
BuiltinEffectsModule::Registration< EffectPhaser > reg
const Type scale
Scaling factor, for slider control.
const Type def
Default value.
const Type min
Minimum value.
const Type max
Maximum value.
wxWeakRef< wxWindow > mUIParent
bool EnableApplyFromTransferDataFromWindow()
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
void OnGainSlider(wxCommandEvent &evt)
bool UpdateUI() override
Update appearance of the panel for changes in settings.
void OnStagesSlider(wxCommandEvent &evt)
Editor(const EffectUIServices &services, EffectSettingsAccess &access, const EffectPhaserSettings &settings)
void OnFreqSlider(wxCommandEvent &evt)
void OnGainText(wxCommandEvent &evt)
void OnFeedbackSlider(wxCommandEvent &evt)
EffectPhaserSettings mSettings
void OnPhaseSlider(wxCommandEvent &evt)
void OnPhaseText(wxCommandEvent &evt)
void OnFeedbackText(wxCommandEvent &evt)
void OnDryWetText(wxCommandEvent &evt)
void EnableApplyFromValidate()
void OnDryWetSlider(wxCommandEvent &evt)
void OnDepthSlider(wxCommandEvent &evt)
void OnFreqText(wxCommandEvent &evt)
virtual ~Editor()=default
void OnStagesText(wxCommandEvent &evt)
void OnDepthText(wxCommandEvent &evt)
void PopulateOrExchange(ShuttleGui &S)
Message sent by EffectEditor when a setting is changed by the user.
Externalized state of a plug-in.