2019-03-15 14:56:17 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
Loudness.h
|
|
|
|
|
2019-03-15 18:41:52 +00:00
|
|
|
Max Maisel (based on Normalize effect)
|
2019-03-15 14:56:17 +00:00
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_EFFECT_LOUDNESS__
|
|
|
|
#define __AUDACITY_EFFECT_LOUDNESS__
|
|
|
|
|
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/choice.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
|
|
|
|
#include "Effect.h"
|
|
|
|
#include "Biquad.h"
|
2019-03-21 18:42:52 +00:00
|
|
|
#include "EBUR128.h"
|
2019-03-15 14:56:17 +00:00
|
|
|
|
2020-03-26 16:28:52 +00:00
|
|
|
class wxChoice;
|
|
|
|
class wxSimplebook;
|
2019-03-15 14:56:17 +00:00
|
|
|
class ShuttleGui;
|
|
|
|
|
|
|
|
class EffectLoudness final : public Effect
|
|
|
|
{
|
|
|
|
public:
|
2019-01-17 22:33:49 +00:00
|
|
|
static const ComponentInterfaceSymbol Symbol;
|
|
|
|
|
2019-03-15 14:56:17 +00:00
|
|
|
EffectLoudness();
|
|
|
|
virtual ~EffectLoudness();
|
|
|
|
|
|
|
|
// ComponentInterface implementation
|
|
|
|
|
|
|
|
ComponentInterfaceSymbol GetSymbol() override;
|
2019-12-08 18:53:48 +00:00
|
|
|
TranslatableString GetDescription() override;
|
2021-06-06 16:18:35 +00:00
|
|
|
ManualPageID ManualPage() override;
|
2019-03-15 14:56:17 +00:00
|
|
|
|
|
|
|
// EffectDefinitionInterface implementation
|
|
|
|
|
|
|
|
EffectType GetType() override;
|
|
|
|
|
|
|
|
// EffectClientInterface implementation
|
|
|
|
|
|
|
|
bool DefineParams( ShuttleParams & S ) override;
|
|
|
|
bool GetAutomationParameters(CommandParameters & parms) override;
|
|
|
|
bool SetAutomationParameters(CommandParameters & parms) override;
|
|
|
|
|
|
|
|
// Effect implementation
|
|
|
|
|
|
|
|
bool CheckWhetherSkipEffect() override;
|
|
|
|
bool Startup() override;
|
|
|
|
bool Process() override;
|
|
|
|
void PopulateOrExchange(ShuttleGui & S) override;
|
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// EffectLoudness implementation
|
|
|
|
|
2019-03-15 18:41:52 +00:00
|
|
|
void AllocBuffers();
|
|
|
|
void FreeBuffers();
|
2019-03-23 11:00:42 +00:00
|
|
|
bool GetTrackRMS(WaveTrack* track, float& rms);
|
2019-03-15 18:41:52 +00:00
|
|
|
bool ProcessOne(TrackIterRange<WaveTrack> range, bool analyse);
|
2020-03-21 19:34:50 +00:00
|
|
|
void LoadBufferBlock(TrackIterRange<WaveTrack> range,
|
2019-03-15 18:41:52 +00:00
|
|
|
sampleCount pos, size_t len);
|
|
|
|
bool AnalyseBufferBlock();
|
|
|
|
bool ProcessBufferBlock();
|
|
|
|
void StoreBufferBlock(TrackIterRange<WaveTrack> range,
|
|
|
|
sampleCount pos, size_t len);
|
|
|
|
|
2019-03-15 14:56:17 +00:00
|
|
|
bool UpdateProgress();
|
2020-03-26 16:28:52 +00:00
|
|
|
void OnChoice(wxCommandEvent & evt);
|
2019-03-15 14:56:17 +00:00
|
|
|
void OnUpdateUI(wxCommandEvent & evt);
|
|
|
|
void UpdateUI();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool mStereoInd;
|
|
|
|
double mLUFSLevel;
|
|
|
|
double mRMSLevel;
|
|
|
|
bool mDualMono;
|
|
|
|
int mNormalizeTo;
|
|
|
|
|
|
|
|
double mCurT0;
|
|
|
|
double mCurT1;
|
|
|
|
double mProgressVal;
|
|
|
|
int mSteps;
|
2019-12-08 03:37:02 +00:00
|
|
|
TranslatableString mProgressMsg;
|
2019-03-15 14:56:17 +00:00
|
|
|
double mTrackLen;
|
|
|
|
double mCurRate;
|
|
|
|
|
2019-03-15 18:41:52 +00:00
|
|
|
float mMult;
|
|
|
|
float mRatio;
|
2019-03-23 11:00:42 +00:00
|
|
|
float mRMS[2];
|
2019-03-21 18:42:52 +00:00
|
|
|
std::unique_ptr<EBUR128> mLoudnessProcessor;
|
2019-03-15 14:56:17 +00:00
|
|
|
|
2020-03-26 16:28:52 +00:00
|
|
|
wxSimplebook *mBook;
|
|
|
|
wxChoice *mChoice;
|
2019-03-15 14:56:17 +00:00
|
|
|
wxStaticText *mWarning;
|
|
|
|
wxCheckBox *mStereoIndCheckBox;
|
|
|
|
wxCheckBox *mDualMonoCheckBox;
|
|
|
|
|
|
|
|
Floats mTrackBuffer[2]; // MM: must be increased once surround channels are supported
|
|
|
|
size_t mTrackBufferLen;
|
|
|
|
size_t mTrackBufferCapacity;
|
|
|
|
bool mProcStereo;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|