Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
EffectDistortion::Editor Struct Reference
Inheritance diagram for EffectDistortion::Editor:
[legend]
Collaboration diagram for EffectDistortion::Editor:
[legend]

Public Member Functions

 Editor (const EffectUIServices &services, DistortionBase::Instance &instance, EffectSettingsAccess &access, const EffectDistortionSettings &settings)
 
virtual ~Editor ()=default
 
bool ValidateUI () override
 Get settings data from the panel; may make error dialogs and return false. More...
 
bool UpdateUI () override
 Update appearance of the panel for changes in settings. More...
 
void PopulateOrExchange (ShuttleGui &S)
 
void OnTypeChoice (wxCommandEvent &evt)
 
void OnDCBlockCheckbox (wxCommandEvent &evt)
 
void OnThresholdText (wxCommandEvent &evt)
 
void OnThresholdSlider (wxCommandEvent &evt)
 
void OnNoiseFloorText (wxCommandEvent &evt)
 
void OnNoiseFloorSlider (wxCommandEvent &evt)
 
void OnParam1Text (wxCommandEvent &evt)
 
void OnParam1Slider (wxCommandEvent &evt)
 
void OnParam2Text (wxCommandEvent &evt)
 
void OnParam2Slider (wxCommandEvent &evt)
 
void OnRepeatsText (wxCommandEvent &evt)
 
void OnRepeatsSlider (wxCommandEvent &evt)
 
EffectDistortionStateGetState ()
 
void UpdateControl (control id, bool enable, TranslatableString name)
 
void UpdateUIControls ()
 
void UpdateControlText (wxTextCtrl *textCtrl, wxString &string, bool enabled)
 
- Public Member Functions inherited from EffectEditor
 EffectEditor (const EffectUIServices &services, EffectSettingsAccess &access)
 
virtual ~EffectEditor ()
 
virtual bool ValidateUI ()=0
 Get settings data from the panel; may make error dialogs and return false. More...
 
virtual bool UpdateUI ()
 Update appearance of the panel for changes in settings. More...
 
virtual bool IsGraphicalUI ()
 
virtual void Disconnect ()
 On the first call only, may disconnect from further event handling. More...
 
virtual void OnClose ()
 
- Public Member Functions inherited from Observer::Publisher< EffectSettingChanged >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 

Public Attributes

wxChoice * mTypeChoiceCtrl
 
wxTextCtrl * mThresholdT
 
wxTextCtrl * mNoiseFloorT
 
wxTextCtrl * mParam1T
 
wxTextCtrl * mParam2T
 
wxTextCtrl * mRepeatsT
 
wxSlider * mThresholdS
 
wxSlider * mNoiseFloorS
 
wxSlider * mParam1S
 
wxSlider * mParam2S
 
wxSlider * mRepeatsS
 
wxCheckBox * mDCBlockCheckBox
 
wxStaticText * mThresholdTxt
 
wxStaticText * mNoiseFloorTxt
 
wxStaticText * mParam1Txt
 
wxStaticText * mParam2Txt
 
wxStaticText * mRepeatsTxt
 
wxString mOldThresholdTxt
 
wxString mOldmNoiseFloorTxt
 
wxString mOldParam1Txt
 
wxString mOldParam2Txt
 
wxString mOldRepeatsTxt
 
EffectDistortionSettings mSettings
 
wxWeakRef< wxWindow > mUIParent {}
 
DistortionBase::InstancemInstance
 

Additional Inherited Members

- Public Types inherited from Observer::Publisher< EffectSettingChanged >
using message_type = EffectSettingChanged
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const EffectSettingChanged &) >
 Type of functions that can be connected to the Publisher. More...
 
- Static Public Member Functions inherited from EffectEditor
static bool EnableApply (wxWindow *parent, bool enable=true)
 Enable or disable the Apply button of the dialog that contains parent. More...
 
static bool EnablePreview (wxWindow *parent, bool enable=true)
 
- Static Public Attributes inherited from EffectEditor
static constexpr int kPlayID = 20102
 
- Static Public Attributes inherited from Observer::Publisher< EffectSettingChanged >
static constexpr bool notifies_all
 
- Protected Member Functions inherited from EffectEditor
template<typename EventTag , typename Class , typename Event >
void BindTo (wxEvtHandler &src, const EventTag &eventType, void(Class::*pmf)(Event &))
 
- Protected Member Functions inherited from Observer::Publisher< EffectSettingChanged >
CallbackReturn Publish (const EffectSettingChanged &message)
 Send a message to connected callbacks. More...
 
- Protected Attributes inherited from EffectEditor
const EffectUIServicesmUIServices
 
EffectSettingsAccessmAccess
 
bool mUIClosed { false }
 

Detailed Description

Definition at line 60 of file Distortion.cpp.

Constructor & Destructor Documentation

◆ Editor()

EffectDistortion::Editor::Editor ( const EffectUIServices services,
DistortionBase::Instance instance,
EffectSettingsAccess access,
const EffectDistortionSettings settings 
)
inline

Definition at line 63 of file Distortion.cpp.

66 : EffectEditor{ services, access }
67 , mInstance(instance)
69 {}
static Settings & settings()
Definition: TrackInfo.cpp:51
DistortionBase::Instance & mInstance
Definition: Distortion.cpp:127
EffectDistortionSettings mSettings
Definition: Distortion.cpp:118

◆ ~Editor()

virtual EffectDistortion::Editor::~Editor ( )
virtualdefault

Member Function Documentation

◆ GetState()

EffectDistortionState & EffectDistortion::Editor::GetState ( )

Definition at line 162 of file Distortion.cpp.

163{
164 return mInstance.mMaster;
165}
EffectDistortionState mMaster

◆ OnDCBlockCheckbox()

void EffectDistortion::Editor::OnDCBlockCheckbox ( wxCommandEvent &  evt)

Definition at line 381 of file Distortion.cpp.

382{
383 auto& ms = mSettings;
384
385 ms.mDCBlock = mDCBlockCheckBox->GetValue();
386
387 GetState().mbSavedFilterState = ms.mDCBlock;
388
389 ValidateUI();
391}
CallbackReturn Publish(const EffectSettingChanged &message)
Send a message to connected callbacks.
Definition: Observer.h:207
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
Definition: Distortion.cpp:131
wxCheckBox * mDCBlockCheckBox
Definition: Distortion.cpp:104
EffectDistortionState & GetState()
Definition: Distortion.cpp:162
Message sent by EffectEditor when a setting is changed by the user.
Definition: EffectEditor.h:26

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnNoiseFloorSlider()

void EffectDistortion::Editor::OnNoiseFloorSlider ( wxCommandEvent &  evt)

Definition at line 432 of file Distortion.cpp.

433{
434 auto& ms = mSettings;
435
436 ms.mNoiseFloor = (double) evt.GetInt();
437 mNoiseFloorT->GetValidator()->TransferToWindow();
438
439 ValidateUI();
441}
wxTextCtrl * mNoiseFloorT
Definition: Distortion.cpp:93

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnNoiseFloorText()

void EffectDistortion::Editor::OnNoiseFloorText ( wxCommandEvent &  evt)

Definition at line 421 of file Distortion.cpp.

422{
423 const auto& ms = mSettings;
424
425 mNoiseFloorT->GetValidator()->TransferFromWindow();
426 mNoiseFloorS->SetValue((int) floor(ms.mNoiseFloor + 0.5));
427
428 ValidateUI();
430}

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnParam1Slider()

void EffectDistortion::Editor::OnParam1Slider ( wxCommandEvent &  evt)

Definition at line 455 of file Distortion.cpp.

456{
457 auto& ms = mSettings;
458
459 ms.mParam1 = (double) evt.GetInt();
460 mParam1T->GetValidator()->TransferToWindow();
461
462 ValidateUI();
464}

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnParam1Text()

void EffectDistortion::Editor::OnParam1Text ( wxCommandEvent &  evt)

Definition at line 444 of file Distortion.cpp.

445{
446 const auto& ms = mSettings;
447
448 mParam1T->GetValidator()->TransferFromWindow();
449 mParam1S->SetValue((int) floor(ms.mParam1 + 0.5));
450
451 ValidateUI();
453}

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnParam2Slider()

void EffectDistortion::Editor::OnParam2Slider ( wxCommandEvent &  evt)

Definition at line 477 of file Distortion.cpp.

478{
479 auto& ms = mSettings;
480
481 ms.mParam2 = (double) evt.GetInt();
482 mParam2T->GetValidator()->TransferToWindow();
483
484 ValidateUI();
486}

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnParam2Text()

void EffectDistortion::Editor::OnParam2Text ( wxCommandEvent &  evt)

Definition at line 466 of file Distortion.cpp.

467{
468 const auto& ms = mSettings;
469
470 mParam2T->GetValidator()->TransferFromWindow();
471 mParam2S->SetValue((int) floor(ms.mParam2 + 0.5));
472
473 ValidateUI();
475}

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnRepeatsSlider()

void EffectDistortion::Editor::OnRepeatsSlider ( wxCommandEvent &  evt)

Definition at line 499 of file Distortion.cpp.

500{
501 auto& ms = mSettings;
502
503 ms.mRepeats = evt.GetInt();
504 mRepeatsT->GetValidator()->TransferToWindow();
505
506 ValidateUI();
508}

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnRepeatsText()

void EffectDistortion::Editor::OnRepeatsText ( wxCommandEvent &  evt)

Definition at line 488 of file Distortion.cpp.

489{
490 const auto& ms = mSettings;
491
492 mRepeatsT->GetValidator()->TransferFromWindow();
493 mRepeatsS->SetValue(ms.mRepeats);
494
495 ValidateUI();
497}

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnThresholdSlider()

void EffectDistortion::Editor::OnThresholdSlider ( wxCommandEvent &  evt)

Definition at line 406 of file Distortion.cpp.

407{
408 auto& ms = mSettings;
409
410 static const double MIN_Threshold_Linear = DB_TO_LINEAR(Threshold_dB.min);
411
412 const double thresholdDB = (double)evt.GetInt() / Threshold_dB.scale;
413 ms.mThreshold_dB = wxMax(LINEAR_TO_DB(thresholdDB), Threshold_dB.min);
414
415 mThresholdT->GetValidator()->TransferToWindow();
416
417 ValidateUI();
419}
#define LINEAR_TO_DB(x)
Definition: MemoryX.h:339
#define DB_TO_LINEAR(x)
Definition: MemoryX.h:338
static constexpr EffectParameter Threshold_dB
wxTextCtrl * mThresholdT
Definition: Distortion.cpp:92
const Type scale
Scaling factor, for slider control.
const Type min
Minimum value.

References DB_TO_LINEAR, LINEAR_TO_DB, EffectParameter< Structure, Member, Type, Value >::min, EffectParameter< Structure, Member, Type, Value >::scale, DistortionBase::Threshold_dB, and BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnThresholdText()

void EffectDistortion::Editor::OnThresholdText ( wxCommandEvent &  evt)

Definition at line 394 of file Distortion.cpp.

395{
396 const auto& ms = mSettings;
397
398 mThresholdT->GetValidator()->TransferFromWindow();
399 const double threshold = DB_TO_LINEAR(ms.mThreshold_dB);
400 mThresholdS->SetValue((int) (threshold * Threshold_dB.scale + 0.5));
401
402 ValidateUI();
404}

References DB_TO_LINEAR, EffectParameter< Structure, Member, Type, Value >::scale, DistortionBase::Threshold_dB, and BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTypeChoice()

void EffectDistortion::Editor::OnTypeChoice ( wxCommandEvent &  evt)

Definition at line 371 of file Distortion.cpp.

372{
373 mTypeChoiceCtrl->GetValidator()->TransferFromWindow();
374
376
377 ValidateUI();
379}

References BasicEffectUIServices::ValidateUI().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PopulateOrExchange()

void EffectDistortion::Editor::PopulateOrExchange ( ShuttleGui S)

Definition at line 182 of file Distortion.cpp.

183{
184 mUIParent = S.GetParent();
185 auto& ms = mSettings;
186
187 S.AddSpace(0, 5);
188 S.StartVerticalLay();
189 {
190 S.StartMultiColumn(4, wxCENTER);
191 {
193 .MinSize( { -1, -1 } )
194 .Validator<wxGenericValidator>(&ms.mTableChoiceIndx)
195 .AddChoice(XXO("Distortion type:"),
197
199
200 mDCBlockCheckBox = S.AddCheckBox(XXO("DC blocking filter"),
201 DCBlock.def);
202
204 }
205 S.EndMultiColumn();
206 S.AddSpace(0, 10);
207
208
209 S.StartStatic(XO("Threshold controls"));
210 {
211 S.StartMultiColumn(4, wxEXPAND);
212 S.SetStretchyCol(2);
213 {
214 // Allow space for first Column
215 S.AddSpace(250,0); S.AddSpace(0,0); S.AddSpace(0,0); S.AddSpace(0,0);
216
217 // Upper threshold control
218 mThresholdTxt = S.AddVariableText(defaultLabel(0),
219 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
220 mThresholdT = S
221 .Name(defaultLabel(0))
222 .Validator<FloatingPointValidator<double>>(
223 2, &ms.mThreshold_dB, NumValidatorStyle::DEFAULT,
225 .AddTextBox( {}, wxT(""), 10);
226
228
229 mThresholdS = S
230 .Name(defaultLabel(0))
231 .Style(wxSL_HORIZONTAL)
232 .AddSlider( {}, 0,
235 S.AddSpace(20, 0);
236
238
239 // Noise floor control
240 mNoiseFloorTxt = S.AddVariableText(defaultLabel(1),
241 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
243 .Name(defaultLabel(1))
244 .Validator<FloatingPointValidator<double>>(
245 2, &ms.mNoiseFloor, NumValidatorStyle::DEFAULT,
247 )
248 .AddTextBox( {}, wxT(""), 10);
249
251
253 .Name(defaultLabel(1))
254 .Style(wxSL_HORIZONTAL)
255 .AddSlider( {}, 0, NoiseFloor.max, NoiseFloor.min);
256 S.AddSpace(20, 0);
257
259 }
260 S.EndMultiColumn();
261 }
262 S.EndStatic();
263
264 S.StartStatic(XO("Parameter controls"));
265 {
266 S.StartMultiColumn(4, wxEXPAND);
267 S.SetStretchyCol(2);
268 {
269 // Allow space for first Column
270 S.AddSpace(250,0); S.AddSpace(0,0); S.AddSpace(0,0); S.AddSpace(0,0);
271
272 // Parameter1 control
273 mParam1Txt = S.AddVariableText(defaultLabel(2),
274 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
275 mParam1T = S
276 .Name(defaultLabel(2))
277 .Validator<FloatingPointValidator<double>>(
278 2, &ms.mParam1, NumValidatorStyle::DEFAULT,
280 )
281 .AddTextBox( {}, wxT(""), 10);
282
283 BindTo(*mParam1T, wxEVT_TEXT, &Editor::OnParam1Text);
284
285 mParam1S = S
286 .Name(defaultLabel(2))
287 .Style(wxSL_HORIZONTAL)
288 .AddSlider( {}, 0, Param1.max, Param1.min);
289 S.AddSpace(20, 0);
290
291 BindTo(*mParam1S, wxEVT_SLIDER, &Editor::OnParam1Slider);
292
293 // Parameter2 control
294 mParam2Txt = S.AddVariableText(defaultLabel(3),
295 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
296 mParam2T = S
297 .Name(defaultLabel(3))
298 .Validator<FloatingPointValidator<double>>(
299 2, &ms.mParam2, NumValidatorStyle::DEFAULT,
301 )
302 .AddTextBox( {}, wxT(""), 10);
303
304 BindTo(*mParam2T, wxEVT_TEXT, &Editor::OnParam2Text);
305
306 mParam2S = S
307 .Name(defaultLabel(3))
308 .Style(wxSL_HORIZONTAL)
309 .AddSlider( {}, 0, Param2.max, Param2.min);
310
311 BindTo(*mParam2S, wxEVT_SLIDER, &Editor::OnParam2Slider);
312
313 S.AddSpace(20, 0);
314
315 // Repeats control
316 mRepeatsTxt = S.AddVariableText(defaultLabel(4),
317 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
318 mRepeatsT = S
319 .Name(defaultLabel(4))
320 .Validator<IntegerValidator<int>>(
321 &ms.mRepeats, NumValidatorStyle::DEFAULT,
323 )
324 .AddTextBox( {}, wxT(""), 10);
325
326 BindTo(*mRepeatsT, wxEVT_TEXT, &Editor::OnRepeatsText);
327
328 mRepeatsS = S
329 .Name(defaultLabel(4))
330 .Style(wxSL_HORIZONTAL)
331 .AddSlider( {}, Repeats.def, Repeats.max, Repeats.min);
332
333 BindTo(*mRepeatsS, wxEVT_SLIDER, &Editor::OnRepeatsSlider);
334
335 S.AddSpace(20, 0);
336 }
337 S.EndMultiColumn();
338 }
339 S.EndStatic();
340 }
341 S.EndVerticalLay();
342
343}
wxT("CloseDown"))
TranslatableString defaultLabel(int index)
Definition: Distortion.cpp:40
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
#define S(N)
Definition: ToChars.cpp:64
static constexpr EffectParameter DCBlock
static const EnumValueSymbol kTableTypeStrings[nTableTypes]
static constexpr EffectParameter NoiseFloor
static constexpr EffectParameter Repeats
static constexpr EffectParameter Param1
static constexpr EffectParameter Param2
void BindTo(wxEvtHandler &src, const EventTag &eventType, void(Class::*pmf)(Event &))
Definition: EffectEditor.h:85
A Validator is an object which checks whether a wxVariant satisfies a certain criterion....
Definition: Validators.h:54
wxStaticText * mRepeatsTxt
Definition: Distortion.cpp:110
void OnParam2Text(wxCommandEvent &evt)
Definition: Distortion.cpp:466
void OnRepeatsText(wxCommandEvent &evt)
Definition: Distortion.cpp:488
void OnRepeatsSlider(wxCommandEvent &evt)
Definition: Distortion.cpp:499
void OnTypeChoice(wxCommandEvent &evt)
Definition: Distortion.cpp:371
wxStaticText * mThresholdTxt
Definition: Distortion.cpp:106
void OnDCBlockCheckbox(wxCommandEvent &evt)
Definition: Distortion.cpp:381
wxStaticText * mParam2Txt
Definition: Distortion.cpp:109
void OnNoiseFloorText(wxCommandEvent &evt)
Definition: Distortion.cpp:421
wxWeakRef< wxWindow > mUIParent
Definition: Distortion.cpp:126
void OnParam2Slider(wxCommandEvent &evt)
Definition: Distortion.cpp:477
void OnThresholdText(wxCommandEvent &evt)
Definition: Distortion.cpp:394
void OnParam1Slider(wxCommandEvent &evt)
Definition: Distortion.cpp:455
void OnParam1Text(wxCommandEvent &evt)
Definition: Distortion.cpp:444
wxStaticText * mParam1Txt
Definition: Distortion.cpp:108
void OnThresholdSlider(wxCommandEvent &evt)
Definition: Distortion.cpp:406
wxStaticText * mNoiseFloorTxt
Definition: Distortion.cpp:107
void OnNoiseFloorSlider(wxCommandEvent &evt)
Definition: Distortion.cpp:432
const Type def
Default value.
const Type max
Maximum value.

References DB_TO_LINEAR, DistortionBase::DCBlock, EffectParameter< Structure, Member, Type, Value >::def, defaultLabel(), DistortionBase::kTableTypeStrings, EffectParameter< Structure, Member, Type, Value >::max, EffectParameter< Structure, Member, Type, Value >::min, Msgids(), DistortionBase::NoiseFloor, DistortionBase::nTableTypes, OnDCBlockCheckbox(), OnNoiseFloorSlider(), OnNoiseFloorText(), OnParam1Slider(), OnParam1Text(), OnParam2Slider(), OnParam2Text(), OnRepeatsSlider(), OnRepeatsText(), OnThresholdSlider(), OnThresholdText(), OnTypeChoice(), DistortionBase::Param1, DistortionBase::Param2, DistortionBase::Repeats, S, EffectParameter< Structure, Member, Type, Value >::scale, DistortionBase::Threshold_dB, wxT(), XO(), and XXO().

Here is the call graph for this function:

◆ UpdateControl()

void EffectDistortion::Editor::UpdateControl ( control  id,
bool  enable,
TranslatableString  name 
)

Definition at line 682 of file Distortion.cpp.

684{
685 auto& ms = mSettings;
686
687 auto suffix = XO("(Not Used):");
688 switch (id)
689 {
690 case ID_Threshold: {
691 /* i18n-hint: Control range. */
692 if (enabled) suffix = XO("(-100 to 0 dB):");
693 name.Join( suffix, wxT(" ") );
694
695 // Logarithmic slider is set indirectly
696 const double threshold = DB_TO_LINEAR(ms.mThreshold_dB);
697 mThresholdS->SetValue((int) (threshold * Threshold_dB.scale + 0.5));
698
699 auto translated = name.Translation();
700 mThresholdTxt->SetLabel(translated);
701 mThresholdS->SetName(translated);
702 mThresholdT->SetName(translated);
703 mThresholdS->Enable(enabled);
704 mThresholdT->Enable(enabled);
705 break;
706 }
707 case ID_NoiseFloor: {
708 /* i18n-hint: Control range. */
709 if (enabled) suffix = XO("(-80 to -20 dB):");
710 name.Join( suffix, wxT(" ") );
711
712 auto translated = name.Translation();
713 mNoiseFloorTxt->SetLabel(translated);
714 mNoiseFloorS->SetName(translated);
715 mNoiseFloorT->SetName(translated);
716 mNoiseFloorS->Enable(enabled);
717 mNoiseFloorT->Enable(enabled);
718 break;
719 }
720 case ID_Param1: {
721 /* i18n-hint: Control range. */
722 if (enabled) suffix = XO("(0 to 100):");
723 name.Join( suffix, wxT(" ") );
724
725 auto translated = name.Translation();
726 mParam1Txt->SetLabel(translated);
727 mParam1S->SetName(translated);
728 mParam1T->SetName(translated);
729 mParam1S->Enable(enabled);
730 mParam1T->Enable(enabled);
731 break;
732 }
733 case ID_Param2: {
734 /* i18n-hint: Control range. */
735 if (enabled) suffix = XO("(0 to 100):");
736 name.Join( suffix, wxT(" ") );
737
738 auto translated = name.Translation();
739 mParam2Txt->SetLabel(translated);
740 mParam2S->SetName(translated);
741 mParam2T->SetName(translated);
742 mParam2S->Enable(enabled);
743 mParam2T->Enable(enabled);
744 break;
745 }
746 case ID_Repeats: {
747 /* i18n-hint: Control range. */
748 if (enabled) suffix = XO("(0 to 5):");
749 name.Join( suffix, wxT(" ") );
750
751 auto translated = name.Translation();
752 mRepeatsTxt->SetLabel(translated);
753 mRepeatsS->SetName(translated);
754 mRepeatsT->SetName(translated);
755 mRepeatsS->Enable(enabled);
756 mRepeatsT->Enable(enabled);
757 break;
758 }
759 case ID_DCBlock: {
760 if (enabled) {
761 mDCBlockCheckBox->SetValue(GetState().mbSavedFilterState);
762 ms.mDCBlock = GetState().mbSavedFilterState;
763 }
764 else {
765 mDCBlockCheckBox->SetValue(false);
766 ms.mDCBlock = false;
767 }
768
769 mDCBlockCheckBox->Enable(enabled);
770 break;
771 }
772 default:
773 break;
774 }
775}
wxString name
Definition: TagsEditor.cpp:166

References DB_TO_LINEAR, EffectDistortion::ID_DCBlock, EffectDistortion::ID_NoiseFloor, EffectDistortion::ID_Param1, EffectDistortion::ID_Param2, EffectDistortion::ID_Repeats, EffectDistortion::ID_Threshold, name, EffectParameter< Structure, Member, Type, Value >::scale, DistortionBase::Threshold_dB, wxT(), and XO().

Here is the call graph for this function:

◆ UpdateControlText()

void EffectDistortion::Editor::UpdateControlText ( wxTextCtrl *  textCtrl,
wxString &  string,
bool  enabled 
)

Definition at line 777 of file Distortion.cpp.

778{
779 if (enabled) {
780 if (textCtrl->GetValue().empty())
781 textCtrl->SetValue(string);
782 else
783 string = textCtrl->GetValue();
784 }
785 else {
786 if (!textCtrl->GetValue().empty())
787 string = textCtrl->GetValue();
788 textCtrl->SetValue(wxT(""));
789 }
790}

References wxT().

Here is the call graph for this function:

◆ UpdateUI()

bool EffectDistortion::Editor::UpdateUI ( )
overridevirtual

Update appearance of the panel for changes in settings.

Default implementation does nothing, returns true

Returns
true if successful

Reimplemented from EffectEditor.

Definition at line 346 of file Distortion.cpp.

347{
348 const auto& ms = mSettings;
349
350 if (!mUIParent->TransferDataToWindow())
351 {
352 return false;
353 }
354
355 const double threshold = DB_TO_LINEAR(ms.mThreshold_dB);
356
357 mThresholdS-> SetValue((int) (threshold * Threshold_dB.scale + 0.5));
358 mDCBlockCheckBox->SetValue( ms.mDCBlock);
359 mNoiseFloorS-> SetValue((int)ms.mNoiseFloor + 0.5);
360 mParam1S-> SetValue((int)ms.mParam1 + 0.5);
361 mParam2S-> SetValue((int)ms.mParam2 + 0.5);
362 mRepeatsS-> SetValue( ms.mRepeats);
363
364 GetState().mbSavedFilterState = ms.mDCBlock;
365
367
368 return true;
369}

References DB_TO_LINEAR, EffectParameter< Structure, Member, Type, Value >::scale, and DistortionBase::Threshold_dB.

◆ UpdateUIControls()

void EffectDistortion::Editor::UpdateUIControls ( )

Definition at line 510 of file Distortion.cpp.

511{
512 const auto& ms = mSettings;
513
514 // set control text and names to match distortion type
515 switch (ms.mTableChoiceIndx)
516 {
517 case kHardClip:
523
524 UpdateControl(ID_Threshold, true, XO("Clipping level"));
526 UpdateControl(ID_Param1, true, XO("Drive"));
527 UpdateControl(ID_Param2, true, XO("Make-up Gain"));
529 UpdateControl(ID_DCBlock, false, {});
530 break;
531 case kSoftClip:
537
538 UpdateControl(ID_Threshold, true, XO("Clipping threshold"));
540 UpdateControl(ID_Param1, true, XO("Hardness"));
541 UpdateControl(ID_Param2, true, XO("Make-up Gain"));
543 UpdateControl(ID_DCBlock, false, {});
544 break;
545 case kHalfSinCurve:
551
554 UpdateControl(ID_Param1, true, XO("Distortion amount"));
555 UpdateControl(ID_Param2, true, XO("Output level"));
557 UpdateControl(ID_DCBlock, false, {});
558 break;
559 case kExpCurve:
565
568 UpdateControl(ID_Param1, true, XO("Distortion amount"));
569 UpdateControl(ID_Param2, true, XO("Output level"));
571 UpdateControl(ID_DCBlock, false, {});
572 break;
573 case kLogCurve:
579
582 UpdateControl(ID_Param1, true, XO("Distortion amount"));
583 UpdateControl(ID_Param2, true, XO("Output level"));
585 UpdateControl(ID_DCBlock, false, {});
586 break;
587 case kCubic:
593
596 UpdateControl(ID_Param1, true, XO("Distortion amount"));
597 UpdateControl(ID_Param2, true, XO("Output level"));
598 UpdateControl(ID_Repeats, true, XO("Repeat processing"));
599 UpdateControl(ID_DCBlock, false, {});
600 break;
601 case kEvenHarmonics:
607
610 UpdateControl(ID_Param1, true, XO("Distortion amount"));
611 UpdateControl(ID_Param2, true, XO("Harmonic brightness"));
613 UpdateControl(ID_DCBlock, true, {});
614 break;
615 case kSinCurve:
621
624 UpdateControl(ID_Param1, true, XO("Distortion amount"));
625 UpdateControl(ID_Param2, true, XO("Output level"));
627 UpdateControl(ID_DCBlock, false, {});
628 break;
629 case kLeveller:
635
638 UpdateControl(ID_Param1, true, XO("Levelling fine adjustment"));
640 UpdateControl(ID_Repeats, true, XO("Degree of Levelling"));
641 UpdateControl(ID_DCBlock, false, {});
642 break;
643 case kRectifier:
649
652 UpdateControl(ID_Param1, true, XO("Distortion amount"));
655 UpdateControl(ID_DCBlock, true, {});
656 break;
657 case kHardLimiter:
663
664 UpdateControl(ID_Threshold, true, XO("dB Limit"));
666 UpdateControl(ID_Param1, true, XO("Wet level"));
667 UpdateControl(ID_Param2, true, XO("Residual level"));
669 UpdateControl(ID_DCBlock, false, {});
670 break;
671 default:
677 UpdateControl(ID_DCBlock, false, {});
678 }
679}
void UpdateControl(control id, bool enable, TranslatableString name)
Definition: Distortion.cpp:682
void UpdateControlText(wxTextCtrl *textCtrl, wxString &string, bool enabled)
Definition: Distortion.cpp:777

References defaultLabel(), EffectDistortion::ID_DCBlock, EffectDistortion::ID_NoiseFloor, EffectDistortion::ID_Param1, EffectDistortion::ID_Param2, EffectDistortion::ID_Repeats, EffectDistortion::ID_Threshold, DistortionBase::kCubic, DistortionBase::kEvenHarmonics, DistortionBase::kExpCurve, DistortionBase::kHalfSinCurve, DistortionBase::kHardClip, DistortionBase::kHardLimiter, DistortionBase::kLeveller, DistortionBase::kLogCurve, DistortionBase::kRectifier, DistortionBase::kSinCurve, DistortionBase::kSoftClip, and XO().

Here is the call graph for this function:

◆ ValidateUI()

bool EffectDistortion::Editor::ValidateUI ( )
overridevirtual

Get settings data from the panel; may make error dialogs and return false.

Returns
true only if panel settings are acceptable

mUIParent()->Validate() ||

Implements EffectEditor.

Definition at line 131 of file Distortion.cpp.

132{
133 {
134 // This section was copied from the original
135 // DistortionBase::TransferDataFromWindow
136 //
137 // However, the call to ->Validate would bring up an error dialog
138 // saying "Empty value"
139
140 if ( !mUIParent->TransferDataFromWindow())
141 {
142 return false;
143 }
144 }
145
146
148 (
149 [this](EffectSettings& settings)
150 {
151 // pass back the modified settings to the MessageBuffer
152
154
155 return nullptr;
156 }
157 );
158
159 return true;
160}
EffectSettingsAccess & mAccess
Definition: EffectEditor.h:92
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
static EffectDistortionSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Definition: Effect.h:166
Externalized state of a plug-in.

References EffectWithSettings< EffectDistortionSettings, PerTrackEffect >::GetSettings(), EffectEditor::mAccess, EffectSettingsAccess::ModifySettings(), mSettings, mUIParent, and settings().

Here is the call graph for this function:

Member Data Documentation

◆ mDCBlockCheckBox

wxCheckBox* EffectDistortion::Editor::mDCBlockCheckBox

Definition at line 104 of file Distortion.cpp.

◆ mInstance

DistortionBase::Instance& EffectDistortion::Editor::mInstance

Definition at line 127 of file Distortion.cpp.

◆ mNoiseFloorS

wxSlider* EffectDistortion::Editor::mNoiseFloorS

Definition at line 99 of file Distortion.cpp.

◆ mNoiseFloorT

wxTextCtrl* EffectDistortion::Editor::mNoiseFloorT

Definition at line 93 of file Distortion.cpp.

◆ mNoiseFloorTxt

wxStaticText* EffectDistortion::Editor::mNoiseFloorTxt

Definition at line 107 of file Distortion.cpp.

◆ mOldmNoiseFloorTxt

wxString EffectDistortion::Editor::mOldmNoiseFloorTxt

Definition at line 113 of file Distortion.cpp.

◆ mOldParam1Txt

wxString EffectDistortion::Editor::mOldParam1Txt

Definition at line 114 of file Distortion.cpp.

◆ mOldParam2Txt

wxString EffectDistortion::Editor::mOldParam2Txt

Definition at line 115 of file Distortion.cpp.

◆ mOldRepeatsTxt

wxString EffectDistortion::Editor::mOldRepeatsTxt

Definition at line 116 of file Distortion.cpp.

◆ mOldThresholdTxt

wxString EffectDistortion::Editor::mOldThresholdTxt

Definition at line 112 of file Distortion.cpp.

◆ mParam1S

wxSlider* EffectDistortion::Editor::mParam1S

Definition at line 100 of file Distortion.cpp.

◆ mParam1T

wxTextCtrl* EffectDistortion::Editor::mParam1T

Definition at line 94 of file Distortion.cpp.

◆ mParam1Txt

wxStaticText* EffectDistortion::Editor::mParam1Txt

Definition at line 108 of file Distortion.cpp.

◆ mParam2S

wxSlider* EffectDistortion::Editor::mParam2S

Definition at line 101 of file Distortion.cpp.

◆ mParam2T

wxTextCtrl* EffectDistortion::Editor::mParam2T

Definition at line 95 of file Distortion.cpp.

◆ mParam2Txt

wxStaticText* EffectDistortion::Editor::mParam2Txt

Definition at line 109 of file Distortion.cpp.

◆ mRepeatsS

wxSlider* EffectDistortion::Editor::mRepeatsS

Definition at line 102 of file Distortion.cpp.

◆ mRepeatsT

wxTextCtrl* EffectDistortion::Editor::mRepeatsT

Definition at line 96 of file Distortion.cpp.

◆ mRepeatsTxt

wxStaticText* EffectDistortion::Editor::mRepeatsTxt

Definition at line 110 of file Distortion.cpp.

◆ mSettings

EffectDistortionSettings EffectDistortion::Editor::mSettings

Definition at line 118 of file Distortion.cpp.

Referenced by ValidateUI().

◆ mThresholdS

wxSlider* EffectDistortion::Editor::mThresholdS

Definition at line 98 of file Distortion.cpp.

◆ mThresholdT

wxTextCtrl* EffectDistortion::Editor::mThresholdT

Definition at line 92 of file Distortion.cpp.

◆ mThresholdTxt

wxStaticText* EffectDistortion::Editor::mThresholdTxt

Definition at line 106 of file Distortion.cpp.

◆ mTypeChoiceCtrl

wxChoice* EffectDistortion::Editor::mTypeChoiceCtrl

Definition at line 91 of file Distortion.cpp.

◆ mUIParent

wxWeakRef<wxWindow> EffectDistortion::Editor::mUIParent {}

Definition at line 126 of file Distortion.cpp.

Referenced by ValidateUI().


The documentation for this struct was generated from the following file: