Audacity  3.0.3
Loudness.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Loudness.h
6 
7  Max Maisel (based on Normalize effect)
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_EFFECT_LOUDNESS__
12 #define __AUDACITY_EFFECT_LOUDNESS__
13 
14 #include <wx/checkbox.h>
15 #include <wx/choice.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 #include "Biquad.h"
23 #include "EBUR128.h"
24 
25 class wxChoice;
26 class wxSimplebook;
27 class ShuttleGui;
28 
29 class EffectLoudness final : public Effect
30 {
31 public:
33 
35  virtual ~EffectLoudness();
36 
37  // ComponentInterface implementation
38 
41  ManualPageID ManualPage() override;
42 
43  // EffectDefinitionInterface implementation
44 
45  EffectType GetType() override;
46 
47  // EffectClientInterface implementation
48 
49  bool DefineParams( ShuttleParams & S ) override;
50  bool GetAutomationParameters(CommandParameters & parms) override;
51  bool SetAutomationParameters(CommandParameters & parms) override;
52 
53  // Effect implementation
54 
55  bool CheckWhetherSkipEffect() override;
56  bool Startup() override;
57  bool Process() override;
58  void PopulateOrExchange(ShuttleGui & S) override;
59  bool TransferDataToWindow() override;
60  bool TransferDataFromWindow() override;
61 
62 private:
63  // EffectLoudness implementation
64 
65  void AllocBuffers();
66  void FreeBuffers();
67  bool GetTrackRMS(WaveTrack* track, float& rms);
68  bool ProcessOne(TrackIterRange<WaveTrack> range, bool analyse);
70  sampleCount pos, size_t len);
71  bool AnalyseBufferBlock();
72  bool ProcessBufferBlock();
74  sampleCount pos, size_t len);
75 
76  bool UpdateProgress();
77  void OnChoice(wxCommandEvent & evt);
78  void OnUpdateUI(wxCommandEvent & evt);
79  void UpdateUI();
80 
81 private:
82  bool mStereoInd;
83  double mLUFSLevel;
84  double mRMSLevel;
85  bool mDualMono;
87 
88  double mCurT0;
89  double mCurT1;
90  double mProgressVal;
91  int mSteps;
93  double mTrackLen;
94  double mCurRate;
95 
96  float mMult;
97  float mRatio;
98  float mRMS[2];
99  std::unique_ptr<EBUR128> mLoudnessProcessor;
100 
101  wxSimplebook *mBook;
102  wxChoice *mChoice;
103  wxStaticText *mWarning;
104  wxCheckBox *mStereoIndCheckBox;
105  wxCheckBox *mDualMonoCheckBox;
106 
107  Floats mTrackBuffer[2]; // MM: must be increased once surround channels are supported
111 
112  DECLARE_EVENT_TABLE()
113 };
114 
115 #endif
EffectLoudness::mCurT0
double mCurT0
Definition: Loudness.h:88
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
EffectLoudness::GetTrackRMS
bool GetTrackRMS(WaveTrack *track, float &rms)
Definition: Loudness.cpp:444
EffectLoudness::mDualMonoCheckBox
wxCheckBox * mDualMonoCheckBox
Definition: Loudness.h:105
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
EffectLoudness::mMult
float mMult
Definition: Loudness.h:96
EffectLoudness::mTrackBufferLen
size_t mTrackBufferLen
Definition: Loudness.h:108
Effect.h
EffectLoudness::mSteps
int mSteps
Definition: Loudness.h:91
Biquad.h
EffectLoudness::OnChoice
void OnChoice(wxCommandEvent &evt)
Definition: Loudness.cpp:574
Effect
Base class for many of the effects in Audacity.
Definition: Effect.h:72
EffectLoudness::mCurRate
double mCurRate
Definition: Loudness.h:94
EffectLoudness::mProgressMsg
TranslatableString mProgressMsg
Definition: Loudness.h:92
EffectLoudness::mRatio
float mRatio
Definition: Loudness.h:97
EffectLoudness::Process
bool Process() override
Definition: Loudness.cpp:173
EffectLoudness::mStereoInd
bool mStereoInd
Definition: Loudness.h:82
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:62
EffectLoudness::UpdateUI
void UpdateUI()
Definition: Loudness.cpp:587
EffectLoudness::mWarning
wxStaticText * mWarning
Definition: Loudness.h:103
EffectLoudness::mBook
wxSimplebook * mBook
Definition: Loudness.h:101
EffectLoudness::AllocBuffers
void AllocBuffers()
Definition: Loudness.cpp:413
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
EffectLoudness::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: Loudness.cpp:400
EffectLoudness::TransferDataToWindow
bool TransferDataToWindow() override
Definition: Loudness.cpp:387
EffectLoudness::FreeBuffers
void FreeBuffers()
Definition: Loudness.cpp:438
EffectLoudness
An Effect to bring the loudness level up to a chosen level.
Definition: Loudness.h:30
EffectLoudness::AnalyseBufferBlock
bool AnalyseBufferBlock()
Definition: Loudness.cpp:526
EffectLoudness::mRMSLevel
double mRMSLevel
Definition: Loudness.h:84
EBUR128.h
EffectLoudness::mLoudnessProcessor
std::unique_ptr< EBUR128 > mLoudnessProcessor
Definition: Loudness.h:99
EffectLoudness::mProcStereo
bool mProcStereo
Definition: Loudness.h:110
EffectLoudness::GetType
EffectType GetType() override
Definition: Loudness.cpp:103
EffectLoudness::Startup
bool Startup() override
Definition: Loudness.cpp:154
EffectLoudness::ProcessBufferBlock
bool ProcessBufferBlock()
Definition: Loudness.cpp:541
EffectLoudness::ManualPage
ManualPageID ManualPage() override
Definition: Loudness.cpp:96
EffectLoudness::UpdateProgress
bool UpdateProgress()
Definition: Loudness.cpp:567
EffectLoudness::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: Loudness.cpp:130
TrackIterRange
Range between two TrackIters, usable in range-for statements, and with Visit member functions.
Definition: Track.h:1101
EffectLoudness::mTrackLen
double mTrackLen
Definition: Loudness.h:93
EffectLoudness::mDualMono
bool mDualMono
Definition: Loudness.h:85
EffectLoudness::mNormalizeTo
int mNormalizeTo
Definition: Loudness.h:86
EffectLoudness::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: Loudness.cpp:119
EffectLoudness::mChoice
wxChoice * mChoice
Definition: Loudness.h:102
EffectLoudness::DefineParams
bool DefineParams(ShuttleParams &S) override
Definition: Loudness.cpp:109
EffectLoudness::ProcessOne
bool ProcessOne(TrackIterRange< WaveTrack > range, bool analyse)
Definition: Loudness.cpp:458
TaggedIdentifier< ManualPageIDTag >
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
EffectLoudness::mCurT1
double mCurT1
Definition: Loudness.h:89
EffectLoudness::EffectLoudness
EffectLoudness()
Definition: Loudness.cpp:69
EffectLoudness::mRMS
float mRMS[2]
Definition: Loudness.h:98
EffectLoudness::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Loudness.h:32
EffectLoudness::mTrackBuffer
Floats mTrackBuffer[2]
Definition: Loudness.h:107
EffectLoudness::StoreBufferBlock
void StoreBufferBlock(TrackIterRange< WaveTrack > range, sampleCount pos, size_t len)
Definition: Loudness.cpp:555
EffectLoudness::GetDescription
TranslatableString GetDescription() override
Definition: Loudness.cpp:91
EffectLoudness::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: Loudness.cpp:291
EffectLoudness::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: Loudness.cpp:86
EffectLoudness::~EffectLoudness
virtual ~EffectLoudness()
Definition: Loudness.cpp:80
EffectType
EffectType
Definition: EffectInterface.h:55
EffectLoudness::LoadBufferBlock
void LoadBufferBlock(TrackIterRange< WaveTrack > range, sampleCount pos, size_t len)
Definition: Loudness.cpp:511
EffectLoudness::mStereoIndCheckBox
wxCheckBox * mStereoIndCheckBox
Definition: Loudness.h:104
ArrayOf< float >
EffectLoudness::CheckWhetherSkipEffect
bool CheckWhetherSkipEffect() override
Definition: Loudness.cpp:149
EffectLoudness::mProgressVal
double mProgressVal
Definition: Loudness.h:90
EffectLoudness::OnUpdateUI
void OnUpdateUI(wxCommandEvent &evt)
Definition: Loudness.cpp:582
EffectLoudness::mTrackBufferCapacity
size_t mTrackBufferCapacity
Definition: Loudness.h:109
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
EffectLoudness::mLUFSLevel
double mLUFSLevel
Definition: Loudness.h:83