Audacity  3.0.3
Compressor.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Compressor.h
6 
7  Dominic Mazzoni
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_EFFECT_COMPRESSOR__
12 #define __AUDACITY_EFFECT_COMPRESSOR__
13 
14 #include "TwoPassSimpleMono.h"
15 
16 class wxCheckBox;
17 class wxSlider;
18 class wxStaticText;
20 class ShuttleGui;
21 
23 {
24 public:
26 
28  virtual ~EffectCompressor();
29 
30  // ComponentInterface implementation
31 
34  ManualPageID ManualPage() override;
35 
36  // EffectDefinitionInterface implementation
37 
38  EffectType GetType() override;
39 
40  // EffectClientInterface implementation
41 
42  bool DefineParams( ShuttleParams & S ) override;
43  bool GetAutomationParameters(CommandParameters & parms) override;
44  bool SetAutomationParameters(CommandParameters & parms) override;
45 
46  // Effect implementation
47 
48  bool Startup() override;
49  void PopulateOrExchange(ShuttleGui & S) override;
50  bool TransferDataToWindow() override;
51  bool TransferDataFromWindow() override;
52 
53 protected:
54  // EffectTwoPassSimpleMono implementation
55 
56  bool InitPass1() override;
57  bool InitPass2() override;
58  bool NewTrackPass1() override;
59  bool ProcessPass2(float *buffer, size_t len) override;
61  (float *buffer1, size_t len1, float *buffer2, size_t len2) override;
62 
63 private:
64  // EffectCompressor implementation
65 
66  void FreshenCircle();
67  float AvgCircle(float x);
68  void Follow(float *buffer, float *env, size_t len, float *previous, size_t previous_len);
69  float DoCompression(float x, double env);
70 
71  void OnSlider(wxCommandEvent & evt);
72  void UpdateUI();
73 
74 private:
75  double mRMSSum;
76  size_t mCircleSize;
77  size_t mCirclePos;
79 
80  double mAttackTime;
81  double mThresholdDB;
82  double mNoiseFloorDB;
83  double mRatio;
84  bool mNormalize; //MJS
85  bool mUsePeak;
86 
87  double mDecayTime; // The "Release" time.
88  double mAttackFactor;
90  double mDecayFactor;
91  double mThreshold;
92  double mCompression;
93  double mNoiseFloor;
95  double mGain;
96  double mLastLevel;
98  size_t mFollowLen;
99 
100  double mMax; //MJS
101 
103 
104  wxStaticText *mThresholdLabel;
105  wxSlider *mThresholdSlider;
106  wxStaticText *mThresholdText;
107 
108  wxStaticText *mNoiseFloorLabel;
109  wxSlider *mNoiseFloorSlider;
110  wxStaticText *mNoiseFloorText;
111 
112  wxStaticText *mRatioLabel;
113  wxSlider *mRatioSlider;
114  wxStaticText *mRatioText;
115 
116  wxStaticText *mAttackLabel;
117  wxSlider *mAttackSlider;
118  wxStaticText *mAttackText;
119 
120  wxStaticText *mDecayLabel;
121  wxSlider *mDecaySlider;
122  wxStaticText *mDecayText;
123 
124  wxCheckBox *mGainCheckBox;
125  wxCheckBox *mPeakCheckBox;
126 
127  DECLARE_EVENT_TABLE()
128 };
129 
131 {
132 public:
133  EffectCompressorPanel(wxWindow *parent, wxWindowID winid,
134  double & threshold,
135  double & noiseFloor,
136  double & ratio);
137 
138 private:
139  void OnPaint(wxPaintEvent & evt);
140  void OnSize(wxSizeEvent & evt);
141 
142 private:
143  double & threshold;
144  double & noiseFloor;
145  double & ratio;
146 
147  DECLARE_EVENT_TABLE()
148 };
149 
150 #endif
151 
EffectCompressor::GetDescription
TranslatableString GetDescription() override
Definition: Compressor.cpp:113
EffectCompressor::mCompression
double mCompression
Definition: Compressor.h:92
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
EffectCompressor
An Effect derived from EffectTwoPassSimpleMono.
Definition: Compressor.h:23
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
EffectCompressor::ManualPage
ManualPageID ManualPage() override
Definition: Compressor.cpp:118
EffectCompressor::mRatioLabel
wxStaticText * mRatioLabel
Definition: Compressor.h:112
EffectCompressor::mCircle
Doubles mCircle
Definition: Compressor.h:78
wxPanelWrapper
Definition: wxPanelWrapper.h:41
EffectCompressor::mNoiseFloorLabel
wxStaticText * mNoiseFloorLabel
Definition: Compressor.h:108
EffectCompressor::mFollow1
Floats mFollow1
Definition: Compressor.h:97
EffectCompressor::mNoiseFloor
double mNoiseFloor
Definition: Compressor.h:93
EffectCompressor::InitPass1
bool InitPass1() override
Definition: Compressor.cpp:422
EffectCompressor::mGain
double mGain
Definition: Compressor.h:95
EffectCompressor::mNoiseCounter
int mNoiseCounter
Definition: Compressor.h:94
EffectCompressor::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: Compressor.cpp:245
EffectCompressor::mAttackTime
double mAttackTime
Definition: Compressor.h:80
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:62
EffectCompressor::mThresholdText
wxStaticText * mThresholdText
Definition: Compressor.h:106
EffectCompressor::mRatioText
wxStaticText * mRatioText
Definition: Compressor.h:114
EffectCompressor::mThresholdLabel
wxStaticText * mThresholdLabel
Definition: Compressor.h:104
EffectCompressor::~EffectCompressor
virtual ~EffectCompressor()
Definition: Compressor.cpp:102
EffectCompressor::mThresholdSlider
wxSlider * mThresholdSlider
Definition: Compressor.h:105
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
EffectCompressor::mNoiseFloorSlider
wxSlider * mNoiseFloorSlider
Definition: Compressor.h:109
EffectTwoPassSimpleMono
An Effect base class that implements a two pass process by using EffectSimpleMono.
Definition: TwoPassSimpleMono.h:21
EffectCompressor::mThreshold
double mThreshold
Definition: Compressor.h:91
EffectCompressor::mCirclePos
size_t mCirclePos
Definition: Compressor.h:77
EffectCompressor::mDecayTime
double mDecayTime
Definition: Compressor.h:87
EffectCompressor::InitPass2
bool InitPass2() override
Definition: Compressor.cpp:444
EffectCompressor::NewTrackPass1
bool NewTrackPass1() override
Definition: Compressor.cpp:397
EffectCompressor::mPeakCheckBox
wxCheckBox * mPeakCheckBox
Definition: Compressor.h:125
EffectCompressor::mAttackInverseFactor
double mAttackInverseFactor
Definition: Compressor.h:89
EffectCompressor::GetType
EffectType GetType() override
Definition: Compressor.cpp:125
EffectCompressor::OnSlider
void OnSlider(wxCommandEvent &evt)
Definition: Compressor.cpp:663
EffectCompressor::mAttackLabel
wxStaticText * mAttackLabel
Definition: Compressor.h:116
EffectCompressor::mGainCheckBox
wxCheckBox * mGainCheckBox
Definition: Compressor.h:124
EffectCompressorPanel::noiseFloor
double & noiseFloor
Definition: Compressor.h:144
EffectCompressor::mDecayFactor
double mDecayFactor
Definition: Compressor.h:90
EffectCompressorPanel::OnPaint
void OnPaint(wxPaintEvent &evt)
Definition: Compressor.cpp:718
EffectCompressor::AvgCircle
float AvgCircle(float x)
Definition: Compressor.cpp:517
EffectCompressor::mFollow2
Floats mFollow2
Definition: Compressor.h:97
EffectCompressor::mMax
double mMax
Definition: Compressor.h:100
TwoPassSimpleMono.h
EffectCompressor::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: Compressor.cpp:155
EffectCompressor::UpdateUI
void UpdateUI()
Definition: Compressor.cpp:669
EffectCompressor::mRMSSum
double mRMSSum
Definition: Compressor.h:75
EffectCompressor::mDecayText
wxStaticText * mDecayText
Definition: Compressor.h:122
EffectCompressor::mAttackText
wxStaticText * mAttackText
Definition: Compressor.h:118
EffectCompressorPanel::EffectCompressorPanel
EffectCompressorPanel(wxWindow *parent, wxWindowID winid, double &threshold, double &noiseFloor, double &ratio)
Definition: Compressor.cpp:707
EffectCompressor::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: Compressor.cpp:142
EffectCompressor::EffectCompressor
EffectCompressor()
Definition: Compressor.cpp:84
EffectCompressor::mDecayLabel
wxStaticText * mDecayLabel
Definition: Compressor.h:120
EffectCompressor::mAttackSlider
wxSlider * mAttackSlider
Definition: Compressor.h:117
EffectCompressor::DoCompression
float DoCompression(float x, double env)
Definition: Compressor.cpp:645
EffectCompressor::TwoBufferProcessPass1
bool TwoBufferProcessPass1(float *buffer1, size_t len1, float *buffer2, size_t len2) override
Definition: Compressor.cpp:455
EffectCompressor::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Compressor.h:25
EffectCompressor::mNoiseFloorText
wxStaticText * mNoiseFloorText
Definition: Compressor.h:110
EffectCompressor::mCircleSize
size_t mCircleSize
Definition: Compressor.h:76
TaggedIdentifier< ManualPageIDTag >
EffectCompressor::TransferDataToWindow
bool TransferDataToWindow() override
Definition: Compressor.cpp:362
EffectCompressor::mNormalize
bool mNormalize
Definition: Compressor.h:84
EffectCompressor::Follow
void Follow(float *buffer, float *env, size_t len, float *previous, size_t previous_len)
Definition: Compressor.cpp:532
EffectCompressor::mFollowLen
size_t mFollowLen
Definition: Compressor.h:98
EffectCompressor::mDecaySlider
wxSlider * mDecaySlider
Definition: Compressor.h:121
EffectCompressor::mUsePeak
bool mUsePeak
Definition: Compressor.h:85
EffectCompressorPanel
Definition: Compressor.h:131
EffectCompressorPanel::ratio
double & ratio
Definition: Compressor.h:145
EffectCompressorPanel::OnSize
void OnSize(wxSizeEvent &evt)
Definition: Compressor.cpp:812
EffectCompressorPanel::threshold
double & threshold
Definition: Compressor.h:143
EffectCompressor::mAttackFactor
double mAttackFactor
Definition: Compressor.h:88
EffectCompressor::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: Compressor.cpp:377
EffectCompressor::FreshenCircle
void FreshenCircle()
Definition: Compressor.cpp:508
EffectType
EffectType
Definition: EffectInterface.h:55
EffectCompressor::mRatio
double mRatio
Definition: Compressor.h:83
EffectCompressor::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: Compressor.cpp:108
EffectCompressor::mRatioSlider
wxSlider * mRatioSlider
Definition: Compressor.h:113
EffectCompressor::ProcessPass2
bool ProcessPass2(float *buffer, size_t len) override
Definition: Compressor.cpp:497
EffectCompressor::DefineParams
bool DefineParams(ShuttleParams &S) override
Definition: Compressor.cpp:131
ArrayOf< double >
EffectCompressor::mNoiseFloorDB
double mNoiseFloorDB
Definition: Compressor.h:82
EffectCompressor::mLastLevel
double mLastLevel
Definition: Compressor.h:96
EffectCompressor::mThresholdDB
double mThresholdDB
Definition: Compressor.h:81
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
EffectCompressor::Startup
bool Startup() override
Definition: Compressor.cpp:178
EffectCompressor::mPanel
EffectCompressorPanel * mPanel
Definition: Compressor.h:102