Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
EffectScienFilter Class Referencefinal

An Effect that applies 'classical' IIR filters. More...

#include <ScienFilter.h>

Inheritance diagram for EffectScienFilter:
[legend]
Collaboration diagram for EffectScienFilter:
[legend]

Public Member Functions

 EffectScienFilter ()
 
virtual ~EffectScienFilter ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
ManualPageID ManualPage () const override
 Name of a page in the Audacity alpha manual, default is empty. More...
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
unsigned GetAudioInCount () const override
 How many input buffers to allocate at once. More...
 
unsigned GetAudioOutCount () const override
 How many output buffers to allocate at once. More...
 
bool ProcessInitialize (EffectSettings &settings, double sampleRate, sampleCount totalLen, ChannelNames chanMap) override
 
size_t ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
 Called for destructive effect computation. More...
 
bool Init () override
 Call once to set up state for whole list of tracks to be processed. More...
 
std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
 Add controls to effect panel; always succeeds. More...
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
bool TransferDataFromWindow (EffectSettings &settings) override
 Update the given settings from controls. More...
 
- Public Member Functions inherited from StatefulPerTrackEffect
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
virtual sampleCount GetLatency ()
 
virtual bool ProcessInitialize (EffectSettings &settings, double sampleRate, sampleCount totalLen, ChannelNames chanMap=nullptr)
 
virtual bool ProcessFinalize ()
 
virtual size_t ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen)
 Called for destructive effect computation. More...
 
- Public Member Functions inherited from StatefulEffectBase
virtual bool Init ()
 Call once to set up state for whole list of tracks to be processed. More...
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 Actually do the effect here. More...
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (EffectSettings &settings)
 settings are possibly changed, since last call, by an asynchronous dialog More...
 
virtual size_t RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 settings can be updated to let a dialog change appearance at idle More...
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () const
 
- Public Member Functions inherited from PerTrackEffect
 ~PerTrackEffect () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () const override
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
bool LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 Change settings to a user-named preset. More...
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id, EffectSettings &settings) const override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults (EffectSettings &settings) const override
 Change settings back to "factory default". More...
 
unsigned GetAudioInCount () const override
 How many input buffers to allocate at once. More...
 
unsigned GetAudioOutCount () const override
 How many output buffers to allocate at once. More...
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
 Adds controls to a panel that is given as the parent window of S More...
 
bool IsGraphicalUI () override
 
bool ValidateUI (EffectSettings &) override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets (const EffectSettings &settings) const override
 
void ImportPresets (EffectSettings &settings) override
 
bool HasOptions () override
 
void ShowOptions () override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
 Usually applies factory to self and given access. More...
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
bool LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
bool TransferDataFromWindow (EffectSettings &settings) override
 Update the given settings from controls. More...
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings)
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
 
bool EnableApply (bool enable=true)
 
wxWindow * GetUIParent ()
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
virtual int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false)=0
 
virtual bool IsGraphicalUI ()=0
 
virtual std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)=0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual bool CanExportPresets ()=0
 
virtual void ExportPresets (const EffectSettings &settings) const =0
 
virtual void ImportPresets (EffectSettings &settings)=0
 
virtual bool HasOptions ()=0
 
virtual void ShowOptions ()=0
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)=0
 Usually applies factory to self and given access. More...
 
virtual void Preview (EffectSettingsAccess &access, bool dryOnly)=0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual bool LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={}, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 Unfortunately complicated dual-use function. More...
 
virtual bool TransferDataToWindow (const EffectSettings &settings)=0
 Update controls for the settings. More...
 
virtual bool TransferDataFromWindow (EffectSettings &settings)=0
 Update the given settings from controls. More...
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
virtual unsigned GetAudioInCount () const =0
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const =0
 How many output buffers to allocate at once. More...
 
virtual int GetMidiInCount () const
 Function that has not yet found a use. More...
 
virtual int GetMidiOutCount () const
 Function that has not yet found a use. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
virtual EffectSettings MakeSettings () const
 
virtual bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const
 Update one settings object from another. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual RealtimeSince RealtimeSupport () const =0
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsRealtime () const
 
virtual bool SupportsAutomation () const =0
 Whether the effect has any automatable controls. More...
 
virtual bool EnablesDebug () const
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage () const
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage () const
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus () const
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Static Public Member Functions

static EffectScienFilterFetchParameters (EffectScienFilter &e, EffectSettings &)
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
static void IncEffectCounter ()
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Classic Filters") }
 
- Static Public Attributes inherited from EffectPlugin
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 

Private Types

enum  kSubTypes { kLowPass = Biquad::kLowPass , kHighPass = Biquad::kHighPass , nSubTypes = Biquad::nSubTypes }
 
enum  kTypes { kButterworth , kChebyshevTypeI , kChebyshevTypeII , nTypes }
 

Private Member Functions

bool TransferGraphLimitsFromWindow ()
 
void CalcFilter ()
 
float FilterMagnAtFreq (float Freq)
 
void EnableDisableRippleCtl (int FilterType)
 
void OnSize (wxSizeEvent &evt)
 
void OnSlider (wxCommandEvent &evt)
 
void OnOrder (wxCommandEvent &evt)
 
void OnCutoff (wxCommandEvent &evt)
 
void OnRipple (wxCommandEvent &evt)
 
void OnStopbandRipple (wxCommandEvent &evt)
 
void OnFilterType (wxCommandEvent &evt)
 
void OnFilterSubtype (wxCommandEvent &evt)
 
void OnSliderDBMAX (wxCommandEvent &evt)
 
void OnSliderDBMIN (wxCommandEvent &evt)
 
const EffectParameterMethodsParameters () const override
 

Private Attributes

float mCutoff
 
float mRipple
 
float mStopbandRipple
 
int mFilterType
 
int mFilterSubtype
 
int mOrder
 
int mOrderIndex
 
ArrayOf< BiquadmpBiquad
 
double mdBMax
 
double mdBMin
 
bool mEditingBatchParams
 
double mLoFreq
 
double mNyquist
 
EffectScienFilterPanelmPanel
 
wxSlider * mdBMinSlider
 
wxSlider * mdBMaxSlider
 
wxStaticText * mRippleCtlP
 
wxTextCtrl * mRippleCtl
 
wxStaticText * mRippleCtlU
 
wxTextCtrl * mCutoffCtl
 
wxStaticText * mStopbandRippleCtlP
 
wxTextCtrl * mStopbandRippleCtl
 
wxStaticText * mStopbandRippleCtlU
 
wxChoice * mFilterTypeCtl
 
wxChoice * mFilterSubTypeCtl
 
wxChoice * mFilterOrderCtl
 
RulerPanelmdBRuler
 
RulerPanelmfreqRuler
 

Static Private Attributes

static const EnumValueSymbol kSubTypeStrings [nSubTypes]
 
static const EnumValueSymbol kTypeStrings [nTypes]
 
static constexpr EnumParameter Type
 
static constexpr EnumParameter Subtype
 
static constexpr EffectParameter Order
 
static constexpr EffectParameter Cutoff
 
static constexpr EffectParameter Passband
 
static constexpr EffectParameter Stopband
 

Friends

class EffectScienFilterPanel
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , Since_3_2 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Protected Member Functions inherited from PerTrackEffect
bool DoPass1 () const
 
bool DoPass2 () const
 
bool Process (EffectInstance &instance, EffectSettings &settings) const
 
- Protected Member Functions inherited from Effect
bool EnablePreview (bool enable=true)
 
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
virtual std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)
 Add controls to effect panel; always succeeds. More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
- Protected Member Functions inherited from EffectBase
void Preview (EffectSettingsAccess &access, bool dryOnly) override
 
bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent, const EffectDialogFactory &dialogFactory, const EffectSettingsAccessPtr &pAccess) override
 Unfortunately complicated dual-use function. More...
 
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=0
 
- Protected Attributes inherited from PerTrackEffect
sampleCount mSampleCnt {}
 
- Protected Attributes inherited from Effect
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWindow * mUIParent {}
 
- Protected Attributes inherited from EffectBase
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0 {}
 
double mT1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 
- Protected Attributes inherited from EffectUIClientInterface
friend EffectUIValidator
 
friend DefaultEffectUIValidator
 
- Static Protected Attributes inherited from EffectBase
static int nEffectsDone = 0
 

Detailed Description

An Effect that applies 'classical' IIR filters.

Performs IIR filtering that emulates analog filters, specifically Butterworth, Chebyshev Type I and Type II. Highpass and lowpass filters are supported, as are filter orders from 1 to 10.

The filter is applied using biquads

Definition at line 35 of file ScienFilter.h.

Member Enumeration Documentation

◆ kSubTypes

Enumerator
kLowPass 
kHighPass 
nSubTypes 

Definition at line 135 of file ScienFilter.h.

◆ kTypes

Enumerator
kButterworth 
kChebyshevTypeI 
kChebyshevTypeII 
nTypes 

Definition at line 143 of file ScienFilter.h.

Constructor & Destructor Documentation

◆ EffectScienFilter()

EffectScienFilter::EffectScienFilter ( )

Definition at line 146 of file ScienFilter.cpp.

147{
148 Parameters().Reset(*this);
150
151 mOrderIndex = mOrder - 1;
152
153 mdBMin = -30.0;
154 mdBMax = 30.0;
155
156 mLoFreq = 20; // Lowest frequency to display in response graph
157 mNyquist = 44100.0 / 2.0; // only used during initialization, updated when effect is used
158}
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: EffectBase.cpp:218
virtual void Reset(Effect &effect) const =0
const EffectParameterMethods & Parameters() const override

Referenced by Parameters().

Here is the caller graph for this function:

◆ ~EffectScienFilter()

EffectScienFilter::~EffectScienFilter ( )
virtual

Definition at line 160 of file ScienFilter.cpp.

161{
162}

Member Function Documentation

◆ CalcFilter()

void EffectScienFilter::CalcFilter ( )
private

Definition at line 510 of file ScienFilter.cpp.

511{
512 switch (mFilterType)
513 {
514 case kButterworth:
516 break;
517 case kChebyshevTypeI:
519 break;
520 case kChebyshevTypeII:
522 break;
523 }
524}
ArrayOf< Biquad > mpBiquad
Definition: ScienFilter.h:100
static ArrayOf< Biquad > CalcButterworthFilter(int order, double fn, double fc, int type)
Definition: Biquad.cpp:64
static ArrayOf< Biquad > CalcChebyshevType2Filter(int order, double fn, double fc, double ripple, int type)
Definition: Biquad.cpp:228
static ArrayOf< Biquad > CalcChebyshevType1Filter(int order, double fn, double fc, double ripple, int type)
Definition: Biquad.cpp:146

References Biquad::CalcButterworthFilter(), Biquad::CalcChebyshevType1Filter(), Biquad::CalcChebyshevType2Filter(), kButterworth, kChebyshevTypeI, kChebyshevTypeII, mCutoff, mFilterSubtype, mFilterType, mNyquist, mOrder, mpBiquad, mRipple, and mStopbandRipple.

Referenced by TransferDataFromWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableDisableRippleCtl()

void EffectScienFilter::EnableDisableRippleCtl ( int  FilterType)
private

Definition at line 664 of file ScienFilter.cpp.

665{
666 bool ripple;
667 bool stop;
668
669 if (FilterType == kButterworth) // Butterworth
670 {
671 ripple = false;
672 stop = false;
673 }
674 else if (FilterType == kChebyshevTypeI) // Chebyshev Type1
675 {
676 ripple = true;
677 stop = false;
678 }
679 else // Chebyshev Type2
680 {
681 ripple = false;
682 stop = true;
683 }
684
685 mRippleCtlP->Enable(ripple);
686 mRippleCtl->Enable(ripple);
687 mRippleCtlU->Enable(ripple);
688 mStopbandRippleCtlP->Enable(stop);
689 mStopbandRippleCtl->Enable(stop);
690 mStopbandRippleCtlU->Enable(stop);
691}
wxStaticText * mRippleCtlU
Definition: ScienFilter.h:115
wxTextCtrl * mRippleCtl
Definition: ScienFilter.h:114
wxStaticText * mStopbandRippleCtlP
Definition: ScienFilter.h:119
wxTextCtrl * mStopbandRippleCtl
Definition: ScienFilter.h:120
wxStaticText * mRippleCtlP
Definition: ScienFilter.h:113
wxStaticText * mStopbandRippleCtlU
Definition: ScienFilter.h:121

References kButterworth, kChebyshevTypeI, mRippleCtl, mRippleCtlP, mRippleCtlU, mStopbandRippleCtl, mStopbandRippleCtlP, and mStopbandRippleCtlU.

Referenced by OnFilterType(), and TransferDataToWindow().

Here is the caller graph for this function:

◆ FetchParameters()

static EffectScienFilter * EffectScienFilter::FetchParameters ( EffectScienFilter e,
EffectSettings  
)
inlinestatic

Definition at line 39 of file ScienFilter.h.

39{ return &e; }

◆ FilterMagnAtFreq()

float EffectScienFilter::FilterMagnAtFreq ( float  Freq)
private

Definition at line 526 of file ScienFilter.cpp.

527{
528 float Magn;
529 if (Freq >= mNyquist)
530 Freq = mNyquist - 1; // prevent tan(PI/2)
531 float FreqWarped = tan (PI * Freq/(2*mNyquist));
532 if (mCutoff >= mNyquist)
533 mCutoff = mNyquist - 1;
534 float CutoffWarped = tan (PI * mCutoff/(2*mNyquist));
535 float fOverflowThresh = pow (10.0, 12.0 / (2*mOrder)); // once we exceed 10^12 there's not much to be gained and overflow could happen
536
537 switch (mFilterType)
538 {
539 case kButterworth: // Butterworth
540 default:
541 switch (mFilterSubtype)
542 {
543 case kLowPass: // lowpass
544 default:
545 if (FreqWarped/CutoffWarped > fOverflowThresh) // prevent pow() overflow
546 Magn = 0;
547 else
548 Magn = sqrt (1 / (1 + pow (FreqWarped/CutoffWarped, 2*mOrder)));
549 break;
550 case kHighPass: // highpass
551 if (FreqWarped/CutoffWarped > fOverflowThresh)
552 Magn = 1;
553 else
554 Magn = sqrt (pow (FreqWarped/CutoffWarped, 2*mOrder) / (1 + pow (FreqWarped/CutoffWarped, 2*mOrder)));
555 break;
556 }
557 break;
558
559 case kChebyshevTypeI: // Chebyshev Type 1
560 double eps; eps = sqrt(pow (10.0, wxMax(0.001, mRipple)/10.0) - 1);
561 double chebyPolyVal;
562 switch (mFilterSubtype)
563 {
564 case 0: // lowpass
565 default:
566 chebyPolyVal = Biquad::ChebyPoly(mOrder, FreqWarped/CutoffWarped);
567 Magn = sqrt (1 / (1 + square(eps) * square(chebyPolyVal)));
568 break;
569 case 1:
570 chebyPolyVal = Biquad::ChebyPoly(mOrder, CutoffWarped/FreqWarped);
571 Magn = sqrt (1 / (1 + square(eps) * square(chebyPolyVal)));
572 break;
573 }
574 break;
575
576 case kChebyshevTypeII: // Chebyshev Type 2
577 eps = 1 / sqrt(pow (10.0, wxMax(0.001, mStopbandRipple)/10.0) - 1);
578 switch (mFilterSubtype)
579 {
580 case kLowPass: // lowpass
581 default:
582 chebyPolyVal = Biquad::ChebyPoly(mOrder, CutoffWarped/FreqWarped);
583 Magn = sqrt (1 / (1 + 1 / (square(eps) * square(chebyPolyVal))));
584 break;
585 case kHighPass:
586 chebyPolyVal = Biquad::ChebyPoly(mOrder, FreqWarped/CutoffWarped);
587 Magn = sqrt (1 / (1 + 1 / (square(eps) * square(chebyPolyVal))));
588 break;
589 }
590 break;
591 }
592
593 return Magn;
594}
#define square(a)
Definition: ScienFilter.cpp:72
#define PI
Definition: ScienFilter.cpp:68
static double ChebyPoly(int Order, double NormFreq)
Definition: Biquad.cpp:329

References Biquad::ChebyPoly(), kButterworth, kChebyshevTypeI, kChebyshevTypeII, kHighPass, kLowPass, mCutoff, mFilterSubtype, mFilterType, mNyquist, mOrder, mRipple, mStopbandRipple, PI, and square.

Referenced by EffectScienFilterPanel::OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAudioInCount()

unsigned EffectScienFilter::GetAudioInCount ( ) const
overridevirtual

How many input buffers to allocate at once.

If the effect ALWAYS processes channels independently, this can return 1

Reimplemented from Effect.

Definition at line 190 of file ScienFilter.cpp.

191{
192 return 1;
193}

◆ GetAudioOutCount()

unsigned EffectScienFilter::GetAudioOutCount ( ) const
overridevirtual

How many output buffers to allocate at once.

Reimplemented from Effect.

Definition at line 195 of file ScienFilter.cpp.

196{
197 return 1;
198}

◆ GetDescription()

TranslatableString EffectScienFilter::GetDescription ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 171 of file ScienFilter.cpp.

172{
173 /* i18n-hint: "infinite impulse response" */
174 return XO("Performs IIR filtering that emulates analog filters");
175}
#define XO(s)
Definition: Internat.h:31

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol EffectScienFilter::GetSymbol ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 166 of file ScienFilter.cpp.

167{
168 return Symbol;
169}
static const ComponentInterfaceSymbol Symbol
Definition: ScienFilter.h:40

References Symbol.

◆ GetType()

EffectType EffectScienFilter::GetType ( ) const
overridevirtual

Type determines how it behaves.

Reimplemented from Effect.

Definition at line 185 of file ScienFilter.cpp.

186{
187 return EffectTypeProcess;
188}
@ EffectTypeProcess

References EffectTypeProcess.

◆ Init()

bool EffectScienFilter::Init ( )
overridevirtual

Call once to set up state for whole list of tracks to be processed.

Returns
success Default implementation does nothing, returns true Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 223 of file ScienFilter.cpp.

224{
225 int selcount = 0;
226 double rate = 0.0;
227
228 auto trackRange = inputTracks()->Selected< const WaveTrack >();
229
230 {
231 auto t = *trackRange.begin();
232 mNyquist =
233 (t
234 ? t->GetRate()
235 : mProjectRate)
236 / 2.0;
237 }
238
239 for (auto t : trackRange)
240 {
241 if (selcount == 0)
242 {
243 rate = t->GetRate();
244 }
245 else
246 {
247 if (t->GetRate() != rate)
248 {
250 XO(
251"To apply a filter, all selected tracks must have the same sample rate.") );
252 return false;
253 }
254 }
255 selcount++;
256 }
257
258 return true;
259}
const TrackList * inputTracks() const
Definition: EffectBase.h:102
double mProjectRate
Definition: EffectBase.h:99
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
Definition: Effect.cpp:871
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1452
A Track that contains audio waveform data.
Definition: WaveTrack.h:57

References EffectBase::inputTracks(), Effect::MessageBox(), mNyquist, EffectBase::mProjectRate, TrackList::Selected(), and XO.

Here is the call graph for this function:

◆ ManualPage()

ManualPageID EffectScienFilter::ManualPage ( ) const
overridevirtual

Name of a page in the Audacity alpha manual, default is empty.

Reimplemented from EffectDefinitionInterface.

Definition at line 177 of file ScienFilter.cpp.

178{
179 return L"Classic_Filters";
180}

◆ OnCutoff()

void EffectScienFilter::OnCutoff ( wxCommandEvent &  evt)
private

Definition at line 616 of file ScienFilter.cpp.

617{
618 if (!EnableApply(mUIParent->TransferDataFromWindow()))
619 {
620 return;
621 }
622
623 mPanel->Refresh(false);
624}
bool EnableApply(bool enable=true)
Definition: Effect.cpp:613
wxWindow * mUIParent
Definition: Effect.h:270
EffectScienFilterPanel * mPanel
Definition: ScienFilter.h:109

References Effect::EnableApply(), mPanel, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnFilterSubtype()

void EffectScienFilter::OnFilterSubtype ( wxCommandEvent &  evt)
private

Definition at line 610 of file ScienFilter.cpp.

611{
612 mFilterSubtype = mFilterSubTypeCtl->GetSelection();
613 mPanel->Refresh(false);
614}
wxChoice * mFilterSubTypeCtl
Definition: ScienFilter.h:124

References mFilterSubtype, mFilterSubTypeCtl, and mPanel.

◆ OnFilterType()

void EffectScienFilter::OnFilterType ( wxCommandEvent &  evt)
private

Definition at line 603 of file ScienFilter.cpp.

604{
605 mFilterType = mFilterTypeCtl->GetSelection();
607 mPanel->Refresh(false);
608}
void EnableDisableRippleCtl(int FilterType)
wxChoice * mFilterTypeCtl
Definition: ScienFilter.h:123

References EnableDisableRippleCtl(), mFilterType, mFilterTypeCtl, and mPanel.

Here is the call graph for this function:

◆ OnOrder()

void EffectScienFilter::OnOrder ( wxCommandEvent &  evt)
private

Definition at line 596 of file ScienFilter.cpp.

597{
598 mOrderIndex = mFilterOrderCtl->GetSelection();
599 mOrder = mOrderIndex + 1; // 0..n-1 -> 1..n
600 mPanel->Refresh(false);
601}
wxChoice * mFilterOrderCtl
Definition: ScienFilter.h:125

References mFilterOrderCtl, mOrder, mOrderIndex, and mPanel.

◆ OnRipple()

void EffectScienFilter::OnRipple ( wxCommandEvent &  evt)
private

Definition at line 626 of file ScienFilter.cpp.

627{
628 if (!EnableApply(mUIParent->TransferDataFromWindow()))
629 {
630 return;
631 }
632
633 mPanel->Refresh(false);
634}

References Effect::EnableApply(), mPanel, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnSize()

void EffectScienFilter::OnSize ( wxSizeEvent &  evt)
private

Definition at line 656 of file ScienFilter.cpp.

657{
658 // On Windows the Passband and Stopband boxes do not refresh properly
659 // on a resize...no idea why.
660 mUIParent->Refresh();
661 evt.Skip();
662}

References Effect::mUIParent.

◆ OnSlider()

void EffectScienFilter::OnSlider ( wxCommandEvent &  evt)
private

◆ OnSliderDBMAX()

void EffectScienFilter::OnSliderDBMAX ( wxCommandEvent &  evt)
private

Definition at line 651 of file ScienFilter.cpp.

652{
654}
bool TransferGraphLimitsFromWindow()

References TransferGraphLimitsFromWindow().

Here is the call graph for this function:

◆ OnSliderDBMIN()

void EffectScienFilter::OnSliderDBMIN ( wxCommandEvent &  evt)
private

Definition at line 646 of file ScienFilter.cpp.

References TransferGraphLimitsFromWindow().

Here is the call graph for this function:

◆ OnStopbandRipple()

void EffectScienFilter::OnStopbandRipple ( wxCommandEvent &  evt)
private

Definition at line 636 of file ScienFilter.cpp.

637{
638 if (!EnableApply(mUIParent->TransferDataFromWindow()))
639 {
640 return;
641 }
642
643 mPanel->Refresh(false);
644}

References Effect::EnableApply(), mPanel, and Effect::mUIParent.

Here is the call graph for this function:

◆ Parameters()

const EffectParameterMethods & EffectScienFilter::Parameters ( ) const
overrideprivatevirtual

Reimplemented from Effect.

Definition at line 104 of file ScienFilter.cpp.

105{
108 > parameters{
110 bool updating){
111 if (updating) {
112 e.mOrderIndex = e.mOrder - 1;
113 e.CalcFilter();
114 }
115 return true;
116 },
117 };
118 return parameters;
119}
Generates EffectParameterMethods overrides from variadic template arguments.
An Effect that applies 'classical' IIR filters.
Definition: ScienFilter.h:36
static constexpr EffectParameter Stopband
Definition: ScienFilter.h:164
static constexpr EffectParameter Cutoff
Definition: ScienFilter.h:160
static constexpr EnumParameter Subtype
Definition: ScienFilter.h:156
static constexpr EnumParameter Type
Definition: ScienFilter.h:154
static constexpr EffectParameter Passband
Definition: ScienFilter.h:162
static constexpr EffectParameter Order
Definition: ScienFilter.h:158
Externalized state of a plug-in.

References Cutoff, EffectScienFilter(), Order, Passband, Stopband, Subtype, and Type.

Here is the call graph for this function:

◆ PopulateOrExchange()

std::unique_ptr< EffectUIValidator > EffectScienFilter::PopulateOrExchange ( ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access 
)
overridevirtual

Add controls to effect panel; always succeeds.

Returns
if not null, then return it from Effect::PopulateUI instead of a DefaultEffectUIValidator; default implementation returns null

Reimplemented from Effect.

Definition at line 261 of file ScienFilter.cpp.

263{
264 S.AddSpace(5);
265 S.SetSizerProportion(1);
266 S.StartMultiColumn(3, wxEXPAND);
267 {
268 S.SetStretchyCol(1);
269 S.SetStretchyRow(0);
270
271 // -------------------------------------------------------------------
272 // ROW 1: Freq response panel and sliders for vertical scale
273 // -------------------------------------------------------------------
274
275 S.StartVerticalLay();
276 {
278 S.GetParent(), wxID_ANY, wxVERTICAL,
279 wxSize{ 100, 100 }, // Ruler can't handle small sizes
280 RulerPanel::Range{ 30.0, -120.0 },
282 XO("dB"),
284 .LabelEdges(true)
285 );
286
287 S.SetBorder(1);
288 S.AddSpace(1, 1);
289 S.Prop(1)
290 .Position(wxALIGN_RIGHT | wxTOP)
291 .AddWindow(mdBRuler);
292 S.AddSpace(1, 1);
293 }
294 S.EndVerticalLay();
295
297 S.GetParent(), wxID_ANY,
298 this, mLoFreq, mNyquist
299 );
300
301 S.SetBorder(5);
302 S.Prop(1)
303 .Position(wxEXPAND | wxRIGHT)
304 .MinSize( { -1, -1 } )
305 .AddWindow(mPanel);
306
307 S.StartVerticalLay();
308 {
309 S.AddVariableText(XO("+ dB"), false, wxCENTER);
311 .Name(XO("Max dB"))
312 .Style(wxSL_VERTICAL | wxSL_INVERSE)
313 .AddSlider( {}, 10, 20, 0);
314#if wxUSE_ACCESSIBILITY
315 mdBMaxSlider->SetAccessible(safenew SliderAx(mdBMaxSlider, XO("%d dB")));
316#endif
318 .Name(XO("Min dB"))
319 .Style(wxSL_VERTICAL | wxSL_INVERSE)
320 .AddSlider( {}, -10, -10, -120);
321#if wxUSE_ACCESSIBILITY
322 mdBMinSlider->SetAccessible(safenew SliderAx(mdBMinSlider, XO("%d dB")));
323#endif
324
325 S.AddVariableText(XO("- dB"), false, wxCENTER);
326 }
327 S.EndVerticalLay();
328
329 // -------------------------------------------------------------------
330 // ROW 2: Frequency ruler
331 // -------------------------------------------------------------------
332
333 S.AddSpace(1, 1);
334
336 S.GetParent(), wxID_ANY, wxHORIZONTAL,
337 wxSize{ 100, 100 }, // Ruler can't handle small sizes
338 RulerPanel::Range{ mLoFreq, mNyquist },
340 {},
342 .Log(true)
343 .Flip(true)
344 .LabelEdges(true)
345 );
346
347 S.Prop(1)
348 .Position(wxEXPAND | wxALIGN_LEFT | wxRIGHT)
349 .AddWindow(mfreqRuler);
350
351 S.AddSpace(1, 1);
352
353 // -------------------------------------------------------------------
354 // ROW 3 and 4: Type, Order, Ripple, Subtype, Cutoff
355 // -------------------------------------------------------------------
356
357 S.AddSpace(1, 1);
358 S.SetSizerProportion(0);
359 S.StartMultiColumn(8, wxALIGN_CENTER);
360 {
361 wxASSERT(nTypes == WXSIZEOF(kTypeStrings));
362
364 .Focus()
365 .Validator<wxGenericValidator>(&mFilterType)
366 .MinSize( { -1, -1 } )
367 .AddChoice(XXO("&Filter Type:"),
369 );
370
372 .Validator<wxGenericValidator>(&mOrderIndex)
373 .MinSize( { -1, -1 } )
374 /*i18n-hint: 'Order' means the complexity of the filter, and is a number between 1 and 10.*/
375 .AddChoice(XXO("O&rder:"),
376 []{
377 TranslatableStrings orders;
378 for (int i = 1; i <= 10; i++)
379 orders.emplace_back( Verbatim("%d").Format( i ) );
380 return orders;
381 }()
382 );
383 S.AddSpace(1, 1);
384
385 mRippleCtlP = S.AddVariableText( XO("&Passband Ripple:"),
386 false, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
388 .Name(XO("Passband Ripple (dB)"))
389 .Validator<FloatingPointValidator<float>>(
390 1, &mRipple, NumValidatorStyle::DEFAULT,
392 .AddTextBox( {}, L"", 10);
393 mRippleCtlU = S.AddVariableText(XO("dB"),
394 false, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
395
397 .Validator<wxGenericValidator>(&mFilterSubtype)
398 .MinSize( { -1, -1 } )
399 .AddChoice(XXO("&Subtype:"),
401 );
402
404 .Name(XO("Cutoff (Hz)"))
405 .Validator<FloatingPointValidator<float>>(
406 1, &mCutoff, NumValidatorStyle::DEFAULT,
407 Cutoff.min, mNyquist - 1)
408 .AddTextBox(XXO("C&utoff:"), L"", 10);
409 S.AddUnits(XO("Hz"));
410
412 S.AddVariableText(XO("Minimum S&topband Attenuation:"),
413 false, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
415 .Name(XO("Minimum S&topband Attenuation (dB)"))
416 .Validator<FloatingPointValidator<float>>(
417 1, &mStopbandRipple, NumValidatorStyle::DEFAULT,
419 .AddTextBox( {}, L"", 10);
421 S.AddVariableText(XO("dB"),
422 false, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
423 }
424 S.EndMultiColumn();
425 S.AddSpace(1, 1);
426 }
427 S.EndMultiColumn();
428
429 return nullptr;
430}
#define XXO(s)
Definition: Internat.h:44
#define safenew
Definition: MemoryX.h:10
@ ID_Cutoff
Definition: ScienFilter.cpp:83
@ ID_SubType
Definition: ScienFilter.cpp:80
@ ID_dBMax
Definition: ScienFilter.cpp:77
@ ID_Ripple
Definition: ScienFilter.cpp:82
@ ID_StopbandRipple
Definition: ScienFilter.cpp:84
@ ID_Order
Definition: ScienFilter.cpp:81
@ ID_Type
Definition: ScienFilter.cpp:79
@ ID_dBMin
Definition: ScienFilter.cpp:78
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
#define S(N)
Definition: ToChars.cpp:64
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
static const EnumValueSymbol kSubTypeStrings[nSubTypes]
Definition: ScienFilter.h:141
friend class EffectScienFilterPanel
Definition: ScienFilter.h:133
static const EnumValueSymbol kTypeStrings[nTypes]
Definition: ScienFilter.h:150
wxTextCtrl * mCutoffCtl
Definition: ScienFilter.h:117
wxSlider * mdBMaxSlider
Definition: ScienFilter.h:111
RulerPanel * mdBRuler
Definition: ScienFilter.h:127
RulerPanel * mfreqRuler
Definition: ScienFilter.h:128
wxSlider * mdBMinSlider
Definition: ScienFilter.h:110
@ LinearDBFormat
Definition: Ruler.h:34
@ IntFormat
Definition: Ruler.h:30
RulerPanel class allows you to work with a Ruler like any other wxWindow.
Definition: Ruler.h:228
std::pair< double, double > Range
Definition: Ruler.h:232
TranslatableString & Format(Args &&...args) &
Capture variadic format arguments (by copy) when there is no plural.
A Validator is an object which checks whether a wxVariant satisfies a certain criterion....
Definition: Validators.h:53
const Type min
Minimum value.
Definition: Shuttle.h:30
const Type max
Maximum value.
Definition: Shuttle.h:31
Options & LabelEdges(bool l)
Definition: Ruler.h:250
Options & Flip(bool f)
Definition: Ruler.h:247
Options & Log(bool l)
Definition: Ruler.h:244

References Cutoff, EffectScienFilterPanel, RulerPanel::Options::Flip(), TranslatableString::Format(), ID_Cutoff, ID_dBMax, ID_dBMin, ID_Order, ID_Ripple, ID_StopbandRipple, ID_SubType, ID_Type, Ruler::IntFormat, kSubTypeStrings, kTypeStrings, RulerPanel::Options::LabelEdges(), Ruler::LinearDBFormat, RulerPanel::Options::Log(), EffectParameter< Structure, Member, Type, Value >::max, mCutoff, mCutoffCtl, mdBMaxSlider, mdBMinSlider, mdBRuler, mFilterOrderCtl, mFilterSubtype, mFilterSubTypeCtl, mFilterType, mFilterTypeCtl, mfreqRuler, EffectParameter< Structure, Member, Type, Value >::min, mLoFreq, mNyquist, mOrderIndex, mPanel, mRipple, mRippleCtl, mRippleCtlP, mRippleCtlU, Msgids(), mStopbandRipple, mStopbandRippleCtl, mStopbandRippleCtlP, mStopbandRippleCtlU, nSubTypes, nTypes, Passband, S, safenew, Stopband, Verbatim(), XO, and XXO.

Here is the call graph for this function:

◆ ProcessBlock()

size_t EffectScienFilter::ProcessBlock ( EffectSettings settings,
const float *const *  inBlock,
float *const *  outBlock,
size_t  blockLen 
)
overridevirtual

Called for destructive effect computation.

Reimplemented from StatefulPerTrackEffect.

Definition at line 208 of file ScienFilter.cpp.

210{
211 const float *ibuf = inBlock[0];
212 for (int iPair = 0; iPair < (mOrder + 1) / 2; iPair++)
213 {
214 mpBiquad[iPair].Process(ibuf, outBlock[0], blockLen);
215 ibuf = outBlock[0];
216 }
217
218 return blockLen;
219}

References mOrder, and mpBiquad.

◆ ProcessInitialize()

bool EffectScienFilter::ProcessInitialize ( EffectSettings settings,
double  sampleRate,
sampleCount  totalLen,
ChannelNames  chanMap 
)
overridevirtual

Called at start of destructive processing, for each (mono/stereo) track Default implementation does nothing, returns true

Reimplemented from StatefulPerTrackEffect.

Definition at line 200 of file ScienFilter.cpp.

202{
203 for (int iPair = 0; iPair < (mOrder + 1) / 2; iPair++)
204 mpBiquad[iPair].Reset();
205 return true;
206}

References mOrder, and mpBiquad.

◆ TransferDataFromWindow()

bool EffectScienFilter::TransferDataFromWindow ( EffectSettings settings)
overridevirtual

Update the given settings from controls.

Reimplemented from Effect.

Definition at line 450 of file ScienFilter.cpp.

451{
452 mOrder = mOrderIndex + 1;
453
454 CalcFilter();
455
456 return true;
457}

References CalcFilter(), mOrder, and mOrderIndex.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool EffectScienFilter::TransferDataToWindow ( const EffectSettings settings)
overridevirtual

Update controls for the settings.

Reimplemented from Effect.

Definition at line 435 of file ScienFilter.cpp.

436{
437 mOrderIndex = mOrder - 1;
438
439 mdBMinSlider->SetValue((int) mdBMin);
440 mdBMin = 0.0; // force refresh in TransferGraphLimitsFromWindow()
441
442 mdBMaxSlider->SetValue((int) mdBMax);
443 mdBMax = 0.0; // force refresh in TransferGraphLimitsFromWindow()
444
446
448}

References EnableDisableRippleCtl(), mdBMax, mdBMaxSlider, mdBMin, mdBMinSlider, mFilterType, mOrder, mOrderIndex, and TransferGraphLimitsFromWindow().

Here is the call graph for this function:

◆ TransferGraphLimitsFromWindow()

bool EffectScienFilter::TransferGraphLimitsFromWindow ( )
private

Definition at line 464 of file ScienFilter.cpp.

465{
466 // Read the sliders and send to the panel
467 wxString tip;
468
469 bool rr = false;
470 int dB = mdBMinSlider->GetValue();
471 if (dB != mdBMin) {
472 rr = true;
473 mdBMin = dB;
474 tip.Printf(_("%d dB"), (int)mdBMin);
475 mdBMinSlider->SetToolTip(tip);
476 }
477
478 dB = mdBMaxSlider->GetValue();
479 if (dB != mdBMax) {
480 rr = true;
481 mdBMax = dB;
482 tip.Printf(_("%d dB"),(int)mdBMax);
483 mdBMaxSlider->SetToolTip(tip);
484 }
485
486 if (rr) {
488 }
489
490 // Refresh ruler if values have changed
491 if (rr) {
492 int w1, w2, h;
493 mdBRuler->ruler.GetMaxSize(&w1, &h);
495 mdBRuler->ruler.GetMaxSize(&w2, &h);
496 if( w1 != w2 ) // Reduces flicker
497 {
498 mdBRuler->SetSize(wxSize(w2,h));
499 mUIParent->Layout();
500 mfreqRuler->Refresh(false);
501 }
502 mdBRuler->Refresh(false);
503 }
504
505 mPanel->Refresh(false);
506
507 return true;
508}
#define _(s)
Definition: Internat.h:75
void SetDbRange(double min, double max)
void GetMaxSize(wxCoord *width, wxCoord *height)
Definition: Ruler.cpp:1603
void SetRange(double min, double max)
Definition: Ruler.cpp:188
Ruler ruler
Definition: Ruler.h:288

References _, Ruler::GetMaxSize(), mdBMax, mdBMaxSlider, mdBMin, mdBMinSlider, mdBRuler, mfreqRuler, mPanel, Effect::mUIParent, RulerPanel::ruler, EffectScienFilterPanel::SetDbRange(), and Ruler::SetRange().

Referenced by OnSliderDBMAX(), OnSliderDBMIN(), and TransferDataToWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ EffectScienFilterPanel

friend class EffectScienFilterPanel
friend

Definition at line 133 of file ScienFilter.h.

Referenced by PopulateOrExchange().

Member Data Documentation

◆ Cutoff

constexpr EffectParameter EffectScienFilter::Cutoff
staticconstexprprivate
Initial value:
L"Cutoff", 1000.0f, 1.0, FLT_MAX, 1 }

Definition at line 160 of file ScienFilter.h.

Referenced by Parameters(), and PopulateOrExchange().

◆ kSubTypeStrings

const EnumValueSymbol EffectScienFilter::kSubTypeStrings
staticprivate
Initial value:
=
{
{ XO("Lowpass") },
{ XO("Highpass") }
}

Definition at line 141 of file ScienFilter.h.

Referenced by PopulateOrExchange().

◆ kTypeStrings

const EnumValueSymbol EffectScienFilter::kTypeStrings
staticprivate
Initial value:
=
{
{ XO("Butterworth") },
{ XO("Chebyshev Type I") },
{ XO("Chebyshev Type II") }
}

Definition at line 150 of file ScienFilter.h.

Referenced by PopulateOrExchange().

◆ mCutoff

float EffectScienFilter::mCutoff
private

Definition at line 93 of file ScienFilter.h.

Referenced by CalcFilter(), FilterMagnAtFreq(), and PopulateOrExchange().

◆ mCutoffCtl

wxTextCtrl* EffectScienFilter::mCutoffCtl
private

Definition at line 117 of file ScienFilter.h.

Referenced by PopulateOrExchange().

◆ mdBMax

double EffectScienFilter::mdBMax
private

Definition at line 102 of file ScienFilter.h.

Referenced by TransferDataToWindow(), and TransferGraphLimitsFromWindow().

◆ mdBMaxSlider

wxSlider* EffectScienFilter::mdBMaxSlider
private

◆ mdBMin

double EffectScienFilter::mdBMin
private

Definition at line 103 of file ScienFilter.h.

Referenced by TransferDataToWindow(), and TransferGraphLimitsFromWindow().

◆ mdBMinSlider

wxSlider* EffectScienFilter::mdBMinSlider
private

◆ mdBRuler

RulerPanel* EffectScienFilter::mdBRuler
private

◆ mEditingBatchParams

bool EffectScienFilter::mEditingBatchParams
private

Definition at line 104 of file ScienFilter.h.

◆ mFilterOrderCtl

wxChoice* EffectScienFilter::mFilterOrderCtl
private

Definition at line 125 of file ScienFilter.h.

Referenced by OnOrder(), and PopulateOrExchange().

◆ mFilterSubtype

int EffectScienFilter::mFilterSubtype
private

Definition at line 97 of file ScienFilter.h.

Referenced by CalcFilter(), FilterMagnAtFreq(), OnFilterSubtype(), and PopulateOrExchange().

◆ mFilterSubTypeCtl

wxChoice* EffectScienFilter::mFilterSubTypeCtl
private

Definition at line 124 of file ScienFilter.h.

Referenced by OnFilterSubtype(), and PopulateOrExchange().

◆ mFilterType

int EffectScienFilter::mFilterType
private

◆ mFilterTypeCtl

wxChoice* EffectScienFilter::mFilterTypeCtl
private

Definition at line 123 of file ScienFilter.h.

Referenced by OnFilterType(), and PopulateOrExchange().

◆ mfreqRuler

RulerPanel* EffectScienFilter::mfreqRuler
private

◆ mLoFreq

double EffectScienFilter::mLoFreq
private

Definition at line 106 of file ScienFilter.h.

Referenced by PopulateOrExchange().

◆ mNyquist

double EffectScienFilter::mNyquist
private

Definition at line 107 of file ScienFilter.h.

Referenced by CalcFilter(), FilterMagnAtFreq(), Init(), and PopulateOrExchange().

◆ mOrder

int EffectScienFilter::mOrder
private

◆ mOrderIndex

int EffectScienFilter::mOrderIndex
private

◆ mPanel

EffectScienFilterPanel* EffectScienFilter::mPanel
private

◆ mpBiquad

ArrayOf<Biquad> EffectScienFilter::mpBiquad
private

Definition at line 100 of file ScienFilter.h.

Referenced by CalcFilter(), ProcessBlock(), and ProcessInitialize().

◆ mRipple

float EffectScienFilter::mRipple
private

Definition at line 94 of file ScienFilter.h.

Referenced by CalcFilter(), FilterMagnAtFreq(), and PopulateOrExchange().

◆ mRippleCtl

wxTextCtrl* EffectScienFilter::mRippleCtl
private

Definition at line 114 of file ScienFilter.h.

Referenced by EnableDisableRippleCtl(), and PopulateOrExchange().

◆ mRippleCtlP

wxStaticText* EffectScienFilter::mRippleCtlP
private

Definition at line 113 of file ScienFilter.h.

Referenced by EnableDisableRippleCtl(), and PopulateOrExchange().

◆ mRippleCtlU

wxStaticText* EffectScienFilter::mRippleCtlU
private

Definition at line 115 of file ScienFilter.h.

Referenced by EnableDisableRippleCtl(), and PopulateOrExchange().

◆ mStopbandRipple

float EffectScienFilter::mStopbandRipple
private

Definition at line 95 of file ScienFilter.h.

Referenced by CalcFilter(), FilterMagnAtFreq(), and PopulateOrExchange().

◆ mStopbandRippleCtl

wxTextCtrl* EffectScienFilter::mStopbandRippleCtl
private

Definition at line 120 of file ScienFilter.h.

Referenced by EnableDisableRippleCtl(), and PopulateOrExchange().

◆ mStopbandRippleCtlP

wxStaticText* EffectScienFilter::mStopbandRippleCtlP
private

Definition at line 119 of file ScienFilter.h.

Referenced by EnableDisableRippleCtl(), and PopulateOrExchange().

◆ mStopbandRippleCtlU

wxStaticText* EffectScienFilter::mStopbandRippleCtlU
private

Definition at line 121 of file ScienFilter.h.

Referenced by EnableDisableRippleCtl(), and PopulateOrExchange().

◆ Order

constexpr EffectParameter EffectScienFilter::Order
staticconstexprprivate
Initial value:
L"Order", 1, 1, 10, 1 }

Definition at line 158 of file ScienFilter.h.

Referenced by Parameters().

◆ Passband

constexpr EffectParameter EffectScienFilter::Passband
staticconstexprprivate
Initial value:
L"PassbandRipple", 1.0f, 0.0, 100.0, 1 }

Definition at line 162 of file ScienFilter.h.

Referenced by Parameters(), and PopulateOrExchange().

◆ Stopband

constexpr EffectParameter EffectScienFilter::Stopband
staticconstexprprivate
Initial value:
L"StopbandRipple", 30.0f, 0.0, 100.0, 1 }

Definition at line 164 of file ScienFilter.h.

Referenced by Parameters(), and PopulateOrExchange().

◆ Subtype

constexpr EnumParameter EffectScienFilter::Subtype
staticconstexprprivate
Initial value:

Definition at line 156 of file ScienFilter.h.

Referenced by Parameters().

◆ Symbol

const ComponentInterfaceSymbol EffectScienFilter::Symbol { XO("Classic Filters") }
static

Definition at line 40 of file ScienFilter.h.

Referenced by GetSymbol().

◆ Type

constexpr EnumParameter EffectScienFilter::Type
staticconstexprprivate
Initial value:

Definition at line 154 of file ScienFilter.h.

Referenced by Parameters().


The documentation for this class was generated from the following files: