2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
Normalize.h
|
|
|
|
|
|
|
|
Dominic Mazzoni
|
|
|
|
Vaughan Johnson (Preview)
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_EFFECT_NORMALIZE__
|
|
|
|
#define __AUDACITY_EFFECT_NORMALIZE__
|
|
|
|
|
|
|
|
#include "Effect.h"
|
|
|
|
|
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
|
|
|
|
class wxString;
|
|
|
|
|
|
|
|
class WaveTrack;
|
|
|
|
|
|
|
|
class EffectNormalize: public Effect
|
|
|
|
{
|
|
|
|
friend class NormalizeDialog;
|
|
|
|
|
|
|
|
public:
|
|
|
|
EffectNormalize();
|
|
|
|
|
|
|
|
virtual wxString GetEffectName() {
|
|
|
|
return wxString(_("Normalize..."));
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual std::set<wxString> GetEffectCategories() {
|
|
|
|
std::set<wxString> result;
|
|
|
|
result.insert(wxT("http://lv2plug.in/ns/lv2core#UtilityPlugin"));
|
|
|
|
result.insert(wxT("http://lv2plug.in/ns/lv2core#AmplifierPlugin"));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is just used internally, users should not see it. Do not translate.
|
|
|
|
virtual wxString GetEffectIdentifier() {
|
|
|
|
return wxT("Normalize");
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual wxString GetEffectAction() {
|
|
|
|
return wxString(_("Normalizing..."));
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual wxString GetEffectDescription(); // useful only after parameter values have been set
|
|
|
|
|
|
|
|
virtual bool PromptUser();
|
|
|
|
virtual bool TransferParameters( Shuttle & shuttle );
|
|
|
|
|
|
|
|
virtual bool Init();
|
|
|
|
virtual void End();
|
|
|
|
virtual bool CheckWhetherSkipEffect();
|
|
|
|
virtual bool Process();
|
|
|
|
|
|
|
|
private:
|
2012-05-17 00:17:51 +00:00
|
|
|
bool ProcessOne(WaveTrack * t, wxString msg);
|
|
|
|
virtual void AnalyseTrack(WaveTrack * track, wxString msg);
|
2010-01-23 19:44:49 +00:00
|
|
|
virtual void AnalyzeData(float *buffer, sampleCount len);
|
2012-05-17 00:17:51 +00:00
|
|
|
bool AnalyseDC(WaveTrack * track, wxString msg);
|
2010-01-23 19:44:49 +00:00
|
|
|
virtual void ProcessData(float *buffer, sampleCount len);
|
|
|
|
|
|
|
|
bool mGain;
|
|
|
|
bool mDC;
|
|
|
|
double mLevel;
|
2011-06-09 23:22:10 +00:00
|
|
|
bool mStereoInd;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
int mCurTrackNum;
|
|
|
|
double mCurT0;
|
|
|
|
double mCurT1;
|
|
|
|
float mMult;
|
|
|
|
float mOffset;
|
|
|
|
float mMin;
|
|
|
|
float mMax;
|
|
|
|
double mSum;
|
2012-05-03 21:54:18 +00:00
|
|
|
sampleCount mCount;
|
2010-01-23 19:44:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// NormalizeDialog
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class NormalizeDialog: public EffectDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors and destructors
|
|
|
|
NormalizeDialog(EffectNormalize *effect, wxWindow * parent);
|
|
|
|
|
|
|
|
// method declarations
|
|
|
|
void PopulateOrExchange(ShuttleGui & S);
|
|
|
|
bool TransferDataToWindow();
|
|
|
|
bool TransferDataFromWindow();
|
|
|
|
|
|
|
|
private:
|
2013-02-23 04:33:20 +00:00
|
|
|
// handlers
|
2010-01-23 19:44:49 +00:00
|
|
|
void OnUpdateUI(wxCommandEvent& evt);
|
|
|
|
void OnPreview(wxCommandEvent &event);
|
|
|
|
|
|
|
|
void UpdateUI();
|
|
|
|
|
|
|
|
private:
|
|
|
|
EffectNormalize *mEffect;
|
|
|
|
wxCheckBox *mGainCheckBox;
|
|
|
|
wxCheckBox *mDCCheckBox;
|
|
|
|
wxTextCtrl *mLevelTextCtrl;
|
|
|
|
wxStaticText *mLeveldB;
|
2011-06-11 23:08:06 +00:00
|
|
|
wxStaticText *mWarning;
|
2011-06-09 23:22:10 +00:00
|
|
|
wxCheckBox *mStereoIndCheckBox;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool mGain;
|
|
|
|
bool mDC;
|
|
|
|
double mLevel;
|
2011-06-09 23:22:10 +00:00
|
|
|
bool mStereoInd;
|
2010-01-23 19:44:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|