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__
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/slider.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/textctrl.h>
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include "Effect.h"
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2015-06-18 14:24:36 +00:00
|
|
|
class ShuttleGui;
|
|
|
|
|
2015-04-19 03:49:05 +00:00
|
|
|
#define BASSTREBLE_PLUGIN_SYMBOL XO("Bass and Treble")
|
2015-04-17 03:53:42 +00:00
|
|
|
|
2016-02-24 06:06:39 +00:00
|
|
|
class EffectBassTreble final : public Effect
|
2015-04-17 03:53:42 +00:00
|
|
|
{
|
2013-04-07 16:49:16 +00:00
|
|
|
public:
|
2013-01-01 01:59:02 +00:00
|
|
|
EffectBassTreble();
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual ~EffectBassTreble();
|
|
|
|
|
|
|
|
// IdentInterface implementation
|
|
|
|
|
|
|
|
virtual wxString GetSymbol();
|
|
|
|
virtual wxString GetDescription();
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectIdentInterface implementation
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual EffectType GetType();
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectClientInterface implementation
|
2013-04-07 16:49:16 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual int GetAudioInCount();
|
|
|
|
virtual int GetAudioOutCount();
|
|
|
|
virtual bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL);
|
|
|
|
virtual sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen);
|
|
|
|
virtual bool GetAutomationParameters(EffectAutomationParameters & parms);
|
|
|
|
virtual bool SetAutomationParameters(EffectAutomationParameters & parms);
|
2013-04-07 16:49:16 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// Effect Implementation
|
|
|
|
|
|
|
|
virtual bool Startup();
|
|
|
|
virtual bool InitPass1();
|
|
|
|
virtual bool InitPass2();
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual void PopulateOrExchange(ShuttleGui & S);
|
|
|
|
virtual bool TransferDataToWindow();
|
|
|
|
virtual bool TransferDataFromWindow();
|
2013-04-07 16:49:16 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
private:
|
|
|
|
// EffectBassTreble implementation
|
2013-01-01 01:59:02 +00:00
|
|
|
|
2014-06-03 20:30:19 +00:00
|
|
|
void Coefficents(double hz, float slope, double gain, int type,
|
2013-04-07 16:49:16 +00:00
|
|
|
float& a0, float& a1, float& a2, float& b0, float& b1, float& b2);
|
2015-04-17 03:53:42 +00:00
|
|
|
float DoFilter(float in);
|
|
|
|
void UpdateUI();
|
2013-01-01 16:12:00 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void OnBassText(wxCommandEvent & evt);
|
|
|
|
void OnTrebleText(wxCommandEvent & evt);
|
|
|
|
void OnLevelText(wxCommandEvent & evt);
|
|
|
|
void OnBassSlider(wxCommandEvent & evt);
|
|
|
|
void OnTrebleSlider(wxCommandEvent & evt);
|
|
|
|
void OnLevelSlider(wxCommandEvent & evt);
|
|
|
|
void OnNormalize(wxCommandEvent & evt);
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
private:
|
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
|
|
|
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;
|
2015-04-17 03:53:42 +00:00
|
|
|
wxStaticText *mWarning;
|
2013-05-02 23:22:47 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
DECLARE_EVENT_TABLE();
|
2013-01-01 01:59:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|