Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ScienFilterBase Class Reference

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

#include <ScienFilterBase.h>

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

Public Member Functions

 ScienFilterBase ()
 
virtual ~ScienFilterBase ()
 
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
 
- Public Member Functions inherited from StatefulPerTrackEffect
 ~StatefulPerTrackEffect () override
 
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
 
bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap=nullptr) override
 
bool ProcessFinalize () noexcept override
 
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 ()
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 
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
 
virtual bool NeedsDither () const
 
virtual bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap=nullptr)
 
virtual bool ProcessFinalize () noexcept
 
- 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
 
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
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
bool HasOptions () const override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatID GetSelectionFormat ()
 
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
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings, InstanceFinder finder={})
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
bool IsLinearEffect () const
 
bool PreviewsFullSelection () const
 
void SetTracks (TrackList *pTracks)
 
double GetDefaultDuration ()
 
virtual std::any BeginPreview (const EffectSettings &settings)
 Called when Preview() starts, to allow temporary effect state changes. More...
 
bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess) override
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void CountWaveTracks ()
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual bool HasOptions () const =0
 
virtual bool CanExportPresets () const =0
 Whether the effect supports export of presets to files, and importing too. More...
 
virtual const EffectSettingsManagerGetDefinition () const =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, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 
- 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 ScienFilterBaseFetchParameters (ScienFilterBase &e, EffectSettings &)
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
- Static Public Member Functions inherited from EffectBase
static std::optional< InstancePointerFindInstance (EffectPlugin &plugin)
 
static InstanceFinder DefaultInstanceFinder (EffectPlugin &plugin)
 
- 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
 
- 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>")
 

Protected Types

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

Protected Member Functions

void CalcFilter ()
 
float FilterMagnAtFreq (float Freq)
 
const EffectParameterMethodsParameters () const override
 
- Protected Member Functions inherited from PerTrackEffect
bool DoPass1 () const
 
bool DoPass2 () const
 
bool Process (EffectInstance &instance, EffectSettings &settings) const
 
std::shared_ptr< EffectOutputTracksMakeOutputTracks ()
 
void DestroyOutputTracks () const
 
- Protected Member Functions inherited from Effect
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...
 
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, sampleCount *start, sampleCount *len)
 
- Protected Member Functions inherited from EffectBase
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 

Protected 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
 
- Protected Attributes inherited from PerTrackEffect
sampleCount mSampleCnt {}
 
- Protected Attributes inherited from EffectBase
double mF0 {}
 
double mF1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 

Static Protected 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
 

Additional Inherited Members

- Public Types inherited from StatefulEffectBase
using MessagePackage = EffectInstance::MessagePackage
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
using InstancePointer = std::shared_ptr< EffectInstanceEx >
 
using InstanceFinder = std::function< std::optional< InstancePointer >(EffectSettings &settings) >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , After_3_1 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Public Attributes inherited from EffectBase
std::shared_ptr< TrackListmTracks {}
 
int mNumTracks {}
 
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
double mT0 {}
 
double mT1 {}
 
bool mIsPreview { false }
 

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 19 of file ScienFilterBase.h.

Member Enumeration Documentation

◆ kSubTypes

Enumerator
kLowPass 
kHighPass 
nSubTypes 

Definition at line 79 of file ScienFilterBase.h.

◆ kTypes

enum ScienFilterBase::kTypes
protected
Enumerator
kButterworth 
kChebyshevTypeI 
kChebyshevTypeII 
nTypes 

Definition at line 87 of file ScienFilterBase.h.

Constructor & Destructor Documentation

◆ ScienFilterBase()

ScienFilterBase::ScienFilterBase ( )

Definition at line 80 of file ScienFilterBase.cpp.

81{
82 Parameters().Reset(*this);
84
85 mOrderIndex = mOrder - 1;
86
87 mdBMin = -30.0;
88 mdBMax = 30.0;
89
90 mLoFreq = 20; // Lowest frequency to display in response graph
91 mNyquist =
92 44100.0 /
93 2.0; // only used during initialization, updated when effect is used
94}
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: EffectBase.cpp:210
virtual void Reset(Effect &effect) const =0
const EffectParameterMethods & Parameters() const override

References mdBMax, mdBMin, mLoFreq, mNyquist, mOrder, mOrderIndex, Parameters(), EffectParameterMethods::Reset(), and EffectBase::SetLinearEffectFlag().

Referenced by Parameters().

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

◆ ~ScienFilterBase()

ScienFilterBase::~ScienFilterBase ( )
virtual

Definition at line 96 of file ScienFilterBase.cpp.

97{
98}

Member Function Documentation

◆ CalcFilter()

void ScienFilterBase::CalcFilter ( )
protected

Definition at line 190 of file ScienFilterBase.cpp.

191{
192 switch (mFilterType)
193 {
194 case kButterworth:
197 break;
198 case kChebyshevTypeI:
201 break;
202 case kChebyshevTypeII:
205 break;
206 }
207}
ArrayOf< Biquad > mpBiquad
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 EffectScienFilter::TransferDataFromWindow().

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

◆ FetchParameters()

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

Definition at line 23 of file ScienFilterBase.h.

24 {
25 return &e;
26 }

◆ FilterMagnAtFreq()

float ScienFilterBase::FilterMagnAtFreq ( float  Freq)
protected

Definition at line 209 of file ScienFilterBase.cpp.

210{
211 float Magn;
212 if (Freq >= mNyquist)
213 Freq = mNyquist - 1; // prevent tan(PI/2)
214 float FreqWarped = tan(PI * Freq / (2 * mNyquist));
215 if (mCutoff >= mNyquist)
216 mCutoff = mNyquist - 1;
217 float CutoffWarped = tan(PI * mCutoff / (2 * mNyquist));
218 float fOverflowThresh =
219 pow(10.0, 12.0 / (2 * mOrder)); // once we exceed 10^12 there's not much
220 // to be gained and overflow could happen
221
222 switch (mFilterType)
223 {
224 case kButterworth: // Butterworth
225 default:
226 switch (mFilterSubtype)
227 {
228 case kLowPass: // lowpass
229 default:
230 if (FreqWarped / CutoffWarped > fOverflowThresh) // prevent pow()
231 // overflow
232 Magn = 0;
233 else
234 Magn = sqrt(1 / (1 + pow(FreqWarped / CutoffWarped, 2 * mOrder)));
235 break;
236 case kHighPass: // highpass
237 if (FreqWarped / CutoffWarped > fOverflowThresh)
238 Magn = 1;
239 else
240 Magn = sqrt(
241 pow(FreqWarped / CutoffWarped, 2 * mOrder) /
242 (1 + pow(FreqWarped / CutoffWarped, 2 * mOrder)));
243 break;
244 }
245 break;
246
247 case kChebyshevTypeI: // Chebyshev Type 1
248 double eps;
249 eps = sqrt(pow(10.0, std::max<double>(0.001, mRipple) / 10.0) - 1);
250 double chebyPolyVal;
251 switch (mFilterSubtype)
252 {
253 case 0: // lowpass
254 default:
255 chebyPolyVal = Biquad::ChebyPoly(mOrder, FreqWarped / CutoffWarped);
256 Magn = sqrt(1 / (1 + square(eps) * square(chebyPolyVal)));
257 break;
258 case 1:
259 chebyPolyVal = Biquad::ChebyPoly(mOrder, CutoffWarped / FreqWarped);
260 Magn = sqrt(1 / (1 + square(eps) * square(chebyPolyVal)));
261 break;
262 }
263 break;
264
265 case kChebyshevTypeII: // Chebyshev Type 2
266 eps = 1 / sqrt(pow(10.0, std::max<double>(0.001, mStopbandRipple) / 10.0) - 1);
267 switch (mFilterSubtype)
268 {
269 case kLowPass: // lowpass
270 default:
271 chebyPolyVal = Biquad::ChebyPoly(mOrder, CutoffWarped / FreqWarped);
272 Magn = sqrt(1 / (1 + 1 / (square(eps) * square(chebyPolyVal))));
273 break;
274 case kHighPass:
275 chebyPolyVal = Biquad::ChebyPoly(mOrder, FreqWarped / CutoffWarped);
276 Magn = sqrt(1 / (1 + 1 / (square(eps) * square(chebyPolyVal))));
277 break;
278 }
279 break;
280 }
281
282 return Magn;
283}
#define square(a)
#define PI
__finl float_x4 __vecc sqrt(const float_x4 &a)
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, staffpad::audio::simd::sqrt(), and square.

Referenced by EffectScienFilterPanel::OnPaint().

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

◆ GetAudioInCount()

unsigned ScienFilterBase::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 125 of file ScienFilterBase.cpp.

126{
127 return 1;
128}

◆ GetAudioOutCount()

unsigned ScienFilterBase::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 130 of file ScienFilterBase.cpp.

131{
132 return 1;
133}

◆ GetDescription()

TranslatableString ScienFilterBase::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 107 of file ScienFilterBase.cpp.

108{
109 /* i18n-hint: "infinite impulse response" */
110 return XO("Performs IIR filtering that emulates analog filters");
111}
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol ScienFilterBase::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 102 of file ScienFilterBase.cpp.

103{
104 return Symbol;
105}
static const ComponentInterfaceSymbol Symbol

References Symbol.

◆ GetType()

EffectType ScienFilterBase::GetType ( ) const
overridevirtual

Type determines how it behaves.

Implements EffectDefinitionInterface.

Definition at line 120 of file ScienFilterBase.cpp.

121{
122 return EffectTypeProcess;
123}
@ EffectTypeProcess

References EffectTypeProcess.

◆ Init()

bool ScienFilterBase::Init ( )
overridevirtual

Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 159 of file ScienFilterBase.cpp.

160{
161 int selcount = 0;
162 double rate = 0.0;
163
164 auto trackRange = inputTracks()->Selected<const WaveTrack>();
165
166 {
167 auto t = *trackRange.begin();
168 mNyquist = (t ? t->GetRate() : mProjectRate) / 2.0;
169 }
170
171 for (auto t : trackRange)
172 {
173 if (selcount == 0)
174 rate = t->GetRate();
175 else
176 {
177 if (t->GetRate() != rate)
178 {
180 "To apply a filter, all selected tracks must have the same sample rate."));
181 return false;
182 }
183 }
184 ++selcount;
185 }
186
187 return true;
188}
const TrackList * inputTracks() const
Definition: EffectBase.h:102
double mProjectRate
Definition: EffectBase.h:119
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:967
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
MessageBoxResult ShowMessageBox(const TranslatableString &message, MessageBoxOptions options={})
Show a modal message box with either Ok or Yes and No, and optionally Cancel.
Definition: BasicUI.h:287

References EffectBase::inputTracks(), mNyquist, EffectBase::mProjectRate, TrackList::Selected(), BasicUI::ShowMessageBox(), and XO().

Here is the call graph for this function:

◆ ManualPage()

ManualPageID ScienFilterBase::ManualPage ( ) const
overridevirtual

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

Reimplemented from EffectDefinitionInterface.

Definition at line 113 of file ScienFilterBase.cpp.

114{
115 return L"Classic_Filters";
116}

◆ Parameters()

const EffectParameterMethods & ScienFilterBase::Parameters ( ) const
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 55 of file ScienFilterBase.cpp.

56{
57 static CapturedParameters<
59 parameters {
61 bool updating) {
62 if (updating)
63 {
64 e.mOrderIndex = e.mOrder - 1;
65 e.CalcFilter();
66 }
67 return true;
68 },
69 };
70 return parameters;
71}
Generates EffectParameterMethods overrides from variadic template arguments.
An Effect that applies 'classical' IIR filters.
static constexpr EnumParameter Subtype
static constexpr EffectParameter Stopband
static constexpr EffectParameter Cutoff
static constexpr EffectParameter Order
static constexpr EnumParameter Type
static constexpr EffectParameter Passband
Externalized state of a plug-in.

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

Referenced by ScienFilterBase().

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

◆ ProcessBlock()

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

Called for destructive effect computation.

Implements StatefulPerTrackEffect.

Definition at line 143 of file ScienFilterBase.cpp.

146{
147 const float* ibuf = inBlock[0];
148 for (int iPair = 0; iPair < (mOrder + 1) / 2; iPair++)
149 {
150 mpBiquad[iPair].Process(ibuf, outBlock[0], blockLen);
151 ibuf = outBlock[0];
152 }
153
154 return blockLen;
155}

References mOrder, and mpBiquad.

◆ ProcessInitialize()

bool ScienFilterBase::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 StatefulEffectBase.

Definition at line 135 of file ScienFilterBase.cpp.

137{
138 for (int iPair = 0; iPair < (mOrder + 1) / 2; iPair++)
139 mpBiquad[iPair].Reset();
140 return true;
141}

References mOrder, and mpBiquad.

Member Data Documentation

◆ Cutoff

constexpr EffectParameter ScienFilterBase::Cutoff
staticconstexprprotected
Initial value:
{
&ScienFilterBase::mCutoff, L"Cutoff", 1000.0f, 1.0, FLT_MAX, 1
}

Definition at line 117 of file ScienFilterBase.h.

Referenced by Parameters().

◆ kSubTypeStrings

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

Definition at line 85 of file ScienFilterBase.h.

◆ kTypeStrings

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

Definition at line 94 of file ScienFilterBase.h.

◆ mCutoff

float ScienFilterBase::mCutoff
protected

Definition at line 61 of file ScienFilterBase.h.

Referenced by CalcFilter(), and FilterMagnAtFreq().

◆ mdBMax

double ScienFilterBase::mdBMax
protected

◆ mdBMin

double ScienFilterBase::mdBMin
protected

◆ mEditingBatchParams

bool ScienFilterBase::mEditingBatchParams
protected

Definition at line 72 of file ScienFilterBase.h.

◆ mFilterSubtype

int ScienFilterBase::mFilterSubtype
protected

◆ mFilterType

int ScienFilterBase::mFilterType
protected

◆ mLoFreq

double ScienFilterBase::mLoFreq
protected

Definition at line 74 of file ScienFilterBase.h.

Referenced by ScienFilterBase().

◆ mNyquist

double ScienFilterBase::mNyquist
protected

Definition at line 75 of file ScienFilterBase.h.

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

◆ mOrder

int ScienFilterBase::mOrder
protected

◆ mOrderIndex

int ScienFilterBase::mOrderIndex
protected

◆ mpBiquad

ArrayOf<Biquad> ScienFilterBase::mpBiquad
protected

Definition at line 68 of file ScienFilterBase.h.

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

◆ mRipple

float ScienFilterBase::mRipple
protected

Definition at line 62 of file ScienFilterBase.h.

Referenced by CalcFilter(), and FilterMagnAtFreq().

◆ mStopbandRipple

float ScienFilterBase::mStopbandRipple
protected

Definition at line 63 of file ScienFilterBase.h.

Referenced by CalcFilter(), and FilterMagnAtFreq().

◆ Order

constexpr EffectParameter ScienFilterBase::Order
staticconstexprprotected
Initial value:
{
&ScienFilterBase::mOrder, L"Order", 1, 1, 10, 1
}

Definition at line 114 of file ScienFilterBase.h.

Referenced by Parameters().

◆ Passband

constexpr EffectParameter ScienFilterBase::Passband
staticconstexprprotected
Initial value:
{
&ScienFilterBase::mRipple, L"PassbandRipple", 1.0f, 0.0, 100.0, 1
}

Definition at line 120 of file ScienFilterBase.h.

Referenced by Parameters().

◆ Stopband

constexpr EffectParameter ScienFilterBase::Stopband
staticconstexprprotected
Initial value:
{
&ScienFilterBase::mStopbandRipple, L"StopbandRipple", 30.0f, 0.0, 100.0, 1
}

Definition at line 123 of file ScienFilterBase.h.

Referenced by Parameters().

◆ Subtype

constexpr EnumParameter ScienFilterBase::Subtype
staticconstexprprotected
Initial value:
L"FilterSubtype",
0,
nSubTypes - 1,
1,
static const EnumValueSymbol kSubTypeStrings[nSubTypes]

Definition at line 106 of file ScienFilterBase.h.

Referenced by Parameters().

◆ Symbol

const ComponentInterfaceSymbol ScienFilterBase::Symbol
static
Initial value:
{ XO(
"Classic Filters") }

Definition at line 27 of file ScienFilterBase.h.

Referenced by GetSymbol().

◆ Type

constexpr EnumParameter ScienFilterBase::Type
staticconstexprprotected
Initial value:
L"FilterType",
0,
nTypes - 1,
1,
static const EnumValueSymbol kTypeStrings[nTypes]

Definition at line 98 of file ScienFilterBase.h.

Referenced by Parameters().


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