Audacity  2.2.2
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 IdentInterfaceSymbol{ XO("Normalize") }
26 
27 class EffectNormalize final : public Effect
28 {
29 public:
31  virtual ~EffectNormalize();
32 
33  // IdentInterface implementation
34 
36  wxString GetDescription() override;
37  wxString ManualPage() override;
38 
39  // EffectDefinitionInterface implementation
40 
41  EffectType GetType() override;
42 
43  // EffectClientInterface implementation
44 
45  bool DefineParams( ShuttleParams & S ) override;
46  bool GetAutomationParameters(CommandParameters & parms) override;
47  bool SetAutomationParameters(CommandParameters & parms) override;
48 
49  // Effect implementation
50 
51  bool CheckWhetherSkipEffect() override;
52  bool Startup() override;
53  bool Process() override;
54  void PopulateOrExchange(ShuttleGui & S) override;
55  bool TransferDataToWindow() override;
56  bool TransferDataFromWindow() override;
57 
58 private:
59  // EffectNormalize implementation
60 
61  bool ProcessOne(
62  WaveTrack * t, const wxString &msg, int curTrackNum, float offset);
63  bool AnalyseTrack(const WaveTrack * track, const wxString &msg,
64  int curTrackNum,
65  float &offset, float &min, float &max);
66  void AnalyzeData(float *buffer, size_t len);
67  bool AnalyseDC(const WaveTrack * track, const wxString &msg, int curTrackNum,
68  float &offset);
69  void ProcessData(float *buffer, size_t len, float offset);
70 
71  void OnUpdateUI(wxCommandEvent & evt);
72  void UpdateUI();
73 
74 private:
75  double mLevel;
76  bool mGain;
77  bool mDC;
78  bool mStereoInd;
79 
80  double mCurT0;
81  double mCurT1;
82  float mMult;
83  double mSum;
85 
86  wxCheckBox *mGainCheckBox;
87  wxCheckBox *mDCCheckBox;
88  wxTextCtrl *mLevelTextCtrl;
89  wxStaticText *mLeveldB;
90  wxStaticText *mWarning;
91  wxCheckBox *mStereoIndCheckBox;
92 
93  bool mCreating;
94 
95  DECLARE_EVENT_TABLE()
96 };
97 
98 #endif
bool SetAutomationParameters(CommandParameters &parms) override
Definition: Normalize.cpp:102
bool ProcessOne(WaveTrack *t, const wxString &msg, int curTrackNum, float offset)
Definition: Normalize.cpp:459
void AnalyzeData(float *buffer, size_t len)
Definition: Normalize.cpp:512
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
wxCheckBox * mDCCheckBox
Definition: Normalize.h:87
void OnUpdateUI(wxCommandEvent &evt)
Definition: Normalize.cpp:527
void ProcessData(float *buffer, size_t len, float offset)
Definition: Normalize.cpp:519
bool Startup() override
Definition: Normalize.cpp:124
wxCheckBox * mGainCheckBox
Definition: Normalize.h:86
bool TransferDataFromWindow() override
Definition: Normalize.cpp:340
Base class for many of the effects in Audacity.
Definition: Effect.h:62
bool GetAutomationParameters(CommandParameters &parms) override
Definition: Normalize.cpp:92
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:60
EffectType GetType() override
Definition: Normalize.cpp:78
double mCurT0
Definition: Normalize.h:80
wxTextCtrl * mLevelTextCtrl
Definition: Normalize.h:88
wxStaticText * mWarning
Definition: Normalize.h:90
bool Process() override
Definition: Normalize.cpp:159
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
An Effect to bring the peak level up to a chosen level.
Definition: Normalize.h:27
double mLevel
Definition: Normalize.h:75
int min(int a, int b)
IdentInterfaceSymbol pairs a persistent string identifier used internally with an optional...
bool AnalyseTrack(const WaveTrack *track, const wxString &msg, int curTrackNum, float &offset, float &min, float &max)
Definition: Normalize.cpp:352
IdentInterfaceSymbol GetSymbol() override
Definition: Normalize.cpp:61
sampleCount mCount
Definition: Normalize.h:84
void PopulateOrExchange(ShuttleGui &S) override
Definition: Normalize.cpp:282
EffectType
wxStaticText * mLeveldB
Definition: Normalize.h:89
wxString GetDescription() override
Definition: Normalize.cpp:66
double mCurT1
Definition: Normalize.h:81
bool TransferDataToWindow() override
Definition: Normalize.cpp:328
bool CheckWhetherSkipEffect() override
Definition: Normalize.cpp:119
virtual ~EffectNormalize()
Definition: Normalize.cpp:55
bool DefineParams(ShuttleParams &S) override
Definition: Normalize.cpp:84
wxCheckBox * mStereoIndCheckBox
Definition: Normalize.h:91
bool AnalyseDC(const WaveTrack *track, const wxString &msg, int curTrackNum, float &offset)
Definition: Normalize.cpp:388
wxString ManualPage() override
Definition: Normalize.cpp:71