00001 /********************************************************************** 00002 00003 Audacity: A Digital Audio Editor 00004 00005 Normalize.h 00006 00007 Dominic Mazzoni 00008 Vaughan Johnson (Preview) 00009 00010 **********************************************************************/ 00011 00012 #ifndef __AUDACITY_EFFECT_NORMALIZE__ 00013 #define __AUDACITY_EFFECT_NORMALIZE__ 00014 00015 #include "Effect.h" 00016 00017 #include <wx/checkbox.h> 00018 #include <wx/stattext.h> 00019 #include <wx/textctrl.h> 00020 00021 class wxString; 00022 00023 class WaveTrack; 00024 00025 class EffectNormalize: public Effect 00026 { 00027 friend class NormalizeDialog; 00028 00029 public: 00030 EffectNormalize(); 00031 00032 virtual wxString GetEffectName() { 00033 return wxString(_("Normalize...")); 00034 } 00035 00036 virtual std::set<wxString> GetEffectCategories() { 00037 std::set<wxString> result; 00038 result.insert(wxT("http://lv2plug.in/ns/lv2core#UtilityPlugin")); 00039 result.insert(wxT("http://lv2plug.in/ns/lv2core#AmplifierPlugin")); 00040 return result; 00041 } 00042 00043 // This is just used internally, users should not see it. Do not translate. 00044 virtual wxString GetEffectIdentifier() { 00045 return wxT("Normalize"); 00046 } 00047 00048 virtual wxString GetEffectAction() { 00049 return wxString(_("Normalizing...")); 00050 } 00051 00052 virtual wxString GetEffectDescription(); // useful only after parameter values have been set 00053 00054 virtual bool PromptUser(); 00055 virtual bool TransferParameters( Shuttle & shuttle ); 00056 00057 virtual bool Init(); 00058 virtual void End(); 00059 virtual bool CheckWhetherSkipEffect(); 00060 virtual bool Process(); 00061 00062 private: 00063 bool ProcessOne(WaveTrack * t, 00064 sampleCount start, sampleCount end); 00065 00066 virtual void StartAnalysis(); 00067 virtual void AnalyzeData(float *buffer, sampleCount len); 00068 00069 virtual void StartProcessing(); 00070 virtual void ProcessData(float *buffer, sampleCount len); 00071 00072 bool mGain; 00073 bool mDC; 00074 double mLevel; 00075 00076 int mCurTrackNum; 00077 double mCurRate; 00078 double mCurT0; 00079 double mCurT1; 00080 int mCurChannel; 00081 float mMult; 00082 float mOffset; 00083 float mMin; 00084 float mMax; 00085 double mSum; 00086 int mCount; 00087 }; 00088 00089 //---------------------------------------------------------------------------- 00090 // NormalizeDialog 00091 //---------------------------------------------------------------------------- 00092 00093 class NormalizeDialog: public EffectDialog 00094 { 00095 public: 00096 // constructors and destructors 00097 NormalizeDialog(EffectNormalize *effect, wxWindow * parent); 00098 00099 // method declarations 00100 void PopulateOrExchange(ShuttleGui & S); 00101 bool TransferDataToWindow(); 00102 bool TransferDataFromWindow(); 00103 00104 private: 00105 // handlers 00106 void OnUpdateUI(wxCommandEvent& evt); 00107 void OnPreview(wxCommandEvent &event); 00108 00109 void UpdateUI(); 00110 00111 private: 00112 EffectNormalize *mEffect; 00113 wxCheckBox *mGainCheckBox; 00114 wxCheckBox *mDCCheckBox; 00115 wxStaticText *mLevelMinux; 00116 wxTextCtrl *mLevelTextCtrl; 00117 wxStaticText *mLeveldB; 00118 00119 DECLARE_EVENT_TABLE() 00120 00121 public: 00122 bool mGain; 00123 bool mDC; 00124 double mLevel; 00125 }; 00126 00127 #endif 00128 00129 00130 // Indentation settings for Vim and Emacs and unique identifier for Arch, a 00131 // version control system. Please do not modify past this point. 00132 // 00133 // Local Variables: 00134 // c-basic-offset: 3 00135 // indent-tabs-mode: nil 00136 // End: 00137 // 00138 // vim: et sts=3 sw=3 00139 // arch-tag: 2e3f0feb-9ac1-4bac-ba42-3d7e37007aa8 00140
1.6.1