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, EffectDistortion::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 {}
 
EffectDistortion::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 131 of file Distortion.cpp.

Constructor & Destructor Documentation

◆ Editor()

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

Definition at line 134 of file Distortion.cpp.

137 : EffectEditor{ services, access }
138 , mInstance(instance)
140 {}
static Settings & settings()
Definition: TrackInfo.cpp:69
EffectDistortionSettings mSettings
Definition: Distortion.cpp:189
EffectDistortion::Instance & mInstance
Definition: Distortion.cpp:198

◆ ~Editor()

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

Member Function Documentation

◆ GetState()

EffectDistortionState & EffectDistortion::Editor::GetState ( )

Definition at line 316 of file Distortion.cpp.

317{
318 return mInstance.mMaster;
319}
EffectDistortionState mMaster
Definition: Distortion.cpp:304

◆ OnDCBlockCheckbox()

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

Definition at line 770 of file Distortion.cpp.

771{
772 auto& ms = mSettings;
773
774 ms.mDCBlock = mDCBlockCheckBox->GetValue();
775
776 GetState().mbSavedFilterState = ms.mDCBlock;
777
778 ValidateUI();
780}
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:202
wxCheckBox * mDCBlockCheckBox
Definition: Distortion.cpp:175
EffectDistortionState & GetState()
Definition: Distortion.cpp:316
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 821 of file Distortion.cpp.

822{
823 auto& ms = mSettings;
824
825 ms.mNoiseFloor = (double) evt.GetInt();
826 mNoiseFloorT->GetValidator()->TransferToWindow();
827
828 ValidateUI();
830}

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 810 of file Distortion.cpp.

811{
812 const auto& ms = mSettings;
813
814 mNoiseFloorT->GetValidator()->TransferFromWindow();
815 mNoiseFloorS->SetValue((int) floor(ms.mNoiseFloor + 0.5));
816
817 ValidateUI();
819}

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 844 of file Distortion.cpp.

845{
846 auto& ms = mSettings;
847
848 ms.mParam1 = (double) evt.GetInt();
849 mParam1T->GetValidator()->TransferToWindow();
850
851 ValidateUI();
853}

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 833 of file Distortion.cpp.

834{
835 const auto& ms = mSettings;
836
837 mParam1T->GetValidator()->TransferFromWindow();
838 mParam1S->SetValue((int) floor(ms.mParam1 + 0.5));
839
840 ValidateUI();
842}

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 866 of file Distortion.cpp.

867{
868 auto& ms = mSettings;
869
870 ms.mParam2 = (double) evt.GetInt();
871 mParam2T->GetValidator()->TransferToWindow();
872
873 ValidateUI();
875}

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 855 of file Distortion.cpp.

856{
857 const auto& ms = mSettings;
858
859 mParam2T->GetValidator()->TransferFromWindow();
860 mParam2S->SetValue((int) floor(ms.mParam2 + 0.5));
861
862 ValidateUI();
864}

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 888 of file Distortion.cpp.

889{
890 auto& ms = mSettings;
891
892 ms.mRepeats = evt.GetInt();
893 mRepeatsT->GetValidator()->TransferToWindow();
894
895 ValidateUI();
897}

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 877 of file Distortion.cpp.

878{
879 const auto& ms = mSettings;
880
881 mRepeatsT->GetValidator()->TransferFromWindow();
882 mRepeatsS->SetValue(ms.mRepeats);
883
884 ValidateUI();
886}

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 795 of file Distortion.cpp.

796{
797 auto& ms = mSettings;
798
799 static const double MIN_Threshold_Linear = DB_TO_LINEAR(Threshold_dB.min);
800
801 const double thresholdDB = (double)evt.GetInt() / Threshold_dB.scale;
802 ms.mThreshold_dB = wxMax(LINEAR_TO_DB(thresholdDB), Threshold_dB.min);
803
804 mThresholdT->GetValidator()->TransferToWindow();
805
806 ValidateUI();
808}
#define LINEAR_TO_DB(x)
Definition: MemoryX.h:336
#define DB_TO_LINEAR(x)
Definition: MemoryX.h:335
static constexpr EffectParameter Threshold_dB
Definition: Distortion.h:158
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, EffectDistortion::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 783 of file Distortion.cpp.

784{
785 const auto& ms = mSettings;
786
787 mThresholdT->GetValidator()->TransferFromWindow();
788 const double threshold = DB_TO_LINEAR(ms.mThreshold_dB);
789 mThresholdS->SetValue((int) (threshold * Threshold_dB.scale + 0.5));
790
791 ValidateUI();
793}

References DB_TO_LINEAR, EffectParameter< Structure, Member, Type, Value >::scale, EffectDistortion::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 760 of file Distortion.cpp.

761{
762 mTypeChoiceCtrl->GetValidator()->TransferFromWindow();
763
765
766 ValidateUI();
768}

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 465 of file Distortion.cpp.

466{
467 mUIParent = S.GetParent();
468 auto& ms = mSettings;
469
470 S.AddSpace(0, 5);
471 S.StartVerticalLay();
472 {
473 S.StartMultiColumn(4, wxCENTER);
474 {
476 .MinSize( { -1, -1 } )
477 .Validator<wxGenericValidator>(&ms.mTableChoiceIndx)
478 .AddChoice(XXO("Distortion type:"),
480
482
483 mDCBlockCheckBox = S.AddCheckBox(XXO("DC blocking filter"),
484 DCBlock.def);
485
487 }
488 S.EndMultiColumn();
489 S.AddSpace(0, 10);
490
491
492 S.StartStatic(XO("Threshold controls"));
493 {
494 S.StartMultiColumn(4, wxEXPAND);
495 S.SetStretchyCol(2);
496 {
497 // Allow space for first Column
498 S.AddSpace(250,0); S.AddSpace(0,0); S.AddSpace(0,0); S.AddSpace(0,0);
499
500 // Upper threshold control
501 mThresholdTxt = S.AddVariableText(defaultLabel(0),
502 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
503 mThresholdT = S
504 .Name(defaultLabel(0))
505 .Validator<FloatingPointValidator<double>>(
506 2, &ms.mThreshold_dB, NumValidatorStyle::DEFAULT,
508 .AddTextBox( {}, wxT(""), 10);
509
511
512 mThresholdS = S
513 .Name(defaultLabel(0))
514 .Style(wxSL_HORIZONTAL)
515 .AddSlider( {}, 0,
518 S.AddSpace(20, 0);
519
521
522 // Noise floor control
523 mNoiseFloorTxt = S.AddVariableText(defaultLabel(1),
524 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
526 .Name(defaultLabel(1))
527 .Validator<FloatingPointValidator<double>>(
528 2, &ms.mNoiseFloor, NumValidatorStyle::DEFAULT,
530 )
531 .AddTextBox( {}, wxT(""), 10);
532
534
536 .Name(defaultLabel(1))
537 .Style(wxSL_HORIZONTAL)
538 .AddSlider( {}, 0, NoiseFloor.max, NoiseFloor.min);
539 S.AddSpace(20, 0);
540
542 }
543 S.EndMultiColumn();
544 }
545 S.EndStatic();
546
547 S.StartStatic(XO("Parameter controls"));
548 {
549 S.StartMultiColumn(4, wxEXPAND);
550 S.SetStretchyCol(2);
551 {
552 // Allow space for first Column
553 S.AddSpace(250,0); S.AddSpace(0,0); S.AddSpace(0,0); S.AddSpace(0,0);
554
555 // Parameter1 control
556 mParam1Txt = S.AddVariableText(defaultLabel(2),
557 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
558 mParam1T = S
559 .Name(defaultLabel(2))
560 .Validator<FloatingPointValidator<double>>(
561 2, &ms.mParam1, NumValidatorStyle::DEFAULT,
563 )
564 .AddTextBox( {}, wxT(""), 10);
565
566 BindTo(*mParam1T, wxEVT_TEXT, &Editor::OnParam1Text);
567
568 mParam1S = S
569 .Name(defaultLabel(2))
570 .Style(wxSL_HORIZONTAL)
571 .AddSlider( {}, 0, Param1.max, Param1.min);
572 S.AddSpace(20, 0);
573
574 BindTo(*mParam1S, wxEVT_SLIDER, &Editor::OnParam1Slider);
575
576 // Parameter2 control
577 mParam2Txt = S.AddVariableText(defaultLabel(3),
578 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
579 mParam2T = S
580 .Name(defaultLabel(3))
581 .Validator<FloatingPointValidator<double>>(
582 2, &ms.mParam2, NumValidatorStyle::DEFAULT,
584 )
585 .AddTextBox( {}, wxT(""), 10);
586
587 BindTo(*mParam2T, wxEVT_TEXT, &Editor::OnParam2Text);
588
589 mParam2S = S
590 .Name(defaultLabel(3))
591 .Style(wxSL_HORIZONTAL)
592 .AddSlider( {}, 0, Param2.max, Param2.min);
593
594 BindTo(*mParam2S, wxEVT_SLIDER, &Editor::OnParam2Slider);
595
596 S.AddSpace(20, 0);
597
598 // Repeats control
599 mRepeatsTxt = S.AddVariableText(defaultLabel(4),
600 false, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
601 mRepeatsT = S
602 .Name(defaultLabel(4))
603 .Validator<IntegerValidator<int>>(
604 &ms.mRepeats, NumValidatorStyle::DEFAULT,
606 )
607 .AddTextBox( {}, wxT(""), 10);
608
609 BindTo(*mRepeatsT, wxEVT_TEXT, &Editor::OnRepeatsText);
610
611 mRepeatsS = S
612 .Name(defaultLabel(4))
613 .Style(wxSL_HORIZONTAL)
614 .AddSlider( {}, Repeats.def, Repeats.max, Repeats.min);
615
616 BindTo(*mRepeatsS, wxEVT_SLIDER, &Editor::OnRepeatsSlider);
617
618 S.AddSpace(20, 0);
619 }
620 S.EndMultiColumn();
621 }
622 S.EndStatic();
623 }
624 S.EndVerticalLay();
625
626}
wxT("CloseDown"))
TranslatableString defaultLabel(int index)
Definition: Distortion.cpp:108
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 Param2
Definition: Distortion.h:170
static constexpr EffectParameter Param1
Definition: Distortion.h:166
static const EnumValueSymbol kTableTypeStrings[nTableTypes]
Definition: Distortion.h:146
static constexpr EffectParameter Repeats
Definition: Distortion.h:173
static constexpr EffectParameter DCBlock
Definition: Distortion.h:154
static constexpr EffectParameter NoiseFloor
Definition: Distortion.h:162
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:181
void OnParam2Text(wxCommandEvent &evt)
Definition: Distortion.cpp:855
void OnRepeatsText(wxCommandEvent &evt)
Definition: Distortion.cpp:877
void OnRepeatsSlider(wxCommandEvent &evt)
Definition: Distortion.cpp:888
void OnTypeChoice(wxCommandEvent &evt)
Definition: Distortion.cpp:760
wxStaticText * mThresholdTxt
Definition: Distortion.cpp:177
void OnDCBlockCheckbox(wxCommandEvent &evt)
Definition: Distortion.cpp:770
wxStaticText * mParam2Txt
Definition: Distortion.cpp:180
void OnNoiseFloorText(wxCommandEvent &evt)
Definition: Distortion.cpp:810
wxWeakRef< wxWindow > mUIParent
Definition: Distortion.cpp:197
void OnParam2Slider(wxCommandEvent &evt)
Definition: Distortion.cpp:866
void OnThresholdText(wxCommandEvent &evt)
Definition: Distortion.cpp:783
void OnParam1Slider(wxCommandEvent &evt)
Definition: Distortion.cpp:844
void OnParam1Text(wxCommandEvent &evt)
Definition: Distortion.cpp:833
wxStaticText * mParam1Txt
Definition: Distortion.cpp:179
void OnThresholdSlider(wxCommandEvent &evt)
Definition: Distortion.cpp:795
wxStaticText * mNoiseFloorTxt
Definition: Distortion.cpp:178
void OnNoiseFloorSlider(wxCommandEvent &evt)
Definition: Distortion.cpp:821
const Type def
Default value.
const Type max
Maximum value.

References DB_TO_LINEAR, EffectDistortion::DCBlock, EffectParameter< Structure, Member, Type, Value >::def, defaultLabel(), EffectDistortion::kTableTypeStrings, EffectParameter< Structure, Member, Type, Value >::max, EffectParameter< Structure, Member, Type, Value >::min, Msgids(), EffectDistortion::NoiseFloor, EffectDistortion::nTableTypes, OnDCBlockCheckbox(), OnNoiseFloorSlider(), OnNoiseFloorText(), OnParam1Slider(), OnParam1Text(), OnParam2Slider(), OnParam2Text(), OnRepeatsSlider(), OnRepeatsText(), OnThresholdSlider(), OnThresholdText(), OnTypeChoice(), EffectDistortion::Param1, EffectDistortion::Param2, EffectDistortion::Repeats, S, EffectParameter< Structure, Member, Type, Value >::scale, EffectDistortion::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 1071 of file Distortion.cpp.

1073{
1074 auto& ms = mSettings;
1075
1076 auto suffix = XO("(Not Used):");
1077 switch (id)
1078 {
1079 case ID_Threshold: {
1080 /* i18n-hint: Control range. */
1081 if (enabled) suffix = XO("(-100 to 0 dB):");
1082 name.Join( suffix, wxT(" ") );
1083
1084 // Logarithmic slider is set indirectly
1085 const double threshold = DB_TO_LINEAR(ms.mThreshold_dB);
1086 mThresholdS->SetValue((int) (threshold * Threshold_dB.scale + 0.5));
1087
1088 auto translated = name.Translation();
1089 mThresholdTxt->SetLabel(translated);
1090 mThresholdS->SetName(translated);
1091 mThresholdT->SetName(translated);
1092 mThresholdS->Enable(enabled);
1093 mThresholdT->Enable(enabled);
1094 break;
1095 }
1096 case ID_NoiseFloor: {
1097 /* i18n-hint: Control range. */
1098 if (enabled) suffix = XO("(-80 to -20 dB):");
1099 name.Join( suffix, wxT(" ") );
1100
1101 auto translated = name.Translation();
1102 mNoiseFloorTxt->SetLabel(translated);
1103 mNoiseFloorS->SetName(translated);
1104 mNoiseFloorT->SetName(translated);
1105 mNoiseFloorS->Enable(enabled);
1106 mNoiseFloorT->Enable(enabled);
1107 break;
1108 }
1109 case ID_Param1: {
1110 /* i18n-hint: Control range. */
1111 if (enabled) suffix = XO("(0 to 100):");
1112 name.Join( suffix, wxT(" ") );
1113
1114 auto translated = name.Translation();
1115 mParam1Txt->SetLabel(translated);
1116 mParam1S->SetName(translated);
1117 mParam1T->SetName(translated);
1118 mParam1S->Enable(enabled);
1119 mParam1T->Enable(enabled);
1120 break;
1121 }
1122 case ID_Param2: {
1123 /* i18n-hint: Control range. */
1124 if (enabled) suffix = XO("(0 to 100):");
1125 name.Join( suffix, wxT(" ") );
1126
1127 auto translated = name.Translation();
1128 mParam2Txt->SetLabel(translated);
1129 mParam2S->SetName(translated);
1130 mParam2T->SetName(translated);
1131 mParam2S->Enable(enabled);
1132 mParam2T->Enable(enabled);
1133 break;
1134 }
1135 case ID_Repeats: {
1136 /* i18n-hint: Control range. */
1137 if (enabled) suffix = XO("(0 to 5):");
1138 name.Join( suffix, wxT(" ") );
1139
1140 auto translated = name.Translation();
1141 mRepeatsTxt->SetLabel(translated);
1142 mRepeatsS->SetName(translated);
1143 mRepeatsT->SetName(translated);
1144 mRepeatsS->Enable(enabled);
1145 mRepeatsT->Enable(enabled);
1146 break;
1147 }
1148 case ID_DCBlock: {
1149 if (enabled) {
1150 mDCBlockCheckBox->SetValue(GetState().mbSavedFilterState);
1151 ms.mDCBlock = GetState().mbSavedFilterState;
1152 }
1153 else {
1154 mDCBlockCheckBox->SetValue(false);
1155 ms.mDCBlock = false;
1156 }
1157
1158 mDCBlockCheckBox->Enable(enabled);
1159 break;
1160 }
1161 default:
1162 break;
1163 }
1164}
const TranslatableString name
Definition: Distortion.cpp:76
TranslatableString & Join(TranslatableString arg, const wxString &separator={}) &
Append another translatable string.
wxString Translation() const

References DB_TO_LINEAR, EffectDistortion::ID_DCBlock, EffectDistortion::ID_NoiseFloor, EffectDistortion::ID_Param1, EffectDistortion::ID_Param2, EffectDistortion::ID_Repeats, EffectDistortion::ID_Threshold, TranslatableString::Join(), name, EffectParameter< Structure, Member, Type, Value >::scale, EffectDistortion::Threshold_dB, TranslatableString::Translation(), 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 1166 of file Distortion.cpp.

1167{
1168 if (enabled) {
1169 if (textCtrl->GetValue().empty())
1170 textCtrl->SetValue(string);
1171 else
1172 string = textCtrl->GetValue();
1173 }
1174 else {
1175 if (!textCtrl->GetValue().empty())
1176 string = textCtrl->GetValue();
1177 textCtrl->SetValue(wxT(""));
1178 }
1179}

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 629 of file Distortion.cpp.

630{
631 const auto& ms = mSettings;
632
633 if (!mUIParent->TransferDataToWindow())
634 {
635 return false;
636 }
637
638 const double threshold = DB_TO_LINEAR(ms.mThreshold_dB);
639
640 mThresholdS-> SetValue((int) (threshold * Threshold_dB.scale + 0.5));
641 mDCBlockCheckBox->SetValue( ms.mDCBlock);
642 mNoiseFloorS-> SetValue((int)ms.mNoiseFloor + 0.5);
643 mParam1S-> SetValue((int)ms.mParam1 + 0.5);
644 mParam2S-> SetValue((int)ms.mParam2 + 0.5);
645 mRepeatsS-> SetValue( ms.mRepeats);
646
647 GetState().mbSavedFilterState = ms.mDCBlock;
648
650
651 return true;
652}

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

◆ UpdateUIControls()

void EffectDistortion::Editor::UpdateUIControls ( )

Definition at line 899 of file Distortion.cpp.

900{
901 const auto& ms = mSettings;
902
903 // set control text and names to match distortion type
904 switch (ms.mTableChoiceIndx)
905 {
906 case kHardClip:
912
913 UpdateControl(ID_Threshold, true, XO("Clipping level"));
915 UpdateControl(ID_Param1, true, XO("Drive"));
916 UpdateControl(ID_Param2, true, XO("Make-up Gain"));
918 UpdateControl(ID_DCBlock, false, {});
919 break;
920 case kSoftClip:
926
927 UpdateControl(ID_Threshold, true, XO("Clipping threshold"));
929 UpdateControl(ID_Param1, true, XO("Hardness"));
930 UpdateControl(ID_Param2, true, XO("Make-up Gain"));
932 UpdateControl(ID_DCBlock, false, {});
933 break;
934 case kHalfSinCurve:
940
943 UpdateControl(ID_Param1, true, XO("Distortion amount"));
944 UpdateControl(ID_Param2, true, XO("Output level"));
946 UpdateControl(ID_DCBlock, false, {});
947 break;
948 case kExpCurve:
954
957 UpdateControl(ID_Param1, true, XO("Distortion amount"));
958 UpdateControl(ID_Param2, true, XO("Output level"));
960 UpdateControl(ID_DCBlock, false, {});
961 break;
962 case kLogCurve:
968
971 UpdateControl(ID_Param1, true, XO("Distortion amount"));
972 UpdateControl(ID_Param2, true, XO("Output level"));
974 UpdateControl(ID_DCBlock, false, {});
975 break;
976 case kCubic:
982
985 UpdateControl(ID_Param1, true, XO("Distortion amount"));
986 UpdateControl(ID_Param2, true, XO("Output level"));
987 UpdateControl(ID_Repeats, true, XO("Repeat processing"));
988 UpdateControl(ID_DCBlock, false, {});
989 break;
990 case kEvenHarmonics:
996
999 UpdateControl(ID_Param1, true, XO("Distortion amount"));
1000 UpdateControl(ID_Param2, true, XO("Harmonic brightness"));
1002 UpdateControl(ID_DCBlock, true, {});
1003 break;
1004 case kSinCurve:
1010
1013 UpdateControl(ID_Param1, true, XO("Distortion amount"));
1014 UpdateControl(ID_Param2, true, XO("Output level"));
1016 UpdateControl(ID_DCBlock, false, {});
1017 break;
1018 case kLeveller:
1024
1027 UpdateControl(ID_Param1, true, XO("Levelling fine adjustment"));
1029 UpdateControl(ID_Repeats, true, XO("Degree of Levelling"));
1030 UpdateControl(ID_DCBlock, false, {});
1031 break;
1032 case kRectifier:
1038
1041 UpdateControl(ID_Param1, true, XO("Distortion amount"));
1044 UpdateControl(ID_DCBlock, true, {});
1045 break;
1046 case kHardLimiter:
1052
1053 UpdateControl(ID_Threshold, true, XO("dB Limit"));
1055 UpdateControl(ID_Param1, true, XO("Wet level"));
1056 UpdateControl(ID_Param2, true, XO("Residual level"));
1058 UpdateControl(ID_DCBlock, false, {});
1059 break;
1060 default:
1066 UpdateControl(ID_DCBlock, false, {});
1067 }
1068}
void UpdateControl(control id, bool enable, TranslatableString name)
void UpdateControlText(wxTextCtrl *textCtrl, wxString &string, bool enabled)

References defaultLabel(), EffectDistortion::ID_DCBlock, EffectDistortion::ID_NoiseFloor, EffectDistortion::ID_Param1, EffectDistortion::ID_Param2, EffectDistortion::ID_Repeats, EffectDistortion::ID_Threshold, EffectDistortion::kCubic, EffectDistortion::kEvenHarmonics, EffectDistortion::kExpCurve, EffectDistortion::kHalfSinCurve, EffectDistortion::kHardClip, EffectDistortion::kHardLimiter, EffectDistortion::kLeveller, EffectDistortion::kLogCurve, EffectDistortion::kRectifier, EffectDistortion::kSinCurve, EffectDistortion::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 202 of file Distortion.cpp.

203{
204 {
205 // This section was copied from the original
206 // EffectDistortion::TransferDataFromWindow
207 //
208 // However, the call to ->Validate would bring up an error dialog
209 // saying "Empty value"
210
211 if ( !mUIParent->TransferDataFromWindow())
212 {
213 return false;
214 }
215 }
216
217
219 (
220 [this](EffectSettings& settings)
221 {
222 // pass back the modified settings to the MessageBuffer
223
225
226 return nullptr;
227 }
228 );
229
230 return true;
231}
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:169
Externalized state of a plug-in.

References EffectWithSettings< EffectDistortionSettings, StatelessPerTrackEffect >::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 175 of file Distortion.cpp.

◆ mInstance

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

Definition at line 198 of file Distortion.cpp.

◆ mNoiseFloorS

wxSlider* EffectDistortion::Editor::mNoiseFloorS

Definition at line 170 of file Distortion.cpp.

◆ mNoiseFloorT

wxTextCtrl* EffectDistortion::Editor::mNoiseFloorT

Definition at line 164 of file Distortion.cpp.

◆ mNoiseFloorTxt

wxStaticText* EffectDistortion::Editor::mNoiseFloorTxt

Definition at line 178 of file Distortion.cpp.

◆ mOldmNoiseFloorTxt

wxString EffectDistortion::Editor::mOldmNoiseFloorTxt

Definition at line 184 of file Distortion.cpp.

◆ mOldParam1Txt

wxString EffectDistortion::Editor::mOldParam1Txt

Definition at line 185 of file Distortion.cpp.

◆ mOldParam2Txt

wxString EffectDistortion::Editor::mOldParam2Txt

Definition at line 186 of file Distortion.cpp.

◆ mOldRepeatsTxt

wxString EffectDistortion::Editor::mOldRepeatsTxt

Definition at line 187 of file Distortion.cpp.

◆ mOldThresholdTxt

wxString EffectDistortion::Editor::mOldThresholdTxt

Definition at line 183 of file Distortion.cpp.

◆ mParam1S

wxSlider* EffectDistortion::Editor::mParam1S

Definition at line 171 of file Distortion.cpp.

◆ mParam1T

wxTextCtrl* EffectDistortion::Editor::mParam1T

Definition at line 165 of file Distortion.cpp.

◆ mParam1Txt

wxStaticText* EffectDistortion::Editor::mParam1Txt

Definition at line 179 of file Distortion.cpp.

◆ mParam2S

wxSlider* EffectDistortion::Editor::mParam2S

Definition at line 172 of file Distortion.cpp.

◆ mParam2T

wxTextCtrl* EffectDistortion::Editor::mParam2T

Definition at line 166 of file Distortion.cpp.

◆ mParam2Txt

wxStaticText* EffectDistortion::Editor::mParam2Txt

Definition at line 180 of file Distortion.cpp.

◆ mRepeatsS

wxSlider* EffectDistortion::Editor::mRepeatsS

Definition at line 173 of file Distortion.cpp.

◆ mRepeatsT

wxTextCtrl* EffectDistortion::Editor::mRepeatsT

Definition at line 167 of file Distortion.cpp.

◆ mRepeatsTxt

wxStaticText* EffectDistortion::Editor::mRepeatsTxt

Definition at line 181 of file Distortion.cpp.

◆ mSettings

EffectDistortionSettings EffectDistortion::Editor::mSettings

Definition at line 189 of file Distortion.cpp.

Referenced by ValidateUI().

◆ mThresholdS

wxSlider* EffectDistortion::Editor::mThresholdS

Definition at line 169 of file Distortion.cpp.

◆ mThresholdT

wxTextCtrl* EffectDistortion::Editor::mThresholdT

Definition at line 163 of file Distortion.cpp.

◆ mThresholdTxt

wxStaticText* EffectDistortion::Editor::mThresholdTxt

Definition at line 177 of file Distortion.cpp.

◆ mTypeChoiceCtrl

wxChoice* EffectDistortion::Editor::mTypeChoiceCtrl

Definition at line 162 of file Distortion.cpp.

◆ mUIParent

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

Definition at line 197 of file Distortion.cpp.

Referenced by ValidateUI().


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