Audacity 3.2.0
AutoDuck.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 AutoDuck.h
6
7 Markus Meyer
8
9**********************************************************************/
10
11#ifndef __AUDACITY_EFFECT_AUTODUCK__
12#define __AUDACITY_EFFECT_AUTODUCK__
13
14#include "AutoDuckBase.h"
16#include <float.h> // for DBL_MAX
17#include "wxPanelWrapper.h"
18
19class wxBitmap;
20class wxTextCtrl;
21class ShuttleGui;
22class WaveChannel;
23
24#define AUTO_DUCK_PANEL_NUM_CONTROL_POINTS 5
25
26class EffectAutoDuck final :
27 public AutoDuckBase,
29{
30public:
31 std::unique_ptr<EffectEditor> PopulateOrExchange(
33 const EffectOutputs* pOutputs) override;
34 bool TransferDataToWindow(const EffectSettings& settings) override;
37
38 DECLARE_EVENT_TABLE()
39
40private:
41 void OnValueChanged(wxCommandEvent & evt);
42
43 wxWeakRef<wxWindow> mUIParent{};
44
45 wxTextCtrl *mDuckAmountDbBox;
47 wxTextCtrl *mInnerFadeUpLenBox;
49 wxTextCtrl *mOuterFadeUpLenBox;
50 wxTextCtrl *mThresholdDbBox;
51 wxTextCtrl *mMaximumPauseBox;
52
53 class Panel;
55};
56
58{
59public:
60 Panel(
61 wxWindow *parent, wxWindowID winid, EffectAutoDuck *effect);
62 virtual ~Panel();
63
64private:
66 {
72 none = 99,
73 };
74
75 bool AcceptsFocus() const override { return false; }
76 // So that wxPanel is not included in Tab traversal - see wxWidgets bug 15581
77 bool AcceptsFocusFromKeyboard() const override { return false; }
78
79
80 void OnPaint(wxPaintEvent & evt);
81 void OnMouseCaptureChanged(wxMouseCaptureChangedEvent & evt);
82 void OnMouseCaptureLost(wxMouseCaptureLostEvent & evt);
83 void OnLeftDown(wxMouseEvent & evt);
84 void OnLeftUp(wxMouseEvent & evt);
85 void OnMotion(wxMouseEvent & evt);
86
87 void ResetControlPoints();
88 EControlPoint GetNearestControlPoint(const wxPoint & pt);
89
90private:
91 wxWindow *mParent;
93 std::unique_ptr<wxBitmap> mBackgroundBitmap;
99
100 DECLARE_EVENT_TABLE()
101};
102
103#endif
#define AUTO_DUCK_PANEL_NUM_CONTROL_POINTS
Definition: AutoDuck.h:24
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:51
Implements the Auto Ducking effect.
Definition: AutoDuckBase.h:19
std::unique_ptr< wxBitmap > mBackgroundBitmap
Definition: AutoDuck.h:93
EControlPoint GetNearestControlPoint(const wxPoint &pt)
Definition: AutoDuck.cpp:387
bool mControlPointMoveActivated
Definition: AutoDuck.h:98
void OnMotion(wxMouseEvent &evt)
Definition: AutoDuck.cpp:435
wxWindow * mParent
Definition: AutoDuck.h:91
Panel(wxWindow *parent, wxWindowID winid, EffectAutoDuck *effect)
Definition: AutoDuck.cpp:178
bool AcceptsFocusFromKeyboard() const override
Definition: AutoDuck.h:77
wxPoint mMouseDownPoint
Definition: AutoDuck.h:97
void OnLeftDown(wxMouseEvent &evt)
Definition: AutoDuck.cpp:406
EControlPoint mCurrentControlPoint
Definition: AutoDuck.h:94
void OnMouseCaptureChanged(wxMouseCaptureChangedEvent &evt)
Definition: AutoDuck.cpp:368
EffectAutoDuck * mEffect
Definition: AutoDuck.h:92
void OnLeftUp(wxMouseEvent &evt)
Definition: AutoDuck.cpp:426
bool AcceptsFocus() const override
Definition: AutoDuck.h:75
void OnPaint(wxPaintEvent &evt)
Definition: AutoDuck.cpp:205
void OnMouseCaptureLost(wxMouseCaptureLostEvent &evt)
Definition: AutoDuck.cpp:375
wxPoint mMoveStartControlPoints[AUTO_DUCK_PANEL_NUM_CONTROL_POINTS]
Definition: AutoDuck.h:96
wxPoint mControlPoints[AUTO_DUCK_PANEL_NUM_CONTROL_POINTS]
Definition: AutoDuck.h:95
wxTextCtrl * mInnerFadeUpLenBox
Definition: AutoDuck.h:47
wxTextCtrl * mInnerFadeDownLenBox
Definition: AutoDuck.h:46
Panel * mPanel
Definition: AutoDuck.h:54
wxTextCtrl * mOuterFadeDownLenBox
Definition: AutoDuck.h:48
bool DoTransferDataToWindow()
Definition: AutoDuck.cpp:117
wxTextCtrl * mThresholdDbBox
Definition: AutoDuck.h:50
wxWeakRef< wxWindow > mUIParent
Definition: AutoDuck.h:43
bool TransferDataToWindow(const EffectSettings &settings) override
Definition: AutoDuck.cpp:112
void OnValueChanged(wxCommandEvent &evt)
Definition: AutoDuck.cpp:138
bool TransferDataFromWindow(EffectSettings &settings) override
Definition: AutoDuck.cpp:128
wxTextCtrl * mMaximumPauseBox
Definition: AutoDuck.h:51
wxTextCtrl * mOuterFadeUpLenBox
Definition: AutoDuck.h:49
wxTextCtrl * mDuckAmountDbBox
Definition: AutoDuck.h:45
std::unique_ptr< EffectEditor > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
Add controls to effect panel; always succeeds.
Definition: AutoDuck.cpp:34
Performs effect computation.
Hold values to send to effect output meters.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Externalized state of a plug-in.