Audacity 3.2.0
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
StatefulEffectBase Class Referenceabstract

#include <StatefulEffectBase.h>

Inheritance diagram for StatefulEffectBase:
[legend]

Classes

class  Instance
 Calls through to members of StatefulEffectBase. More...
 

Public Types

using MessagePackage = EffectInstance::MessagePackage
 

Public Member Functions

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
 

Private Attributes

size_t mEffectBlockSize { 0 }
 

Detailed Description

A mix-in class for effects that are not yet migrated to statelessness. To be eliminated when all effects are migrated

Definition at line 23 of file StatefulEffectBase.h.

Member Typedef Documentation

◆ MessagePackage

Definition at line 101 of file StatefulEffectBase.h.

Member Function Documentation

◆ GetAudioInCount()

unsigned StatefulEffectBase::GetAudioInCount ( ) const
virtual

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 in AmplifyBase, Fade, Invert, ScienFilterBase, StereoToMono, and VampEffect.

Definition at line 125 of file StatefulEffectBase.cpp.

126{
127 return 0;
128}

◆ GetAudioOutCount()

unsigned StatefulEffectBase::GetAudioOutCount ( ) const
virtual

How many output buffers to allocate at once.

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

Reimplemented in AmplifyBase, Fade, Invert, NoiseBase, ScienFilterBase, StereoToMono, and ToneGenBase.

Definition at line 130 of file StatefulEffectBase.cpp.

131{
132 return 0;
133}

◆ GetBlockSize()

size_t StatefulEffectBase::GetBlockSize ( ) const
virtual

Default implementation returns mEffectBlockSize

Reimplemented in StatefulPerTrackEffect.

Definition at line 120 of file StatefulEffectBase.cpp.

121{
122 return mEffectBlockSize;
123}

References mEffectBlockSize.

◆ GetLatency()

sampleCount StatefulEffectBase::GetLatency ( ) const
virtual

Default implementation returns 0

Definition at line 183 of file StatefulEffectBase.cpp.

184{
185 return 0;
186}

◆ Init()

bool StatefulEffectBase::Init ( )
virtual

Default implementation does nothing, returns true

Reimplemented in AmplifyBase, AutoDuckBase, ChangeSpeedBase, EqualizationBase, ScienFilterBase, NyquistBase, and VampEffect.

Definition at line 178 of file StatefulEffectBase.cpp.

179{
180 return true;
181}

◆ NeedsDither()

bool StatefulEffectBase::NeedsDither ( ) const
virtual

Reimplemented in Invert, Repair, RepeatBase, and TruncSilenceBase.

Definition at line 188 of file StatefulEffectBase.cpp.

189{
190 return true;
191}

◆ Process()

virtual bool StatefulEffectBase::Process ( EffectInstance instance,
EffectSettings settings 
)
pure virtual

Implemented in StatefulPerTrackEffect, AutoDuckBase, ChangeSpeedBase, ClickRemovalBase, EqualizationBase, FindClippingBase, Generator, LoudnessBase, NoiseReductionBase, NormalizeBase, PaulstretchBase, Repair, RepeatBase, Reverse, SBSMSBase, StereoToMono, TimeScaleBase, TruncSilenceBase, EffectTwoPassSimpleMono, NyquistBase, and VampEffect.

Referenced by StatefulEffect::Instance::Process().

Here is the caller graph for this function:

◆ ProcessFinalize()

bool StatefulEffectBase::ProcessFinalize ( void  )
virtualnoexcept

Called at end of destructive processing, for each (mono/stereo) track Default implementation does nothing, returns true This may be called during stack unwinding:

Reimplemented in StatefulPerTrackEffect.

Definition at line 199 of file StatefulEffectBase.cpp.

200{
201 return true;
202}

◆ ProcessInitialize()

bool StatefulEffectBase::ProcessInitialize ( EffectSettings settings,
double  sampleRate,
ChannelNames  chanMap = nullptr 
)
virtual

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 in Fade, NoiseBase, ScienFilterBase, ToneGenBase, and StatefulPerTrackEffect.

Definition at line 193 of file StatefulEffectBase.cpp.

195{
196 return true;
197}

◆ RealtimeAddProcessor()

bool StatefulEffectBase::RealtimeAddProcessor ( EffectSettings settings,
EffectOutputs pOutputs,
unsigned  numChannels,
float  sampleRate 
)
virtual

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

Definition at line 140 of file StatefulEffectBase.cpp.

142{
143 return true;
144}

◆ RealtimeFinalize()

bool StatefulEffectBase::RealtimeFinalize ( EffectSettings settings)
virtualnoexcept

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

Definition at line 173 of file StatefulEffectBase.cpp.

174{
175 return false;
176}

◆ RealtimeInitialize()

bool StatefulEffectBase::RealtimeInitialize ( EffectSettings settings,
double  sampleRate 
)
virtual

Returns
success
Postcondition
GetAudioInCount() and GetAudioOutCount() are well defined

Default implementation does nothing, returns false (so assume realtime is not supported). Other member functions related to realtime return true or zero, but will not be called, unless a derived class overrides RealtimeInitialize. Default implementation does nothing, returns false

Definition at line 135 of file StatefulEffectBase.cpp.

136{
137 return false;
138}

◆ RealtimeProcess()

size_t StatefulEffectBase::RealtimeProcess ( size_t  group,
EffectSettings settings,
const float *const *  inBuf,
float *const *  outBuf,
size_t  numSamples 
)
virtual

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

Definition at line 161 of file StatefulEffectBase.cpp.

164{
165 return 0;
166}

◆ RealtimeProcessEnd()

bool StatefulEffectBase::RealtimeProcessEnd ( EffectSettings settings)
virtualnoexcept

settings can be updated to let a dialog change appearance at idle

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

Definition at line 168 of file StatefulEffectBase.cpp.

169{
170 return true;
171}

◆ RealtimeProcessStart()

bool StatefulEffectBase::RealtimeProcessStart ( MessagePackage package)
virtual

settings are possibly changed, since last call, by an asynchronous dialog

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

Definition at line 156 of file StatefulEffectBase.cpp.

157{
158 return true;
159}

◆ RealtimeResume()

bool StatefulEffectBase::RealtimeResume ( )
virtual

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

Definition at line 151 of file StatefulEffectBase.cpp.

152{
153 return true;
154}

◆ RealtimeSuspend()

bool StatefulEffectBase::RealtimeSuspend ( )
virtual

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

Definition at line 146 of file StatefulEffectBase.cpp.

147{
148 return true;
149}

◆ SetBlockSize()

size_t StatefulEffectBase::SetBlockSize ( size_t  maxBlockSize)
virtual

Default implementation assigns mEffectBlockSize, returns it

Reimplemented in StatefulPerTrackEffect.

Definition at line 114 of file StatefulEffectBase.cpp.

References anonymous_namespace{StaffPadTimeAndPitch.cpp}::maxBlockSize, and mEffectBlockSize.

Member Data Documentation

◆ mEffectBlockSize

size_t StatefulEffectBase::mEffectBlockSize { 0 }
private

Definition at line 175 of file StatefulEffectBase.h.

Referenced by GetBlockSize(), and SetBlockSize().


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