2013-10-02 10:32:41 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
2013-10-02 16:00:34 +00:00
|
|
|
Audacity: A Digital Audio Editor
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2013-10-02 16:00:34 +00:00
|
|
|
EffectScienFilter.h
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2013-10-02 16:00:34 +00:00
|
|
|
Norm C
|
|
|
|
Mitch Golden
|
|
|
|
Vaughan Johnson (Preview)
|
2013-10-02 10:32:41 +00:00
|
|
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_EFFECT_SCIENFILTER__
|
|
|
|
#define __AUDACITY_EFFECT_SCIENFILTER__
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include <wx/arrstr.h>
|
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/choice.h>
|
|
|
|
#include <wx/event.h>
|
2013-10-02 10:32:41 +00:00
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/slider.h>
|
2015-04-17 03:53:42 +00:00
|
|
|
#include <wx/stattext.h>
|
2013-10-02 10:32:41 +00:00
|
|
|
#include <wx/string.h>
|
2015-04-17 03:53:42 +00:00
|
|
|
#include <wx/window.h>
|
2013-10-02 10:32:41 +00:00
|
|
|
|
|
|
|
#include "../widgets/Ruler.h"
|
|
|
|
#include "Biquad.h"
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include "Effect.h"
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-06-18 14:24:36 +00:00
|
|
|
class wxTextCtrl;
|
|
|
|
class ShuttleGui;
|
|
|
|
|
2015-04-19 03:49:05 +00:00
|
|
|
#define CLASSICFILTERS_PLUGIN_SYMBOL XO("Classic Filters")
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
class EffectScienFilterPanel;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2016-02-24 06:06:39 +00:00
|
|
|
class EffectScienFilter final : public Effect
|
2015-04-17 03:53:42 +00:00
|
|
|
{
|
2013-10-02 10:32:41 +00:00
|
|
|
public:
|
|
|
|
EffectScienFilter();
|
|
|
|
virtual ~EffectScienFilter();
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// IdentInterface implementation
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
wxString GetSymbol() override;
|
|
|
|
wxString GetDescription() override;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectIdentInterface implementation
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
EffectType GetType() override;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectClientInterface implementation
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2016-09-02 19:53:09 +00:00
|
|
|
unsigned GetAudioInCount() override;
|
|
|
|
unsigned GetAudioOutCount() override;
|
2016-02-24 06:06:47 +00:00
|
|
|
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
|
|
|
|
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
|
|
|
|
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
|
|
|
|
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// Effect implementation
|
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
bool Startup() override;
|
|
|
|
bool Init() override;
|
|
|
|
void PopulateOrExchange(ShuttleGui & S) override;
|
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
|
|
|
private:
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectScienFilter implementation
|
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
bool TransferGraphLimitsFromWindow();
|
|
|
|
bool CalcFilter();
|
2015-04-17 03:53:42 +00:00
|
|
|
double ChebyPoly (int Order, double NormFreq);
|
|
|
|
float FilterMagnAtFreq(float Freq);
|
|
|
|
|
|
|
|
bool CalcFilterCoeffs (void);
|
|
|
|
|
|
|
|
void EnableDisableRippleCtl (int FilterType);
|
|
|
|
|
|
|
|
void OnSize( wxSizeEvent & evt );
|
|
|
|
void OnSlider( wxCommandEvent & evt );
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void OnOrder( wxCommandEvent & evt );
|
|
|
|
void OnCutoff( wxCommandEvent & evt );
|
|
|
|
void OnRipple( wxCommandEvent & evt );
|
|
|
|
void OnStopbandRipple( wxCommandEvent & evt );
|
|
|
|
void OnFilterType( wxCommandEvent & evt );
|
|
|
|
void OnFilterSubtype( wxCommandEvent & evt );
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void OnSliderDBMAX( wxCommandEvent & evt );
|
|
|
|
void OnSliderDBMIN( wxCommandEvent & evt );
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
private:
|
2013-10-02 10:32:41 +00:00
|
|
|
float mCutoff;
|
|
|
|
float mRipple;
|
|
|
|
float mStopbandRipple;
|
|
|
|
int mFilterType; // Butterworth etc.
|
|
|
|
int mFilterSubtype; // lowpass, highpass
|
2015-04-17 03:53:42 +00:00
|
|
|
int mOrder;
|
|
|
|
int mOrderIndex;
|
|
|
|
BiquadStruct *mpBiquad;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
|
|
|
double mdBMax;
|
|
|
|
double mdBMin;
|
|
|
|
bool mEditingBatchParams;
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
double mLoFreq;
|
|
|
|
double mNyquist;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
EffectScienFilterPanel *mPanel;
|
|
|
|
wxSlider *mdBMinSlider;
|
|
|
|
wxSlider *mdBMaxSlider;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
wxStaticText *mRippleCtlP;
|
|
|
|
wxTextCtrl *mRippleCtl;
|
|
|
|
wxStaticText *mRippleCtlU;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
wxTextCtrl *mCutoffCtl;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
wxStaticText *mStopbandRippleCtlP;
|
|
|
|
wxTextCtrl *mStopbandRippleCtl;
|
|
|
|
wxStaticText *mStopbandRippleCtlU;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
wxChoice *mFilterTypeCtl;
|
|
|
|
wxChoice *mFilterSubTypeCtl;
|
|
|
|
wxChoice *mFilterOrderCtl;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
RulerPanel *mdBRuler;
|
|
|
|
RulerPanel *mfreqRuler;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
DECLARE_EVENT_TABLE();
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
friend class EffectScienFilterPanel;
|
2013-10-02 10:32:41 +00:00
|
|
|
};
|
|
|
|
|
2016-06-25 18:18:23 +00:00
|
|
|
class EffectScienFilterPanel final : public wxPanelWrapper
|
2013-10-02 10:32:41 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-04-17 03:53:42 +00:00
|
|
|
EffectScienFilterPanel(EffectScienFilter *effect, wxWindow *parent);
|
|
|
|
virtual ~EffectScienFilterPanel();
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// We don't need or want to accept focus.
|
|
|
|
bool AcceptsFocus() const;
|
2015-11-26 15:21:48 +00:00
|
|
|
// So that wxPanel is not included in Tab traversal - see wxWidgets bug 15581
|
|
|
|
bool AcceptsFocusFromKeyboard() const;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void SetFreqRange(double lo, double hi);
|
|
|
|
void SetDbRange(double min, double max);
|
2013-10-02 10:32:41 +00:00
|
|
|
|
|
|
|
private:
|
2015-04-17 03:53:42 +00:00
|
|
|
void OnPaint(wxPaintEvent & evt);
|
|
|
|
void OnSize(wxSizeEvent & evt);
|
|
|
|
|
2013-10-02 10:32:41 +00:00
|
|
|
private:
|
2015-04-17 03:53:42 +00:00
|
|
|
EffectScienFilter *mEffect;
|
|
|
|
wxWindow *mParent;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
|
|
|
double mLoFreq;
|
2015-04-17 03:53:42 +00:00
|
|
|
double mHiFreq;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
double mDbMin;
|
|
|
|
double mDbMax;
|
2014-01-03 00:58:30 +00:00
|
|
|
|
2016-08-04 11:33:22 +00:00
|
|
|
std::unique_ptr<wxBitmap> mBitmap;
|
2015-04-17 03:53:42 +00:00
|
|
|
wxRect mEnvRect;
|
|
|
|
int mWidth;
|
|
|
|
int mHeight;
|
|
|
|
|
|
|
|
friend class EffectScienFilter;
|
2013-10-02 10:32:41 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
DECLARE_EVENT_TABLE();
|
2013-10-02 10:32:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if wxUSE_ACCESSIBILITY
|
|
|
|
|
2013-10-02 13:38:59 +00:00
|
|
|
// ScienceFilter and Equalisation effects both need SliderAx class.
|
|
|
|
// For now it is declared and defined in Equalisation effect.
|
|
|
|
// TODO: Move it to its own file.
|
2013-10-02 10:32:41 +00:00
|
|
|
|
|
|
|
#endif // wxUSE_ACCESSIBILITY
|
|
|
|
|
|
|
|
#endif
|