Audacity 3.2.0
Classes | Public Member Functions | Protected Member Functions | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
DynamicRangeProcessorEditor Class Reference

#include <DynamicRangeProcessorEditor.h>

Inheritance diagram for DynamicRangeProcessorEditor:
[legend]
Collaboration diagram for DynamicRangeProcessorEditor:
[legend]

Classes

struct  HistoryPanels
 

Public Member Functions

 DynamicRangeProcessorEditor (wxWindow *parent, CompressorInstance &instance, bool isRealtime, const EffectUIServices &services, EffectSettingsAccess &access)
 
void PopulateOrExchange (ShuttleGui &S)
 
- 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...
 

Protected Member Functions

void Initialize (std::vector< ExtendedCompressorParameter > parameters)
 
- 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...
 

Static Protected Attributes

static constexpr auto dbStep = 0.1
 

Private Member Functions

void AddCompressionCurvePanel (ShuttleGui &S, const CompressorSettings &)
 
void AddSliderPanel (ShuttleGui &S)
 
void AddCheckboxPanel (ShuttleGui &S, const DynamicRangeProcessorSettings &settings)
 
void AddClipIndicator (ShuttleGui &S)
 
virtual const CompressorSettingsGetCompressorSettings () const
 
virtual const LimiterSettingsGetLimiterSettings () const
 
CompressorSettingsGetCompressorSettings ()
 
LimiterSettingsGetLimiterSettings ()
 
void AddTextboxAndSlider (ShuttleGui &S, ExtendedCompressorParameter &param)
 
bool ValidateUI () final override
 Get settings data from the panel; may make error dialogs and return false. More...
 
bool UpdateUI () final override
 Update appearance of the panel for changes in settings. More...
 
void OnCheckbox (bool newVal, double &setting, void(DynamicRangeProcessorHistoryPanel::*)(bool))
 

Private Attributes

wxWeakRef< wxWindow > mUIParent
 
std::vector< ExtendedCompressorParametermParameters
 
wxDialog & mTopLevelParent
 
CompressorInstancemCompressorInstance
 
const bool mIsRealtime
 
int mFullHeight { 0 }
 

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 Attributes inherited from EffectEditor
const EffectUIServicesmUIServices
 
EffectSettingsAccessmAccess
 
bool mUIClosed { false }
 

Detailed Description

Definition at line 86 of file DynamicRangeProcessorEditor.h.

Constructor & Destructor Documentation

◆ DynamicRangeProcessorEditor()

DynamicRangeProcessorEditor::DynamicRangeProcessorEditor ( wxWindow *  parent,
CompressorInstance instance,
bool  isRealtime,
const EffectUIServices services,
EffectSettingsAccess access 
)

Definition at line 131 of file DynamicRangeProcessorEditor.cpp.

134 : EffectEditor { services, access }
135 , mUIParent { parent }
136 , mTopLevelParent(static_cast<wxDialog&>(*wxGetTopLevelParent(parent)))
137 , mCompressorInstance { instance }
138 , mIsRealtime { isRealtime }
139{
140}

Member Function Documentation

◆ AddCheckboxPanel()

void DynamicRangeProcessorEditor::AddCheckboxPanel ( ShuttleGui S,
const DynamicRangeProcessorSettings settings 
)
private

Definition at line 265 of file DynamicRangeProcessorEditor.cpp.

267{
268#define GET_REF(settingName) \
269 GetCompressorSettings() ? GetCompressorSettings()->settingName : \
270 GetLimiterSettings()->settingName
271
272 S.StartVerticalLay(wxALIGN_BOTTOM, 0);
273 {
274 S.StartHorizontalLay(wxALIGN_LEFT, 0);
275 {
276 S.AddSpace(borderSize, 0);
277 const auto input = S.AddCheckBox(XO("I&nput"), settings.showInput);
278 input->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& evt) {
280 evt.IsChecked(), GET_REF(showInput), &HistPanel::ShowInput);
281 });
282 /* i18n-hint: show input on a graph */
283 input->SetName(_("Show input"));
284
285 const auto output = S.AddCheckBox(XO("O&utput"), settings.showOutput);
286 output->Bind(wxEVT_CHECKBOX, [&](wxCommandEvent& evt) {
288 evt.IsChecked(), GET_REF(showOutput), &HistPanel::ShowOutput);
289 });
290 /* i18n-hint: show output on a graph */
291 output->SetName(_("Show output"));
292
293 /* i18n-hint: The effective compression, including smoothing. */
294 const auto actual =
295 S.AddCheckBox(XO("A&ctual compression"), settings.showActual);
296 actual->Bind(wxEVT_CHECKBOX, [&](wxCommandEvent& evt) {
298 evt.IsChecked(), GET_REF(showActual), &HistPanel::ShowActual);
299 });
300 /* i18n-hint: show actual compression on a graph */
301 actual->SetName(_("Show actual compression"));
302
303 /* i18n-hint: The target compression, before smoothing. */
304 const auto target =
305 S.AddCheckBox(XO("Tar&get compression"), settings.showTarget);
306 target->Bind(wxEVT_CHECKBOX, [&](wxCommandEvent& evt) {
308 evt.IsChecked(), GET_REF(showTarget), &HistPanel::ShowTarget);
309 });
310 /* i18n-hint: show target compression on a graph */
311 target->SetName(_("Show target compression"));
312
313#if wxUSE_ACCESSIBILITY
314 // so that name can be set on a standard control
319#endif
320 }
321 S.EndHorizontalLay();
322 S.AddSpace(0, borderSize);
323 }
324 S.EndVerticalLay();
325}
#define GET_REF(settingName)
XO("Cut/Copy/Paste")
#define _(s)
Definition: Internat.h:73
#define safenew
Definition: MemoryX.h:10
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:51
void OnCheckbox(bool newVal, double &setting, void(DynamicRangeProcessorHistoryPanel::*)(bool))
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...

References _, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::borderSize, GET_REF, OnCheckbox(), S, safenew, settings(), and XO().

Referenced by PopulateOrExchange().

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

◆ AddClipIndicator()

void DynamicRangeProcessorEditor::AddClipIndicator ( ShuttleGui S)
private

Definition at line 327 of file DynamicRangeProcessorEditor.cpp.

328{
329 constexpr auto width = compressionMeterPanelWidth / 2 - 2;
330 constexpr auto height = compressionMeterPanelWidth / 4;
331 S.MinSize({ width, height })
332 .AddWindow(
334 wxALIGN_RIGHT | wxALIGN_BOTTOM)
335 ->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& evt) {
336 if (
337 const auto panel = dynamic_cast<CompressionMeterPanel*>(
338 wxWindow::FindWindowById(compressionMeterPanelId, mUIParent)))
339 panel->ResetClipped();
340 if (
341 const auto indicator =
342 dynamic_cast<ClipIndicatorPanel*>(evt.GetEventObject()))
343 indicator->Reset();
344 });
345}

References anonymous_namespace{DynamicRangeProcessorEditor.cpp}::clipIndicatorId, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::compressionMeterPanelId, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::compressionMeterPanelWidth, mUIParent, S, and safenew.

Referenced by PopulateOrExchange().

Here is the caller graph for this function:

◆ AddCompressionCurvePanel()

void DynamicRangeProcessorEditor::AddCompressionCurvePanel ( ShuttleGui S,
const CompressorSettings compressorSettings 
)
private

Definition at line 347 of file DynamicRangeProcessorEditor.cpp.

349{
350 S.StartMultiColumn(3);
351 {
352 S.SetStretchyRow(1);
353
354 constexpr auto tfWidth = 200;
355
356 // Horizontal ruler row
357 S.AddSpace(borderSize, 0);
358 S.Prop(1)
359 .Position(wxALIGN_BOTTOM)
360 .MinSize({ tfWidth, rulerWidth })
361 .AddWindow(MakeRulerPanel(mUIParent, wxHORIZONTAL, TFPanel::rangeDb));
362 S.AddSpace(rulerWidth, 0);
363
364 // Transfer function row
365 S.AddSpace(borderSize, 0);
366 S.Prop(1).Position(wxEXPAND).AddWindow(safenew TFPanel(
367 mUIParent, transferFunctionPanelId, compressorSettings));
368 S.Prop(1).Position(wxEXPAND).AddWindow(
369 MakeRulerPanel(mUIParent, wxVERTICAL, TFPanel::rangeDb));
370 }
371 S.EndMultiColumn();
372}
auto MakeRulerPanel(wxWindow *parent, wxOrientation orientation, float dbRange, int id=wxID_ANY)

References anonymous_namespace{DynamicRangeProcessorEditor.cpp}::borderSize, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::MakeRulerPanel(), mUIParent, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::rulerWidth, S, safenew, and anonymous_namespace{DynamicRangeProcessorEditor.cpp}::transferFunctionPanelId.

Referenced by PopulateOrExchange().

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

◆ AddSliderPanel()

void DynamicRangeProcessorEditor::AddSliderPanel ( ShuttleGui S)
private

Definition at line 374 of file DynamicRangeProcessorEditor.cpp.

375{
376 using It = std::vector<ExtendedCompressorParameter>::iterator;
377 const auto addTextboxAndSliders = [&](
378 const TranslatableString& prompt,
379 const It& begin, const It& end) {
380 S.StartStatic(prompt);
381 S.StartMultiColumn(3, wxEXPAND);
382 {
383 S.SetStretchyCol(2);
384 std::for_each(begin, end, [&](ExtendedCompressorParameter& parameter) {
385 AddTextboxAndSlider(S, parameter);
386 });
387 }
388 S.EndMultiColumn();
389 S.EndStatic();
390 };
391
392 const auto firstSmoothingParameterIt =
393 std::find_if(mParameters.begin(), mParameters.end(), [](const auto& p) {
394 return p.category == ControllerCategory::TimeSmoothing;
395 });
396
397 S.StartPanel();
398 {
399 addTextboxAndSliders(
400 XO("Compression curve"), mParameters.begin(),
401 firstSmoothingParameterIt);
402 addTextboxAndSliders(
403 XO("Smoothing"), firstSmoothingParameterIt, mParameters.end());
404 }
405 S.EndPanel();
406}
std::vector< ExtendedCompressorParameter > mParameters
void AddTextboxAndSlider(ShuttleGui &S, ExtendedCompressorParameter &param)
Holds a msgid for the translation catalog; may also bind format arguments.
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101

References AddTextboxAndSlider(), details::begin(), details::end(), mParameters, S, and XO().

Referenced by PopulateOrExchange().

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

◆ AddTextboxAndSlider()

void DynamicRangeProcessorEditor::AddTextboxAndSlider ( ShuttleGui S,
ExtendedCompressorParameter param 
)
private

Definition at line 408 of file DynamicRangeProcessorEditor.cpp.

410{
411 setting.text = S.Validator<FloatingPointValidator<double>>(
412 1, &setting.value, NumValidatorStyle::ONE_TRAILING_ZERO,
413 setting.param->Min(), setting.param->Max())
414 .AddTextBox(setting.attributes.caption, L"", 12);
415
416 setting.text->Bind(wxEVT_TEXT, [&](wxCommandEvent& evt) {
417 if (!EnableApply(mUIParent, mUIParent->TransferDataFromWindow()))
418 return;
419 setting.slider->SetValue(TextToSliderValue(setting));
420 ValidateUI();
421 UpdateUI();
423 });
424
425 setting.slider =
426 S.Name(setting.attributes.caption)
427 .Style(wxSL_HORIZONTAL)
428 .MinSize({ 100, -1 })
429 .AddSlider(
430 {}, TextToSliderValue(setting), setting.param->SliderMax(),
431 setting.param->SliderMin());
432
433 setting.slider->Bind(wxEVT_SLIDER, [&](wxCommandEvent& evt) {
434 setting.value = SliderToTextValue(setting.slider->GetValue(), setting);
435 setting.text->GetValidator()->TransferToWindow();
436 EnableApply(mUIParent, mUIParent->Validate());
437 ValidateUI();
438 UpdateUI();
440 });
441
442 // For exponential slider, for right/down arrow keys, because
443 // the setting value has precision of 1, ensure that
444 // the change in slider position results a change in value of
445 // at least 0.1, otherwise the slider position and setting value
446 // may not change.
447 setting.slider->Bind(wxEVT_SCROLL_LINEDOWN, [&](wxScrollEvent& evt) {
448 if (setting.attributes.exponentialSlider
449 && setting.value == SliderToTextValue(evt.GetInt(), setting)) {
450 setting.value += 0.1;
451 setting.slider->SetValue(std::round(TextToSliderValue(setting)));
452 }
453 });
454
455 // And similarly for left/up arrow keys.
456 setting.slider->Bind(wxEVT_SCROLL_LINEUP, [&](wxScrollEvent& evt) {
457 if (setting.attributes.exponentialSlider
458 && setting.value == SliderToTextValue(evt.GetInt(), setting)) {
459 setting.value -= 0.1;
460 setting.slider->SetValue(std::round(TextToSliderValue(setting)));
461 }
462 });
463}
bool UpdateUI() final override
Update appearance of the panel for changes in settings.
bool ValidateUI() final override
Get settings data from the panel; may make error dialogs and return false.
static bool EnableApply(wxWindow *parent, bool enable=true)
Enable or disable the Apply button of the dialog that contains parent.
CallbackReturn Publish(const EffectSettingChanged &message)
Send a message to connected callbacks.
Definition: Observer.h:207
auto TextToSliderValue(ExtendedCompressorParameter &setting)
auto SliderToTextValue(double value, const ExtendedCompressorParameter &setting)
fastfloat_really_inline void round(adjusted_mantissa &am, callback cb) noexcept
Definition: fast_float.h:2512
Message sent by EffectEditor when a setting is changed by the user.
Definition: EffectEditor.h:26

References ExtendedCompressorParameter::attributes, DynamicRangeProcessorParameterAttributes::caption, EffectEditor::EnableApply(), DynamicRangeProcessorParameterAttributes::exponentialSlider, mUIParent, ExtendedCompressorParameter::param, Observer::Publisher< EffectSettingChanged >::Publish(), fast_float::round(), S, ExtendedCompressorParameter::slider, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::SliderToTextValue(), ExtendedCompressorParameter::text, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::TextToSliderValue(), UpdateUI(), ValidateUI(), and ExtendedCompressorParameter::value.

Referenced by AddSliderPanel().

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

◆ GetCompressorSettings() [1/2]

CompressorSettings * DynamicRangeProcessorEditor::GetCompressorSettings ( )
inlineprivate

Definition at line 121 of file DynamicRangeProcessorEditor.h.

122 {
123 return const_cast<CompressorSettings*>(
124 const_cast<const DynamicRangeProcessorEditor&>(*this)
126 }
virtual const CompressorSettings * GetCompressorSettings() const

References GetCompressorSettings().

Here is the call graph for this function:

◆ GetCompressorSettings() [2/2]

virtual const CompressorSettings * DynamicRangeProcessorEditor::GetCompressorSettings ( ) const
inlineprivatevirtual

Reimplemented in CompressorEditor.

Definition at line 111 of file DynamicRangeProcessorEditor.h.

112 {
113 return nullptr;
114 }

Referenced by GetCompressorSettings(), PopulateOrExchange(), UpdateUI(), and ValidateUI().

Here is the caller graph for this function:

◆ GetLimiterSettings() [1/2]

LimiterSettings * DynamicRangeProcessorEditor::GetLimiterSettings ( )
inlineprivate

Definition at line 128 of file DynamicRangeProcessorEditor.h.

129 {
130 return const_cast<LimiterSettings*>(
131 const_cast<const DynamicRangeProcessorEditor&>(*this)
133 }
virtual const LimiterSettings * GetLimiterSettings() const

References GetLimiterSettings().

Here is the call graph for this function:

◆ GetLimiterSettings() [2/2]

virtual const LimiterSettings * DynamicRangeProcessorEditor::GetLimiterSettings ( ) const
inlineprivatevirtual

Reimplemented in LimiterEditor.

Definition at line 116 of file DynamicRangeProcessorEditor.h.

117 {
118 return nullptr;
119 }

Referenced by GetLimiterSettings(), UpdateUI(), and ValidateUI().

Here is the caller graph for this function:

◆ Initialize()

void DynamicRangeProcessorEditor::Initialize ( std::vector< ExtendedCompressorParameter parameters)
protected

Definition at line 142 of file DynamicRangeProcessorEditor.cpp.

144{
145 assert(std::is_sorted(
146 parameters.begin(), parameters.end(),
147 [](const auto& a, const auto& b) { return a.category < b.category; }));
148 mParameters = std::move(parameters);
149}

References mParameters.

Referenced by CompressorEditor::CompressorEditor(), and LimiterEditor::LimiterEditor().

Here is the caller graph for this function:

◆ OnCheckbox()

void DynamicRangeProcessorEditor::OnCheckbox ( bool  newVal,
double &  setting,
void(DynamicRangeProcessorHistoryPanel::*)(bool)  setter 
)
private

Definition at line 496 of file DynamicRangeProcessorEditor.cpp.

499{
500 setting = newVal;
501 if (
502 const auto panel = dynamic_cast<HistPanel*>(
503 wxWindow::FindWindowById(historyPanelId, mUIParent)))
504 (panel->*setter)(newVal);
505 ValidateUI();
507}

References anonymous_namespace{DynamicRangeProcessorEditor.cpp}::historyPanelId, mUIParent, Observer::Publisher< EffectSettingChanged >::Publish(), and ValidateUI().

Referenced by AddCheckboxPanel().

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

◆ PopulateOrExchange()

void DynamicRangeProcessorEditor::PopulateOrExchange ( ShuttleGui S)

Definition at line 151 of file DynamicRangeProcessorEditor.cpp.

152{
153 S.SetBorder(borderSize);
154 S.AddSpace(0, borderSize);
155
156 const auto compressorSettings = GetCompressorSettings();
157 if (compressorSettings)
158 {
159 S.StartMultiColumn(2, wxEXPAND);
160 {
161 S.SetStretchyCol(0);
163 AddCompressionCurvePanel(S, *compressorSettings);
164 }
165 S.EndMultiColumn();
166 }
167 else
169
170 if (!mIsRealtime)
171 // Not a real-time effect editor, no need for a graph
172 return;
173
174 const auto settings = GetSettings(mAccess);
175
176 const auto rulerPanel = MakeRulerPanel(
177 mUIParent, wxVERTICAL,
180
181 const auto onDbRangeChanged = [this](float newDbRange) {
182 for (const auto id :
184 if (
185 const auto panel = dynamic_cast<RulerPanel*>(
186 wxWindow::FindWindowById(id, mUIParent)))
187 {
188 panel->ruler.SetRange(0., -newDbRange);
189 panel->Refresh();
190 }
191 if (
192 const auto compressionMeterPanel =
193 dynamic_cast<CompressionMeterPanel*>(
194 wxWindow::FindWindowById(compressionMeterPanelId, mUIParent)))
195 compressionMeterPanel->SetDbRange(newDbRange);
196 };
197
198 const auto histPanel = safenew HistPanel(
199 mUIParent, historyPanelId, mCompressorInstance, onDbRangeChanged);
200 histPanel->ShowInput(settings.showInput);
201 histPanel->ShowOutput(settings.showOutput);
202 histPanel->ShowActual(settings.showActual);
203 histPanel->ShowTarget(settings.showTarget);
204
205 S.StartMultiColumn(compressorSettings ? 3 : 1, wxEXPAND);
206 {
207 S.SetStretchyCol(0);
209 if (compressorSettings)
210 {
212 S.AddSpace(rulerWidth, 0);
213 }
214 }
215 S.EndMultiColumn();
216
217 S.SetSizerProportion(1);
218 S.StartMultiColumn(5, wxEXPAND);
219 {
220 using namespace DynamicRangeProcessorPanel;
221
222 S.SetStretchyCol(1);
223 S.SetStretchyRow(0);
224 S.AddSpace(borderSize, 0);
225 S.Prop(1)
226 .Position(wxALIGN_LEFT | wxALIGN_TOP | wxEXPAND)
227 .MinSize({ HistPanel::minWidth, graphMinHeight })
228 .AddWindow(histPanel);
229
230 S.AddSpace(borderSize, 0);
231
232 const auto onClipped = [this] {
233 if (
234 const auto panel = dynamic_cast<ClipIndicatorPanel*>(
235 wxWindow::FindWindowById(clipIndicatorId, mUIParent)))
236 panel->SetClipped();
237 };
238 S.Prop(1)
239 .Position(wxALIGN_LEFT | wxALIGN_TOP | wxEXPAND)
243 graphMinRangeDb, onClipped))
244 ->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& evt) {
245 if (
246 const auto panel =
247 dynamic_cast<CompressionMeterPanel*>(evt.GetEventObject()))
248 panel->Reset();
249 if (
250 const auto indicator = dynamic_cast<ClipIndicatorPanel*>(
251 wxWindow::FindWindowById(clipIndicatorId, mUIParent)))
252 indicator->Reset();
253 });
254
255 S.Prop(1)
256 .Position(wxEXPAND | wxALIGN_TOP)
257 .MinSize({ rulerWidth, graphMinHeight })
258 .AddWindow(rulerPanel);
259 }
260 S.EndMultiColumn();
261
262 S.AddSpace(0, borderSize);
263}
static float GetMaxCompressionDb(const DynamicRangeProcessorSettings &settings)
void AddCompressionCurvePanel(ShuttleGui &S, const CompressorSettings &)
void AddCheckboxPanel(ShuttleGui &S, const DynamicRangeProcessorSettings &settings)
EffectSettingsAccess & mAccess
Definition: EffectEditor.h:92
RulerPanel class allows you to work with a Ruler like any other wxWindow.
Definition: RulerPanel.h:19
DynamicRangeProcessorSettings GetSettings(EffectSettingsAccess &access)

References AddCheckboxPanel(), AddClipIndicator(), AddCompressionCurvePanel(), AddSliderPanel(), anonymous_namespace{DynamicRangeProcessorEditor.cpp}::borderSize, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::clipIndicatorId, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::compressionMeterPanelId, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::compressionMeterPanelWidth, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::compressionMeterRulerPanelId, GetCompressorSettings(), anonymous_namespace{DynamicRangeProcessorEditor.cpp}::GetDbRange(), CompressorProcessor::GetMaxCompressionDb(), anonymous_namespace{DynamicRangeProcessorEditor.cpp}::GetSettings(), DynamicRangeProcessorPanel::graphMinHeight, DynamicRangeProcessorPanel::graphMinRangeDb, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::historyPanelId, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::historyRulerPanelId, EffectEditor::mAccess, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::MakeRulerPanel(), mCompressorInstance, mIsRealtime, mUIParent, anonymous_namespace{DynamicRangeProcessorEditor.cpp}::rulerWidth, S, safenew, and settings().

Here is the call graph for this function:

◆ UpdateUI()

bool DynamicRangeProcessorEditor::UpdateUI ( )
finaloverrideprivatevirtual

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 478 of file DynamicRangeProcessorEditor.cpp.

479{
480 if (CompressorSettings* compressorSettings = GetCompressorSettings())
481 *compressorSettings = *mAccess.Get().cast<CompressorSettings>();
482 else
484
485 for (auto& setting : mParameters)
486 setting.slider->SetValue(std::round(TextToSliderValue(setting)));
487
488 if (
489 auto tfPanel =
490 wxWindow::FindWindowById(transferFunctionPanelId, mUIParent))
491 tfPanel->Refresh();
492
493 return true;
494}
virtual const EffectSettings & Get()=0
const T * cast() const noexcept
Like pointer-valued any_cast but a non-static member function.
Definition: TypedAny.h:68

References audacity::TypedAny< Tag >::cast(), EffectSettingsAccess::Get(), GetCompressorSettings(), GetLimiterSettings(), EffectEditor::mAccess, mParameters, mUIParent, fast_float::round(), anonymous_namespace{DynamicRangeProcessorEditor.cpp}::TextToSliderValue(), and anonymous_namespace{DynamicRangeProcessorEditor.cpp}::transferFunctionPanelId.

Referenced by AddTextboxAndSlider().

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

◆ ValidateUI()

bool DynamicRangeProcessorEditor::ValidateUI ( )
finaloverrideprivatevirtual

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

Returns
true only if panel settings are acceptable

Implements EffectEditor.

Definition at line 465 of file DynamicRangeProcessorEditor.cpp.

466{
468 // pass back the modified settings to the MessageBuffer
469 if (auto compressorSettings = settings.cast<CompressorSettings>())
470 *compressorSettings = *GetCompressorSettings();
471 else
473 return nullptr;
474 });
475 return true;
476}
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
Externalized state of a plug-in.

References GetCompressorSettings(), GetLimiterSettings(), EffectEditor::mAccess, EffectSettingsAccess::ModifySettings(), and settings().

Referenced by AddTextboxAndSlider(), and OnCheckbox().

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

Member Data Documentation

◆ dbStep

constexpr auto DynamicRangeProcessorEditor::dbStep = 0.1
staticconstexprprotected

Definition at line 99 of file DynamicRangeProcessorEditor.h.

◆ mCompressorInstance

CompressorInstance& DynamicRangeProcessorEditor::mCompressorInstance
private

Definition at line 152 of file DynamicRangeProcessorEditor.h.

Referenced by PopulateOrExchange().

◆ mFullHeight

int DynamicRangeProcessorEditor::mFullHeight { 0 }
private

Definition at line 154 of file DynamicRangeProcessorEditor.h.

◆ mIsRealtime

const bool DynamicRangeProcessorEditor::mIsRealtime
private

Definition at line 153 of file DynamicRangeProcessorEditor.h.

Referenced by PopulateOrExchange().

◆ mParameters

std::vector<ExtendedCompressorParameter> DynamicRangeProcessorEditor::mParameters
private

Definition at line 150 of file DynamicRangeProcessorEditor.h.

Referenced by AddSliderPanel(), Initialize(), and UpdateUI().

◆ mTopLevelParent

wxDialog& DynamicRangeProcessorEditor::mTopLevelParent
private

Definition at line 151 of file DynamicRangeProcessorEditor.h.

◆ mUIParent

wxWeakRef<wxWindow> DynamicRangeProcessorEditor::mUIParent
private

The documentation for this class was generated from the following files: