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, 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, const EffectOutputs *pOutputs) 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 bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap=nullptr)
 
virtual bool ProcessFinalize () noexcept
 
virtual size_t ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen)=0
 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, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (MessagePackage &package)
 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
 
virtual unsigned GetAudioInCount () const
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const
 How many output buffers to allocate at once. More...
 
virtual sampleCount GetLatency () 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...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
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...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal) override
 
EffectUIClientInterfaceGetEffectUIClientInterface () override
 Returns the EffectUIClientInterface instance for this effect. More...
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) 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
 
OptionalMessage 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
 
OptionalMessage 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
 
void SetTracks (TrackList *pTracks)
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
virtual int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal=false)=0
 
virtual bool IsGraphicalUI ()=0
 
virtual std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs)=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 OptionalMessage ImportPresets (EffectSettings &settings)=0
 
virtual bool HasOptions ()=0
 
virtual void ShowOptions ()=0
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=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 EffectUIClientInterfaceGetEffectUIClientInterface ()=0
 Returns the EffectUIClientInterface instance for this effect. More...
 
virtual void Preview (EffectSettingsAccess &access, bool dryOnly)=0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual OptionalMessage 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...
 
- 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...
 
virtual std::unique_ptr< EffectOutputsMakeOutputs () const
 Produce an object to hold values to send to effect output meters. 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 StatefulEffectBase
using MessagePackage = EffectInstance::MessagePackage
 
- 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, const EffectOutputs *pOutputs)
 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
 
- 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 }
 
- 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:222
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 521 of file ScienFilter.cpp.

522{
523 switch (mFilterType)
524 {
525 case kButterworth:
527 break;
528 case kChebyshevTypeI:
530 break;
531 case kChebyshevTypeII:
533 break;
534 }
535}
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 675 of file ScienFilter.cpp.

676{
677 bool ripple;
678 bool stop;
679
680 if (FilterType == kButterworth) // Butterworth
681 {
682 ripple = false;
683 stop = false;
684 }
685 else if (FilterType == kChebyshevTypeI) // Chebyshev Type1
686 {
687 ripple = true;
688 stop = false;
689 }
690 else // Chebyshev Type2
691 {
692 ripple = false;
693 stop = true;
694 }
695
696 mRippleCtlP->Enable(ripple);
697 mRippleCtl->Enable(ripple);
698 mRippleCtlU->Enable(ripple);
699 mStopbandRippleCtlP->Enable(stop);
700 mStopbandRippleCtl->Enable(stop);
701 mStopbandRippleCtlU->Enable(stop);
702}
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 537 of file ScienFilter.cpp.

538{
539 float Magn;
540 if (Freq >= mNyquist)
541 Freq = mNyquist - 1; // prevent tan(PI/2)
542 float FreqWarped = tan (PI * Freq/(2*mNyquist));
543 if (mCutoff >= mNyquist)
544 mCutoff = mNyquist - 1;
545 float CutoffWarped = tan (PI * mCutoff/(2*mNyquist));
546 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
547
548 switch (mFilterType)
549 {
550 case kButterworth: // Butterworth
551 default:
552 switch (mFilterSubtype)
553 {
554 case kLowPass: // lowpass
555 default:
556 if (FreqWarped/CutoffWarped > fOverflowThresh) // prevent pow() overflow
557 Magn = 0;
558 else
559 Magn = sqrt (1 / (1 + pow (FreqWarped/CutoffWarped, 2*mOrder)));
560 break;
561 case kHighPass: // highpass
562 if (FreqWarped/CutoffWarped > fOverflowThresh)
563 Magn = 1;
564 else
565 Magn = sqrt (pow (FreqWarped/CutoffWarped, 2*mOrder) / (1 + pow (FreqWarped/CutoffWarped, 2*mOrder)));
566 break;
567 }
568 break;
569
570 case kChebyshevTypeI: // Chebyshev Type 1
571 double eps; eps = sqrt(pow (10.0, wxMax(0.001, mRipple)/10.0) - 1);
572 double chebyPolyVal;
573 switch (mFilterSubtype)
574 {
575 case 0: // lowpass
576 default:
577 chebyPolyVal = Biquad::ChebyPoly(mOrder, FreqWarped/CutoffWarped);
578 Magn = sqrt (1 / (1 + square(eps) * square(chebyPolyVal)));
579 break;
580 case 1:
581 chebyPolyVal = Biquad::ChebyPoly(mOrder, CutoffWarped/FreqWarped);
582 Magn = sqrt (1 / (1 + square(eps) * square(chebyPolyVal)));
583 break;
584 }
585 break;
586
587 case kChebyshevTypeII: // Chebyshev Type 2
588 eps = 1 / sqrt(pow (10.0, wxMax(0.001, mStopbandRipple)/10.0) - 1);
589 switch (mFilterSubtype)
590 {
591 case kLowPass: // lowpass
592 default:
593 chebyPolyVal = Biquad::ChebyPoly(mOrder, CutoffWarped/FreqWarped);
594 Magn = sqrt (1 / (1 + 1 / (square(eps) * square(chebyPolyVal))));
595 break;
596 case kHighPass:
597 chebyPolyVal = Biquad::ChebyPoly(mOrder, FreqWarped/CutoffWarped);
598 Magn = sqrt (1 / (1 + 1 / (square(eps) * square(chebyPolyVal))));
599 break;
600 }
601 break;
602 }
603
604 return Magn;
605}
#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 instance processes channels independently, this can return 1 The result is not necessarily well defined before RealtimeInitialize Default implementation returns 0

Reimplemented from StatefulEffectBase.

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.

The result is not necessarily well defined before RealtimeInitialize Default implementation returns 0

Reimplemented from StatefulEffectBase.

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:104
double mProjectRate
Definition: EffectBase.h:101
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
Definition: Effect.cpp:863
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1454
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 627 of file ScienFilter.cpp.

628{
629 if (!EnableApply(mUIParent->TransferDataFromWindow()))
630 {
631 return;
632 }
633
634 mPanel->Refresh(false);
635}
bool EnableApply(bool enable=true)
Definition: Effect.cpp:612
wxWindow * mUIParent
Definition: Effect.h:307
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 621 of file ScienFilter.cpp.

622{
623 mFilterSubtype = mFilterSubTypeCtl->GetSelection();
624 mPanel->Refresh(false);
625}
wxChoice * mFilterSubTypeCtl
Definition: ScienFilter.h:124

References mFilterSubtype, mFilterSubTypeCtl, and mPanel.

◆ OnFilterType()

void EffectScienFilter::OnFilterType ( wxCommandEvent &  evt)
private

Definition at line 614 of file ScienFilter.cpp.

615{
616 mFilterType = mFilterTypeCtl->GetSelection();
618 mPanel->Refresh(false);
619}
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 607 of file ScienFilter.cpp.

608{
609 mOrderIndex = mFilterOrderCtl->GetSelection();
610 mOrder = mOrderIndex + 1; // 0..n-1 -> 1..n
611 mPanel->Refresh(false);
612}
wxChoice * mFilterOrderCtl
Definition: ScienFilter.h:125

References mFilterOrderCtl, mOrder, mOrderIndex, and mPanel.

◆ OnRipple()

void EffectScienFilter::OnRipple ( wxCommandEvent &  evt)
private

Definition at line 637 of file ScienFilter.cpp.

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

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 667 of file ScienFilter.cpp.

668{
669 // On Windows the Passband and Stopband boxes do not refresh properly
670 // on a resize...no idea why.
671 mUIParent->Refresh();
672 evt.Skip();
673}

References Effect::mUIParent.

◆ OnSlider()

void EffectScienFilter::OnSlider ( wxCommandEvent &  evt)
private

◆ OnSliderDBMAX()

void EffectScienFilter::OnSliderDBMAX ( wxCommandEvent &  evt)
private

Definition at line 662 of file ScienFilter.cpp.

663{
665}
bool TransferGraphLimitsFromWindow()

References TransferGraphLimitsFromWindow().

Here is the call graph for this function:

◆ OnSliderDBMIN()

void EffectScienFilter::OnSliderDBMIN ( wxCommandEvent &  evt)
private

Definition at line 657 of file ScienFilter.cpp.

References TransferGraphLimitsFromWindow().

Here is the call graph for this function:

◆ OnStopbandRipple()

void EffectScienFilter::OnStopbandRipple ( wxCommandEvent &  evt)
private

Definition at line 647 of file ScienFilter.cpp.

648{
649 if (!EnableApply(mUIParent->TransferDataFromWindow()))
650 {
651 return;
652 }
653
654 mPanel->Refresh(false);
655}

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,
const EffectOutputs pOutputs 
)
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.

264{
265 S.AddSpace(5);
266 S.SetSizerProportion(1);
267 S.StartMultiColumn(3, wxEXPAND);
268 {
269 S.SetStretchyCol(1);
270 S.SetStretchyRow(0);
271
272 // -------------------------------------------------------------------
273 // ROW 1: Freq response panel and sliders for vertical scale
274 // -------------------------------------------------------------------
275
276 S.StartVerticalLay();
277 {
279 S.GetParent(), wxID_ANY, wxVERTICAL,
280 wxSize{ 100, 100 }, // Ruler can't handle small sizes
281 RulerPanel::Range{ 30.0, -120.0 },
283 XO("dB"),
285 .LabelEdges(true)
286 );
287
288 S.SetBorder(1);
289 S.AddSpace(1, 1);
290 S.Prop(1)
291 .Position(wxALIGN_RIGHT | wxTOP)
292 .AddWindow(mdBRuler);
293 S.AddSpace(1, 1);
294 }
295 S.EndVerticalLay();
296
298 S.GetParent(), wxID_ANY,
299 this, mLoFreq, mNyquist
300 );
301
302 S.SetBorder(5);
303 S.Prop(1)
304 .Position(wxEXPAND | wxRIGHT)
305 .MinSize( { -1, -1 } )
306 .AddWindow(mPanel);
307
308 S.StartVerticalLay();
309 {
310 S.AddVariableText(XO("+ dB"), false, wxCENTER);
312 .Name(XO("Max dB"))
313 .Style(wxSL_VERTICAL | wxSL_INVERSE)
314 .AddSlider( {}, 10, 20, 0);
315#if wxUSE_ACCESSIBILITY
316 mdBMaxSlider->SetAccessible(safenew SliderAx(mdBMaxSlider, XO("%d dB")));
317#endif
319 .Name(XO("Min dB"))
320 .Style(wxSL_VERTICAL | wxSL_INVERSE)
321 .AddSlider( {}, -10, -10, -120);
322#if wxUSE_ACCESSIBILITY
323 mdBMinSlider->SetAccessible(safenew SliderAx(mdBMinSlider, XO("%d dB")));
324#endif
325
326 S.AddVariableText(XO("- dB"), false, wxCENTER);
327 }
328 S.EndVerticalLay();
329
330 // -------------------------------------------------------------------
331 // ROW 2: Frequency ruler
332 // -------------------------------------------------------------------
333
334 S.AddSpace(1, 1);
335
337 S.GetParent(), wxID_ANY, wxHORIZONTAL,
338 wxSize{ 100, 100 }, // Ruler can't handle small sizes
339 RulerPanel::Range{ mLoFreq, mNyquist },
341 {},
343 .Log(true)
344 .Flip(true)
345 .LabelEdges(true)
346 );
347
348 S.Prop(1)
349 .Position(wxEXPAND | wxALIGN_LEFT | wxRIGHT)
350 .AddWindow(mfreqRuler);
351
352 S.AddSpace(1, 1);
353
354 // -------------------------------------------------------------------
355 // ROW 3 and 4: Type, Order, Ripple, Subtype, Cutoff
356 // -------------------------------------------------------------------
357
358 S.AddSpace(1, 1);
359 S.SetSizerProportion(0);
360 S.StartMultiColumn(8, wxALIGN_CENTER);
361 {
362 wxASSERT(nTypes == WXSIZEOF(kTypeStrings));
363
365 .Focus()
366 .Validator<wxGenericValidator>(&mFilterType)
367 .MinSize( { -1, -1 } )
368 .AddChoice(XXO("&Filter Type:"),
370 );
371
373 .Validator<wxGenericValidator>(&mOrderIndex)
374 .MinSize( { -1, -1 } )
375 /*i18n-hint: 'Order' means the complexity of the filter, and is a number between 1 and 10.*/
376 .AddChoice(XXO("O&rder:"),
377 []{
378 TranslatableStrings orders;
379 for (int i = 1; i <= 10; i++)
380 orders.emplace_back( Verbatim("%d").Format( i ) );
381 return orders;
382 }()
383 );
384 S.AddSpace(1, 1);
385
386 mRippleCtlP = S.AddVariableText( XO("&Passband Ripple:"),
387 false, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
389 .Name(XO("Passband Ripple (dB)"))
390 .Validator<FloatingPointValidator<float>>(
391 1, &mRipple, NumValidatorStyle::DEFAULT,
393 .AddTextBox( {}, L"", 10);
394 mRippleCtlU = S.AddVariableText(XO("dB"),
395 false, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
396
398 .Validator<wxGenericValidator>(&mFilterSubtype)
399 .MinSize( { -1, -1 } )
400 .AddChoice(XXO("&Subtype:"),
402 );
403
405 .Name(XO("Cutoff (Hz)"))
406 .Validator<FloatingPointValidator<float>>(
407 1, &mCutoff, NumValidatorStyle::DEFAULT,
408 Cutoff.min, mNyquist - 1)
409 .AddTextBox(XXO("C&utoff:"), L"", 10);
410 S.AddUnits(XO("Hz"));
411
413 S.AddVariableText(XO("Minimum S&topband Attenuation:"),
414 false, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
416 .Name(XO("Minimum S&topband Attenuation (dB)"))
417 .Validator<FloatingPointValidator<float>>(
418 1, &mStopbandRipple, NumValidatorStyle::DEFAULT,
420 .AddTextBox( {}, L"", 10);
422 S.AddVariableText(XO("dB"),
423 false, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
424 }
425 S.EndMultiColumn();
426 S.AddSpace(1, 1);
427 }
428 S.EndMultiColumn();
429
430 return nullptr;
431}
#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.

Implements 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,
ChannelNames  chanMap 
)
overridevirtual

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

Parameters
chanMapnull or array terminated with ChannelNameEOL. Do not retain the pointer
Postcondition
GetAudioInCount() and GetAudioOutCount() are well defined

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 456 of file ScienFilter.cpp.

457{
458 if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
459 {
460 return false;
461 }
462
463 mOrder = mOrderIndex + 1;
464
465 CalcFilter();
466
467 return true;
468}

References CalcFilter(), mOrder, mOrderIndex, and Effect::mUIParent.

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 436 of file ScienFilter.cpp.

437{
438 mOrderIndex = mOrder - 1;
439
440 if (!mUIParent->TransferDataToWindow())
441 {
442 return false;
443 }
444
445 mdBMinSlider->SetValue((int) mdBMin);
446 mdBMin = 0.0; // force refresh in TransferGraphLimitsFromWindow()
447
448 mdBMaxSlider->SetValue((int) mdBMax);
449 mdBMax = 0.0; // force refresh in TransferGraphLimitsFromWindow()
450
452
454}

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

Here is the call graph for this function:

◆ TransferGraphLimitsFromWindow()

bool EffectScienFilter::TransferGraphLimitsFromWindow ( )
private

Definition at line 475 of file ScienFilter.cpp.

476{
477 // Read the sliders and send to the panel
478 wxString tip;
479
480 bool rr = false;
481 int dB = mdBMinSlider->GetValue();
482 if (dB != mdBMin) {
483 rr = true;
484 mdBMin = dB;
485 tip.Printf(_("%d dB"), (int)mdBMin);
486 mdBMinSlider->SetToolTip(tip);
487 }
488
489 dB = mdBMaxSlider->GetValue();
490 if (dB != mdBMax) {
491 rr = true;
492 mdBMax = dB;
493 tip.Printf(_("%d dB"),(int)mdBMax);
494 mdBMaxSlider->SetToolTip(tip);
495 }
496
497 if (rr) {
499 }
500
501 // Refresh ruler if values have changed
502 if (rr) {
503 int w1, w2, h;
504 mdBRuler->ruler.GetMaxSize(&w1, &h);
506 mdBRuler->ruler.GetMaxSize(&w2, &h);
507 if( w1 != w2 ) // Reduces flicker
508 {
509 mdBRuler->SetSize(wxSize(w2,h));
510 mUIParent->Layout();
511 mfreqRuler->Refresh(false);
512 }
513 mdBRuler->Refresh(false);
514 }
515
516 mPanel->Refresh(false);
517
518 return true;
519}
#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: