Audacity  2.2.0
Normalize.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Normalize.h
6 
7  Dominic Mazzoni
8  Vaughan Johnson (Preview)
9 
10 **********************************************************************/
11 
12 #ifndef __AUDACITY_EFFECT_NORMALIZE__
13 #define __AUDACITY_EFFECT_NORMALIZE__
14 
15 #include <wx/checkbox.h>
16 #include <wx/event.h>
17 #include <wx/stattext.h>
18 #include <wx/string.h>
19 #include <wx/textctrl.h>
20 
21 #include "Effect.h"
22 
23 class ShuttleGui;
24 
25 #define NORMALIZE_PLUGIN_SYMBOL XO("Normalize")
26 
27 class EffectNormalize final : public Effect
28 {
29 public:
31  virtual ~EffectNormalize();
32 
33  // IdentInterface implementation
34 
35  wxString GetSymbol() override;
36  wxString GetDescription() override;
37  wxString ManualPage() override;
38 
39  // EffectIdentInterface implementation
40 
41  EffectType GetType() override;
42 
43  // EffectClientInterface implementation
44 
45  bool GetAutomationParameters(EffectAutomationParameters & parms) override;
46  bool SetAutomationParameters(EffectAutomationParameters & parms) override;
47 
48  // Effect implementation
49 
50  bool CheckWhetherSkipEffect() override;
51  bool Startup() override;
52  bool Process() override;
53  void PopulateOrExchange(ShuttleGui & S) override;
54  bool TransferDataToWindow() override;
55  bool TransferDataFromWindow() override;
56 
57 private:
58  // EffectNormalize implementation
59 
60  bool ProcessOne(
61  WaveTrack * t, const wxString &msg, int curTrackNum, float offset);
62  bool AnalyseTrack(const WaveTrack * track, const wxString &msg,
63  int curTrackNum,
64  float &offset, float &min, float &max);
65  void AnalyzeData(float *buffer, size_t len);
66  bool AnalyseDC(const WaveTrack * track, const wxString &msg, int curTrackNum,
67  float &offset);
68  void ProcessData(float *buffer, size_t len, float offset);
69 
70  void OnUpdateUI(wxCommandEvent & evt);
71  void UpdateUI();
72 
73 private:
74  double mLevel;
75  bool mGain;
76  bool mDC;
77  bool mStereoInd;
78 
79  double mCurT0;
80  double mCurT1;
81  float mMult;
82  double mSum;
83  sampleCount mCount;
84 
85  wxCheckBox *mGainCheckBox;
86  wxCheckBox *mDCCheckBox;
87  wxTextCtrl *mLevelTextCtrl;
88  wxStaticText *mLeveldB;
89  wxStaticText *mWarning;
90  wxCheckBox *mStereoIndCheckBox;
91 
92  bool mCreating;
93 
94  DECLARE_EVENT_TABLE()
95 };
96 
97 #endif
void UpdateUI()
Definition: Normalize.cpp:512
bool ProcessOne(WaveTrack *t, const wxString &msg, int curTrackNum, float offset)
Definition: Normalize.cpp:439
void AnalyzeData(float *buffer, size_t len)
Definition: Normalize.cpp:492
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:369
wxCheckBox * mDCCheckBox
Definition: Normalize.h:86
void OnUpdateUI(wxCommandEvent &evt)
Definition: Normalize.cpp:507
void ProcessData(float *buffer, size_t len, float offset)
Definition: Normalize.cpp:499
bool Startup() override
Definition: Normalize.cpp:117
wxCheckBox * mGainCheckBox
Definition: Normalize.h:85
bool TransferDataFromWindow() override
Definition: Normalize.cpp:326
Base class for many of the effects in Audacity.
Definition: Effect.h:62
EffectType GetType() override
Definition: Normalize.cpp:78
double mCurT0
Definition: Normalize.h:79
wxTextCtrl * mLevelTextCtrl
Definition: Normalize.h:87
wxString GetSymbol() override
Definition: Normalize.cpp:61
bool GetAutomationParameters(EffectAutomationParameters &parms) override
Definition: Normalize.cpp:85
wxStaticText * mWarning
Definition: Normalize.h:89
bool mGain
Definition: Normalize.h:75
float mMult
Definition: Normalize.h:81
EffectNormalize()
Definition: Normalize.cpp:45
bool Process() override
Definition: Normalize.cpp:152
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
An Effect to bring the peak level up to a chosen level.
Definition: Normalize.h:27
double mLevel
Definition: Normalize.h:74
int min(int a, int b)
Definition: CompareAudioCommand.cpp:80
double mSum
Definition: Normalize.h:82
bool AnalyseTrack(const WaveTrack *track, const wxString &msg, int curTrackNum, float &offset, float &min, float &max)
Definition: Normalize.cpp:338
sampleCount mCount
Definition: Normalize.h:83
void PopulateOrExchange(ShuttleGui &S) override
Definition: Normalize.cpp:268
bool SetAutomationParameters(EffectAutomationParameters &parms) override
Definition: Normalize.cpp:95
wxStaticText * mLeveldB
Definition: Normalize.h:88
wxString GetDescription() override
Definition: Normalize.cpp:66
bool mCreating
Definition: Normalize.h:92
double mCurT1
Definition: Normalize.h:80
bool TransferDataToWindow() override
Definition: Normalize.cpp:314
bool CheckWhetherSkipEffect() override
Definition: Normalize.cpp:112
virtual ~EffectNormalize()
Definition: Normalize.cpp:55
bool mDC
Definition: Normalize.h:76
wxCheckBox * mStereoIndCheckBox
Definition: Normalize.h:90
bool AnalyseDC(const WaveTrack *track, const wxString &msg, int curTrackNum, float &offset)
Definition: Normalize.cpp:374
bool mStereoInd
Definition: Normalize.h:77
wxString ManualPage() override
Definition: Normalize.cpp:71