2013-01-01 15:50:12 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
Audacity(R) is copyright (c) 1999-2013 Audacity Team.
|
|
|
|
License: GPL v2. See License.txt.
|
|
|
|
|
|
|
|
BassTreble.h (two shelf filters)
|
|
|
|
Steve Daulton
|
2013-01-01 01:59:02 +00:00
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_EFFECT_BASS_TREBLE__
|
|
|
|
#define __AUDACITY_EFFECT_BASS_TREBLE__
|
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
#include "TwoPassSimpleMono.h"
|
2013-01-01 01:59:02 +00:00
|
|
|
|
|
|
|
class wxSizer;
|
|
|
|
class wxTextCtrl;
|
|
|
|
class WaveTrack;
|
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
class EffectBassTreble: public EffectTwoPassSimpleMono {
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
public:
|
2013-01-01 01:59:02 +00:00
|
|
|
EffectBassTreble();
|
|
|
|
|
|
|
|
virtual wxString GetEffectName() {
|
|
|
|
return wxString(_("Bass and Treble..."));
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual std::set<wxString> GetEffectCategories() {
|
|
|
|
std::set<wxString> result;
|
2013-01-01 16:12:00 +00:00
|
|
|
result.insert(wxT("http://lv2plug.in/ns/lv2core#EQPlugin"));
|
2013-01-01 01:59:02 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual wxString GetEffectIdentifier() {
|
|
|
|
return wxString(wxT("Bass and Treble"));
|
|
|
|
}
|
2013-04-07 16:49:16 +00:00
|
|
|
|
2013-01-01 01:59:02 +00:00
|
|
|
virtual wxString GetEffectAction() {
|
|
|
|
return wxString(_("Adjusting Bass and Treble"));
|
|
|
|
}
|
2013-04-07 16:49:16 +00:00
|
|
|
|
2013-01-01 01:59:02 +00:00
|
|
|
// Useful only after PromptUser values have been set.
|
|
|
|
virtual wxString GetEffectDescription();
|
|
|
|
|
|
|
|
virtual bool PromptUser();
|
|
|
|
virtual bool TransferParameters( Shuttle & shuttle );
|
2013-04-07 16:49:16 +00:00
|
|
|
virtual bool Init();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual bool ProcessPass1(float *buffer, sampleCount len);
|
|
|
|
virtual bool ProcessPass2(float *buffer, sampleCount len);
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
void Coefficents(double hz, float slope, double gain, int type,
|
|
|
|
float& a0, float& a1, float& a2, float& b0, float& b1, float& b2);
|
2013-01-01 16:12:00 +00:00
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
private:
|
|
|
|
virtual bool NewTrackPass1();
|
|
|
|
virtual bool InitPass1();
|
|
|
|
virtual bool InitPass2();
|
|
|
|
float DoFilter(float in);
|
|
|
|
|
2013-01-01 01:59:02 +00:00
|
|
|
float xn1Bass, xn2Bass, yn1Bass, yn2Bass,
|
|
|
|
wBass, swBass, cwBass, aBass, bBass,
|
|
|
|
a0Bass, a1Bass, a2Bass, b0Bass, b1Bass, b2Bass;
|
|
|
|
// High shelf
|
|
|
|
float xn1Treble, xn2Treble, yn1Treble, yn2Treble,
|
|
|
|
wTreble, swTreble, cwTreble, aTreble, bTreble,
|
|
|
|
b0Treble, b1Treble, b2Treble, a0Treble, a1Treble, a2Treble;
|
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
double dB_bass, dB_treble, dB_level;
|
|
|
|
double mMax;
|
|
|
|
bool mbNormalize;
|
|
|
|
double mPreGain;
|
2013-01-31 00:36:37 +00:00
|
|
|
|
2013-01-01 01:59:02 +00:00
|
|
|
friend class BassTrebleDialog;
|
|
|
|
};
|
|
|
|
|
|
|
|
// class declarations
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// BassTrebleDialog
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
class BassTrebleDialog:public EffectDialog {
|
2013-04-07 16:49:16 +00:00
|
|
|
public:
|
2013-01-01 01:59:02 +00:00
|
|
|
// constructors and destructors
|
|
|
|
BassTrebleDialog(EffectBassTreble *effect, wxWindow * parent);
|
|
|
|
|
|
|
|
// method declarations for BassTrebleDialog
|
|
|
|
void PopulateOrExchange(ShuttleGui & S);
|
|
|
|
bool TransferDataToWindow();
|
|
|
|
bool TransferDataFromWindow();
|
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
private:
|
2013-01-01 01:59:02 +00:00
|
|
|
// handler declarations for BassTrebleDialog
|
|
|
|
void OnBassText(wxCommandEvent & event);
|
|
|
|
void OnTrebleText(wxCommandEvent & event);
|
2013-04-07 16:49:16 +00:00
|
|
|
void OnLevelText(wxCommandEvent & event);
|
2013-01-01 01:59:02 +00:00
|
|
|
void OnBassSlider(wxCommandEvent & event);
|
|
|
|
void OnTrebleSlider(wxCommandEvent & event);
|
2013-04-07 16:49:16 +00:00
|
|
|
void OnLevelSlider(wxCommandEvent & event);
|
|
|
|
void OnNormalize(wxCommandEvent& evt);
|
|
|
|
void UpdateUI();
|
2013-01-01 01:59:02 +00:00
|
|
|
void OnPreview(wxCommandEvent & event);
|
2013-04-07 16:49:16 +00:00
|
|
|
void set_properties();
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
private:
|
2013-01-01 01:59:02 +00:00
|
|
|
wxSlider *mBassS;
|
|
|
|
wxSlider *mTrebleS;
|
2013-04-07 16:49:16 +00:00
|
|
|
wxSlider *mLevelS;
|
2013-01-01 01:59:02 +00:00
|
|
|
wxTextCtrl *mBassT;
|
|
|
|
wxTextCtrl *mTrebleT;
|
2013-04-07 16:49:16 +00:00
|
|
|
wxTextCtrl *mLevelT;
|
|
|
|
wxCheckBox *mNormalizeCheckBox;
|
2013-01-01 01:59:02 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2013-04-07 16:49:16 +00:00
|
|
|
wxStaticText* mWarning;
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
public:
|
2013-01-01 01:59:02 +00:00
|
|
|
EffectBassTreble *mEffect;
|
|
|
|
|
2013-04-07 16:49:16 +00:00
|
|
|
double bass;
|
|
|
|
double treble;
|
|
|
|
double level;
|
|
|
|
bool mbNormalize;
|
2013-01-01 01:59:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|