Audacity  3.0.3
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 "Effect.h"
15 
16 class wxBitmap;
17 class wxTextCtrl;
19 class ShuttleGui;
20 
21 #define AUTO_DUCK_PANEL_NUM_CONTROL_POINTS 5
22 
23 class EffectAutoDuck final : public Effect
24 {
25 public:
27 
29  virtual ~EffectAutoDuck();
30 
31  // ComponentInterface implementation
32 
35  ManualPageID ManualPage() override;
36 
37  // EffectDefinitionInterface implementation
38 
39  EffectType GetType() override;
40 
41  // EffectClientInterface implementation
42 
43  bool DefineParams( ShuttleParams & S ) override;
44  bool GetAutomationParameters(CommandParameters & parms) override;
45  bool SetAutomationParameters(CommandParameters & parms) override;
46 
47  // Effect implementation
48 
49  bool Startup() override;
50  bool Init() override;
51  void End() override;
52  bool Process() override;
53  void PopulateOrExchange(ShuttleGui & S) override;
54  bool TransferDataToWindow() override;
55  bool TransferDataFromWindow() override;
56 
57 private:
58  // EffectAutoDuck implementation
59 
60  bool ApplyDuckFade(int trackNum, WaveTrack *t, double t0, double t1);
61 
62  void OnValueChanged(wxCommandEvent & evt);
63 
64 private:
65  double mDuckAmountDb;
70  double mThresholdDb;
71  double mMaximumPause;
72 
74 
75  wxTextCtrl *mDuckAmountDbBox;
76  wxTextCtrl *mInnerFadeDownLenBox;
77  wxTextCtrl *mInnerFadeUpLenBox;
78  wxTextCtrl *mOuterFadeDownLenBox;
79  wxTextCtrl *mOuterFadeUpLenBox;
80  wxTextCtrl *mThresholdDbBox;
81  wxTextCtrl *mMaximumPauseBox;
83 
84  DECLARE_EVENT_TABLE()
85 
86  friend class EffectAutoDuckPanel;
87 };
88 
89 class EffectAutoDuckPanel final : public wxPanelWrapper
90 {
91 public:
93  wxWindow *parent, wxWindowID winid, EffectAutoDuck *effect);
94  virtual ~EffectAutoDuckPanel();
95 
96 private:
98  {
99  innerFadeDown = 0,
104  none = 99,
105  };
106 
107  bool AcceptsFocus() const override { return false; }
108  // So that wxPanel is not included in Tab traversal - see wxWidgets bug 15581
109  bool AcceptsFocusFromKeyboard() const override { return false; }
110 
111 
112  void OnPaint(wxPaintEvent & evt);
113  void OnMouseCaptureChanged(wxMouseCaptureChangedEvent & evt);
114  void OnMouseCaptureLost(wxMouseCaptureLostEvent & evt);
115  void OnLeftDown(wxMouseEvent & evt);
116  void OnLeftUp(wxMouseEvent & evt);
117  void OnMotion(wxMouseEvent & evt);
118 
119  void ResetControlPoints();
120  EControlPoint GetNearestControlPoint(const wxPoint & pt);
121 
122 private:
123  wxWindow *mParent;
125  std::unique_ptr<wxBitmap> mBackgroundBitmap;
127  wxPoint mControlPoints[AUTO_DUCK_PANEL_NUM_CONTROL_POINTS];
128  wxPoint mMoveStartControlPoints[AUTO_DUCK_PANEL_NUM_CONTROL_POINTS];
131 
132  DECLARE_EVENT_TABLE()
133 };
134 
135 #endif
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
EffectAutoDuck::mMaximumPause
double mMaximumPause
Definition: AutoDuck.h:71
EffectAutoDuckPanel::mEffect
EffectAutoDuck * mEffect
Definition: AutoDuck.h:124
EffectAutoDuck::mInnerFadeUpLen
double mInnerFadeUpLen
Definition: AutoDuck.h:67
EffectAutoDuckPanel::outerFadeUp
@ outerFadeUp
Definition: AutoDuck.h:102
Effect.h
EffectAutoDuck::ManualPage
ManualPageID ManualPage() override
Definition: AutoDuck.cpp:121
wxPanelWrapper
Definition: wxPanelWrapper.h:41
Effect
Base class for many of the effects in Audacity.
Definition: Effect.h:72
EffectAutoDuck::mThresholdDb
double mThresholdDb
Definition: AutoDuck.h:70
EffectAutoDuck::mOuterFadeDownLen
double mOuterFadeDownLen
Definition: AutoDuck.h:68
EffectAutoDuck::mOuterFadeUpLen
double mOuterFadeUpLen
Definition: AutoDuck.h:69
EffectAutoDuckPanel::mBackgroundBitmap
std::unique_ptr< wxBitmap > mBackgroundBitmap
Definition: AutoDuck.h:125
EffectAutoDuckPanel::duckAmount
@ duckAmount
Definition: AutoDuck.h:103
EffectAutoDuck::OnValueChanged
void OnValueChanged(wxCommandEvent &evt)
Definition: AutoDuck.cpp:598
EffectAutoDuck::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: AutoDuck.cpp:427
EffectAutoDuck::mInnerFadeDownLenBox
wxTextCtrl * mInnerFadeDownLenBox
Definition: AutoDuck.h:76
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:62
EffectAutoDuck::GetType
EffectType GetType() override
Definition: AutoDuck.cpp:128
EffectAutoDuck::mOuterFadeUpLenBox
wxTextCtrl * mOuterFadeUpLenBox
Definition: AutoDuck.h:79
EffectAutoDuckPanel::mMouseDownPoint
wxPoint mMouseDownPoint
Definition: AutoDuck.h:129
EffectAutoDuckPanel::EControlPoint
EControlPoint
Definition: AutoDuck.h:98
EffectAutoDuck::mInnerFadeDownLen
double mInnerFadeDownLen
Definition: AutoDuck.h:66
AUTO_DUCK_PANEL_NUM_CONTROL_POINTS
#define AUTO_DUCK_PANEL_NUM_CONTROL_POINTS
Definition: AutoDuck.h:21
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
EffectAutoDuckPanel::AcceptsFocus
bool AcceptsFocus() const override
Definition: AutoDuck.h:107
EffectAutoDuckPanel
Definition: AutoDuck.h:90
EffectAutoDuck::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: AutoDuck.cpp:145
EffectAutoDuck::mInnerFadeUpLenBox
wxTextCtrl * mInnerFadeUpLenBox
Definition: AutoDuck.h:77
EffectAutoDuck::EffectAutoDuckPanel
friend class EffectAutoDuckPanel
Definition: AutoDuck.h:86
EffectAutoDuck::ApplyDuckFade
bool ApplyDuckFade(int trackNum, WaveTrack *t, double t0, double t1)
Definition: AutoDuck.cpp:534
EffectAutoDuck::mDuckAmountDbBox
wxTextCtrl * mDuckAmountDbBox
Definition: AutoDuck.h:75
EffectAutoDuck::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: AutoDuck.cpp:521
EffectAutoDuck::mThresholdDbBox
wxTextCtrl * mThresholdDbBox
Definition: AutoDuck.h:80
none
@ none
Definition: Dither.h:20
EffectAutoDuck::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: AutoDuck.cpp:111
EffectAutoDuck::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: AutoDuck.cpp:158
EffectAutoDuckPanel::mCurrentControlPoint
EControlPoint mCurrentControlPoint
Definition: AutoDuck.h:126
EffectAutoDuck::mPanel
EffectAutoDuckPanel * mPanel
Definition: AutoDuck.h:82
EffectAutoDuck::mDuckAmountDb
double mDuckAmountDb
Definition: AutoDuck.h:65
EffectAutoDuckPanel::mControlPointMoveActivated
bool mControlPointMoveActivated
Definition: AutoDuck.h:130
EffectAutoDuckPanel::outerFadeDown
@ outerFadeDown
Definition: AutoDuck.h:100
EffectAutoDuck::Init
bool Init() override
Definition: AutoDuck.cpp:214
TaggedIdentifier< ManualPageIDTag >
EffectAutoDuck::Startup
bool Startup() override
Definition: AutoDuck.cpp:181
EffectAutoDuckPanel::innerFadeUp
@ innerFadeUp
Definition: AutoDuck.h:101
EffectAutoDuck::mControlTrack
const WaveTrack * mControlTrack
Definition: AutoDuck.h:73
EffectAutoDuck::mMaximumPauseBox
wxTextCtrl * mMaximumPauseBox
Definition: AutoDuck.h:81
EffectAutoDuck
Implements the Auto Ducking effect.
Definition: AutoDuck.h:24
EffectAutoDuck::~EffectAutoDuck
virtual ~EffectAutoDuck()
Definition: AutoDuck.cpp:105
EffectAutoDuck::EffectAutoDuck
EffectAutoDuck()
Definition: AutoDuck.cpp:88
EffectAutoDuck::GetDescription
TranslatableString GetDescription() override
Definition: AutoDuck.cpp:116
EffectAutoDuckPanel::AcceptsFocusFromKeyboard
bool AcceptsFocusFromKeyboard() const override
Definition: AutoDuck.h:109
EffectAutoDuck::DefineParams
bool DefineParams(ShuttleParams &S) override
Definition: AutoDuck.cpp:134
EffectAutoDuck::End
void End() override
Definition: AutoDuck.cpp:267
EffectType
EffectType
Definition: EffectInterface.h:55
EffectAutoDuckPanel::mParent
wxWindow * mParent
Definition: AutoDuck.h:123
EffectAutoDuck::TransferDataToWindow
bool TransferDataToWindow() override
Definition: AutoDuck.cpp:509
EffectAutoDuck::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: AutoDuck.h:26
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
EffectAutoDuck::Process
bool Process() override
Definition: AutoDuck.cpp:272
EffectAutoDuck::mOuterFadeDownLenBox
wxTextCtrl * mOuterFadeDownLenBox
Definition: AutoDuck.h:78