23#include <wx/valtext.h>
24#include <wx/stattext.h>
27#include "../widgets/NumericTextCtrl.h"
28#include "../widgets/valnum.h"
83 S.StartMultiColumn(2, wxCENTER);
87 .Validator([&dtmfSettings]{
88 wxTextValidator vldDtmf(
89 wxFILTER_INCLUDE_CHAR_LIST, &dtmfSettings.dtmfSequence);
90 wxArrayString symbols;
93 symbols.Add(wxString::Format(
wxT(
"%c"), c));
94 vldDtmf.SetIncludes(symbols);
97 .AddTextBox(
XXO(
"DTMF &sequence:"),
wxT(
""), 10);
103 .Validator<FloatingPointValidator<double>>(
104 3, &dtmfSettings.dtmfAmplitude, NumValidatorStyle::NO_TRAILING_ZEROES,
106 .AddTextBox(
XXO(
"&Amplitude (0-1):"),
wxT(
""), 10);
108 S.AddPrompt(
XXO(
"&Duration:"));
112 S.GetParent(), wxID_ANY,
114 extra.GetDurationFormat(),
118 S.Name(
XO(
"Duration"))
122 S.AddFixedText(
XO(
"&Tone/silence ratio:"),
false);
125 .Style(wxSL_HORIZONTAL | wxEXPAND)
126 .MinSize( { -1, -1 } )
135 S.StartMultiColumn(2, wxCENTER);
137 S.AddFixedText(
XO(
"Duty cycle:"),
false);
139 S.AddVariableText(
XO(
"%.1f %%")
140 .
Format( dtmfSettings.dtmfDutyCycle ),
false);
142 S.AddFixedText(
XO(
"Tone duration:"),
false);
145 S.AddVariableText(
XO(
"%.0f ms")
146 .
Format( dtmfSettings.dtmfTone * 1000.0 ),
false);
148 S.AddFixedText(
XO(
"Silence duration:"),
false);
151 S.AddVariableText(
XO(
"%0.f ms")
152 .
Format( dtmfSettings.dtmfSilence * 1000.0 ),
false);
165 auto result = std::make_unique<Editor>(*
this, access, dtmfSettings);
172 const auto &
settings = mAccess.Get();
173 auto &dtmfSettings = mSettings;
178 mDtmfDutyCycleS->SetValue(dtmfSettings.dtmfDutyCycle *
DutyCycle.
scale);
180 mDtmfDurationT->SetValue(
settings.extra.GetDuration());
190 auto &dtmfSettings = mSettings;
191 dtmfSettings.dtmfDutyCycle =
193 settings.extra.SetDuration(mDtmfDurationT->GetValue());
207 auto &dtmfSettings = mSettings;
210 ->SetLabel(wxString::Format(
wxT(
"%.1f %%"), dtmfSettings.dtmfDutyCycle));
211 mDtmfDutyT->SetName(mDtmfDutyT->GetLabel());
214 ->SetLabel(wxString::Format(
_(
"%.0f ms"), dtmfSettings.dtmfTone * 1000.0));
215 mDtmfSilenceT->SetName(mDtmfSilenceT->GetLabel());
218 ->SetLabel(wxString::Format(
_(
"%.0f ms"), dtmfSettings.dtmfSilence * 1000.0));
219 mDtmfToneT->SetName(mDtmfToneT->GetLabel());
225 auto &dtmfSettings = mSettings;
226 dtmfSettings.dtmfSequence = mDtmfSequenceT->GetValue();
236 auto &dtmfSettings = mSettings;
237 settings.extra.SetDuration(mDtmfDurationT->GetValue());
247 auto &dtmfSettings = mSettings;
248 dtmfSettings.dtmfDutyCycle = (double) evt.GetInt() /
DutyCycle.
scale;
XXO("&Cut/Copy/Paste Toolbar")
const NumericConverterType & NumericConverterType_TIME()
static Settings & settings()
static constexpr EffectParameter Amplitude
static constexpr EffectParameter DutyCycle
static constexpr std::array< char, 6 *7 > kSymbols
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.
void BindTo(wxEvtHandler &src, const EventTag &eventType, void(Class::*pmf)(Event &))
Performs effect computation.
Hold values to send to effect output meters.
virtual const EffectSettings & Get()=0
static DtmfSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
static FormatterContext SampleRateContext(double sampleRate)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
BuiltinEffectsModule::Registration< EffectDtmf > reg
wxSlider * mDtmfDutyCycleS
void OnDuration(wxCommandEvent &evt)
wxStaticText * mDtmfDutyT
void OnDutyCycle(wxCommandEvent &evt)
Editor(const EffectUIServices &effect, EffectSettingsAccess &access, const DtmfSettings &settings)
wxTextCtrl * mDtmfSequenceT
void PopulateOrExchange(ShuttleGui &S, const EffectSettings &settings, double projectRate)
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
NumericTextCtrl * mDtmfDurationT
wxStaticText * mDtmfSilenceT
wxStaticText * mDtmfToneT
virtual ~Editor()=default
bool UpdateUI() override
Update appearance of the panel for changes in settings.
void OnSequence(wxCommandEvent &evt)
const Type scale
Scaling factor, for slider control.
const Type min
Minimum value.
const Type max
Maximum value.
Externalized state of a plug-in.
Options & AutoPos(bool enable)