21#include <wx/radiobut.h>
23#include <wx/checkbox.h>
24#include <wx/stattext.h>
26#include "../widgets/RulerPanel.h"
27#include "../widgets/LinearUpdater.h"
28#include "../widgets/LogarithmicUpdater.h"
29#include "../widgets/IntFormat.h"
30#include "../widgets/LinearDBFormat.h"
32#if wxUSE_ACCESSIBILITY
55 , mEqualizationUI { ui }
56 , mpParent { pParent }
59 mpParent->PushEventHandler(&ui);
70 mAccess.ModifySettings(
73 result = mEqualizationUI.ValidateUI(
settings);
83 mpParent->PopEventHandler();
90 wxWindow* mpParent {};
98 auto &logEnvelope = parameters.mLogEnvelope;
103 parameters.SaveConfig();
115 const auto &M = parameters.
mM;
116 const auto &loFreq = parameters.mLoFreq;
117 const auto &hiFreq = parameters.mHiFreq;
120 auto &drawMode = parameters.mDrawMode;
124 S.SetSizerProportion(1);
125 S.Prop(1).StartMultiColumn(1, wxEXPAND);
141 S.SetSizerProportion(1);
142 S.Prop(1).StartMultiColumn(3, wxEXPAND);
148 S.StartVerticalLay(wxEXPAND, 1);
152 S.GetParent(), wxID_ANY, wxHORIZONTAL,
161 .TicksAtExtremes(
true)
162 .TickColour( { 0, 0, 0 } )
166 S.GetParent(), wxID_ANY, wxVERTICAL,
173 .TicksAtExtremes(
true)
174 .TickColour( { 0, 0, 0 } )
177 S.Prop(0).AddSpace(0, 1);
185 parameters.ChooseEnvelope().Flatten(0.);
186 parameters.ChooseEnvelope().SetTrackLen(1.0);
191 .MinSize( { wxDefaultCoord, wxDefaultCoord } )
195 S.StartVerticalLay();
197 S.AddVariableText(
XO(
"+ dB"),
false, wxCENTER);
200 .Style(wxSL_VERTICAL | wxSL_INVERSE)
201 .AddSlider( {}, 30, 60, 0);
202#if wxUSE_ACCESSIBILITY
210 .Style(wxSL_VERTICAL | wxSL_INVERSE)
211 .AddSlider( {}, -30, -10, -120);
212 S.AddVariableText(
XO(
"- dB"),
false, wxCENTER);
213#if wxUSE_ACCESSIBILITY
231 .Position(wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxLEFT)
243 S.SetSizerProportion(1);
244 S.StartHorizontalLay(wxEXPAND, 1);
259 S.EndHorizontalLay();
264 S.SetSizerProportion(1);
265 S.Prop(1).StartMultiColumn(7, wxALIGN_CENTER_HORIZONTAL);
273 S.StartHorizontalLay(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
275 S.AddPrompt(
XXO(
"&EQ Type:"));
277 S.EndHorizontalLay();
279 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
281 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
284 .Name(
XO(
"Draw Curves"))
285 .AddRadioButton(
XXO(
"&Draw"));
290 .Name(
XO(
"Graphic EQ"))
291 .AddRadioButtonToGroup(
XXO(
"&Graphic"));
295 S.EndHorizontalLay();
297 S.EndHorizontalLay();
300 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
304 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
309 .Name(
XO(
"Interpolation type"))
314#if wxUSE_ACCESSIBILITY
321 S.EndHorizontalLay();
323 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
328 .Name(
XO(
"Linear Frequency Scale"))
329 .AddCheckBox(
XXO(
"Li&near Frequency Scale"),
false);
333 S.EndHorizontalLay();
335 S.EndHorizontalLay();
342 S.StartHorizontalLay(wxEXPAND, 0);
344 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
346 S.AddPrompt(
XXO(
"Length of &Filter:"));
348 S.EndHorizontalLay();
350 S.StartHorizontalLay(wxEXPAND, 1);
353 .Name(
XO(
"Length of Filter"))
354 .Style(wxSL_HORIZONTAL)
355 .AddSlider( {}, (M - 1) / 2, 4095, 10);
359 S.EndHorizontalLay();
361 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
370 S.EndHorizontalLay();
372 S.EndHorizontalLay();
381 S.StartHorizontalLay(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
383 S.AddPrompt(
XXO(
"&Select Curve:"));
385 S.EndHorizontalLay();
387 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
389 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
392 .Name(
XO(
"Select Curve"))
396 for (
const auto &curve : curves)
404 S.EndHorizontalLay();
406 S.EndHorizontalLay();
408 const auto pButton =
S
409 .AddButton(
XXO(
"S&ave/Manage Curves..."));
413 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
416 .AddButton(
XXO(
"Fla&tten"));
420 .AddButton(
XXO(
"&Invert"));
424 .Name(
XO(
"Show grid lines"))
425 .AddCheckBox(
XXO(
"Show g&rid lines"),
false);
429 S.EndHorizontalLay();
454 wxSize sz =
szrV->GetMinSize();
455 sz += wxSize( 30, 0);
466 wxSize sz =
szrV->GetMinSize();
467 sz += wxSize( 400, 100);
468 szrV->SetMinSize(sz);
478 const auto &lin = parameters.
mLin;
479 const auto &drawGrid = parameters.mDrawGrid;
480 const auto &M = parameters.mM;
481 const auto &dBMin = parameters.mdBMin;
482 const auto &dBMax = parameters.mdBMax;
483 const auto &interp = parameters.mInterp;
485 auto &drawMode = parameters.mDrawMode;
489 wxCommandEvent dummyEvent;
513 mDraw->SetValue(drawMode);
529 wxGetTopLevelParent(
mUIParent)->Layout();
537 const auto &dBMin = parameters.
mdBMin;
538 const auto &dBMax = parameters.mdBMax;
571 bool selectedCurveExists =
false;
572 for (
size_t i = 0, cnt = curves.size(); i < cnt; i++)
574 if (curveName == curves[ i ].Name)
575 selectedCurveExists =
true;
577 mCurve->Append(curves[ i ].Name);
580 if (!selectedCurveExists)
581 curveName = curves[ (int)curves.size() - 1 ].Name;
583 mCurve->SetStringSelection(curveName);
587 mCurve->SetMinSize({-1, -1});
596 const auto &lin = parameters.
mLin;
597 auto &linEnvelope = parameters.mLinEnvelope;
598 auto &logEnvelope = parameters.mLogEnvelope;
599 const auto &hiFreq = parameters.mHiFreq;
601 size_t numPoints = logEnvelope.GetNumberOfPoints();
604 double deltadB = 0.1;
605 double dx, dy, dx1, dy1, err;
607 logEnvelope.GetPoints( when.get(), value.get(), numPoints );
617 logEnvelope.GetPoints( when.get(), value.get(), numPoints );
618 for (
size_t j = 0; j + 2 < numPoints; j++)
620 dx = when[j+2+numDeleted] - when[j+numDeleted];
621 dy = value[j+2+numDeleted] - value[j+numDeleted];
622 dx1 = when[j+numDeleted+1] - when[j+numDeleted];
624 err = fabs(value[j+numDeleted+1] - (value[j+numDeleted] + dy1));
627 logEnvelope.Delete(j+1);
647 wxGetTopLevelParent(
mUIParent)->Layout();
654 const auto &lin = parameters.
mLin;
655 auto &linEnvelope = parameters.mLinEnvelope;
656 auto &logEnvelope = parameters.mLogEnvelope;
657 const auto &loFreq = parameters.mLoFreq;
658 const auto &hiFreq = parameters.mHiFreq;
660 auto &drawMode = parameters.mDrawMode;
664 double step = pow(2., 1./12.);
666 for(
double freq=10.; freq<hiFreq; freq*=step)
669 value = linEnvelope.GetValue(when);
670 linEnvelope.Insert(when, value);
685 wxGetTopLevelParent(
mUIParent)->Layout();
687 wxGetTopLevelParent(
mUIParent)->Layout();
727 size_t m = 2 *
mMSlider->GetValue() + 1;
729 wxASSERT( (m & 1) == 1 );
734 tip.Printf(
wxT(
"%d"), (
int)M);
751 tip.Printf(
_(
"%d dB"), (
int)dBMin);
765 tip.Printf(
_(
"%d dB"), (
int)dBMax);
777 wxASSERT(
mCurve != NULL );
790 curves,
mCurve->GetSelection());
792 wxGetTopLevelParent(
mUIParent)->Layout();
822 auto &lin = parameters.
mLin;
823 const auto &loFreq = parameters.mLoFreq;
824 const auto &hiFreq = parameters.mHiFreq;
827 if(parameters.IsLinear())
Toolkit-neutral facade for basic user interface services.
const int kEqOptionGraphic
XXO("&Cut/Copy/Paste Toolbar")
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
static Settings & settings()
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
Serializer of curves into XML files.
void SaveCurves(const wxString &fileName={})
Performs effect computation.
Hold values to send to effect output meters.
EqualizationCurvesDialog manages the available preset curves.
EqualizationPanel is used with EqualizationDialog and controls a graph for EffectEqualization....
void OnIdle(wxIdleEvent &event)
void OnSliderDBMAX(wxCommandEvent &event)
void OnDrawMode(wxCommandEvent &event)
void OnManage(wxCommandEvent &event)
EqualizationCurvesList & mCurvesList
void OnGraphicMode(wxCommandEvent &event)
wxWeakRef< EqualizationPanel > mPanel
void OnClear(wxCommandEvent &event)
void OnLinFreq(wxCommandEvent &event)
void OnInterp(wxCommandEvent &event)
EffectUIServices & mUIServices
void OnCurve(wxCommandEvent &event)
void BindTo(wxEvtHandler &src, const EventTag &eventType, void(Class::*pmf)(Event &))
void OnSliderDBMIN(wxCommandEvent &event)
EqualizationBandSliders mBands
bool ValidateUI(EffectSettings &settings)
void OnInvert(wxCommandEvent &event)
const wxWeakRef< wxWindow > & mUIParent
void OnSliderM(wxCommandEvent &event)
std::unique_ptr< EffectEditor > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs)
bool TransferDataToWindow(const EffectSettings &settings)
void OnSize(wxSizeEvent &event)
wxWeakRef< wxChoice > mCurve
void OnGridOnOff(wxCommandEvent &event)
static const LinearUpdater & Instance()
static const LogarithmicUpdater & Instance()
void SetUpdater(const RulerUpdater *pUpdater)
void GetMaxSize(wxCoord *width, wxCoord *height)
void SetRange(double min, double max)
RulerPanel class allows you to work with a Ruler like any other wxWindow.
std::pair< double, double > Range
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
void Disconnect() override
On the first call only, may disconnect from further event handling.
bool ValidateUI() override
Calls mServices.ValidateUI()
~EqualizationUIEditor() override
Calls Disconnect.
EqualizationUI & mEqualizationUI
EqualizationUIEditor(EqualizationUI &ui, EffectUIServices &services, EffectSettingsAccess &access, wxWindow *pParent=nullptr)
Externalized state of a plug-in.
void AddBandSliders(ShuttleGui &S)
void GraphicEQ(Envelope &env)
EqualizationFilter & mParameters
void setCurve(int currentCurve)
static const EnumValueSymbol kInterpStrings[nInterpolations]
Options & LabelEdges(bool l)