Audacity 3.2.0
DynamicRangeProcessorEditor.h
Go to the documentation of this file.
1#pragma once
2
4#include "EffectEditor.h"
5#include "Internat.h" // TranslatableString
6#include <optional>
7#include <wx/weakref.h>
8
10class RulerPanel;
11class wxDialog;
12class wxSlider;
13class wxTextCtrl;
15class ShuttleGui;
17struct LimiterSettings;
18
20{
22 const bool exponentialSlider = false;
23};
24
26 compressorThresholdDbAttributes { XXO("&Threshold (dB)") };
27
29 compressorMakupGainDbAttributes { XXO("&Make-up gain (dB)") };
30
32 limiterThresholdDbAttributes { XXO("&Threshold (dB)") };
33
35 limiterMakeupTargetDbAttributes { XXO("&Make-up target (dB)") };
36
38 XXO("Knee &width (dB)")
39};
40
42 compressionRatioAttributes { XXO("Rati&o:"), true };
43
45 XXO("&Lookahead (ms)"), true
46};
47
49 XXO("Attac&k (ms)"), true
50};
51
53 XXO("&Release (ms)"), true
54};
55
60{
61public:
63 virtual double Min() const = 0;
64 virtual double Max() const = 0;
65 virtual double SliderMin() const = 0;
66 virtual double SliderMax() const = 0;
67 virtual double TextToSlider() const = 0;
68};
69
71{
74};
75
77{
78 double& value;
80 const std::shared_ptr<DynamicRangeProcessorParameter> param;
82 wxTextCtrl* text = nullptr;
83 wxSlider* slider = nullptr;
84};
85
87{
88public:
90 wxWindow* parent, CompressorInstance& instance, bool isRealtime,
91 const EffectUIServices& services, EffectSettingsAccess& access);
92
93protected:
94 /*
95 * \pre `parameters` are sorted by categoy, `CompressionCurve` first and then
96 * `TimeSmoothing`.
97 */
98 void Initialize(std::vector<ExtendedCompressorParameter> parameters);
99 static constexpr auto dbStep = 0.1;
100
101public:
103
104private:
107 void AddCheckboxPanel(
110
112 {
113 return nullptr;
114 }
115
116 virtual const LimiterSettings* GetLimiterSettings() const
117 {
118 return nullptr;
119 }
120
122 {
123 return const_cast<CompressorSettings*>(
124 const_cast<const DynamicRangeProcessorEditor&>(*this)
126 }
127
129 {
130 return const_cast<LimiterSettings*>(
131 const_cast<const DynamicRangeProcessorEditor&>(*this)
133 }
134
136
137 bool ValidateUI() final override;
138 bool UpdateUI() final override;
139 void OnCheckbox(
140 bool newVal, double& setting,
141 void (DynamicRangeProcessorHistoryPanel::*)(bool));
142
144 {
147 };
148
149 wxWeakRef<wxWindow> mUIParent;
150 std::vector<ExtendedCompressorParameter> mParameters;
153 const bool mIsRealtime;
154 int mFullHeight { 0 };
155};
static const DynamicRangeProcessorParameterAttributes limiterThresholdDbAttributes
static const DynamicRangeProcessorParameterAttributes compressorMakupGainDbAttributes
static const DynamicRangeProcessorParameterAttributes limiterMakeupTargetDbAttributes
static const DynamicRangeProcessorParameterAttributes compressionRatioAttributes
static const DynamicRangeProcessorParameterAttributes lookaheadMsAttributes
static const DynamicRangeProcessorParameterAttributes kneeWidthDbAttributes
static const DynamicRangeProcessorParameterAttributes attackMsAttributes
static const DynamicRangeProcessorParameterAttributes compressorThresholdDbAttributes
static const DynamicRangeProcessorParameterAttributes releaseMsAttributes
XXO("&Cut/Copy/Paste Toolbar")
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:51
std::vector< ExtendedCompressorParameter > mParameters
void OnCheckbox(bool newVal, double &setting, void(DynamicRangeProcessorHistoryPanel::*)(bool))
void AddCompressionCurvePanel(ShuttleGui &S, const CompressorSettings &)
virtual const CompressorSettings * GetCompressorSettings() const
void Initialize(std::vector< ExtendedCompressorParameter > parameters)
DynamicRangeProcessorEditor(wxWindow *parent, CompressorInstance &instance, bool isRealtime, const EffectUIServices &services, EffectSettingsAccess &access)
virtual const LimiterSettings * GetLimiterSettings() const
void AddTextboxAndSlider(ShuttleGui &S, ExtendedCompressorParameter &param)
CompressorSettings * GetCompressorSettings()
void AddCheckboxPanel(ShuttleGui &S, const DynamicRangeProcessorSettings &settings)
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.
virtual double SliderMax() const =0
virtual double Max() const =0
virtual ~DynamicRangeProcessorParameter()=default
virtual double Min() const =0
virtual double SliderMin() const =0
virtual double TextToSlider() const =0
RulerPanel class allows you to work with a Ruler like any other wxWindow.
Definition: RulerPanel.h:19
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.
DynamicRangeProcessorHistoryPanel * historyPanel
const std::shared_ptr< DynamicRangeProcessorParameter > param
const DynamicRangeProcessorParameterAttributes & attributes