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 EffectAmplify, EffectFade, EffectInvert, EffectScienFilter, EffectStereoToMono, and VampEffect.

Definition at line 154 of file StatefulEffectBase.cpp.

155{
156 return 0;
157}

◆ 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 EffectAmplify, EffectFade, EffectInvert, EffectNoise, EffectScienFilter, EffectStereoToMono, and EffectToneGen.

Definition at line 159 of file StatefulEffectBase.cpp.

160{
161 return 0;
162}

◆ GetBlockSize()

size_t StatefulEffectBase::GetBlockSize ( ) const
virtual

Default implementation returns mEffectBlockSize

Reimplemented in StatefulPerTrackEffect.

Definition at line 149 of file StatefulEffectBase.cpp.

150{
151 return mEffectBlockSize;
152}

References mEffectBlockSize.

◆ GetLatency()

sampleCount StatefulEffectBase::GetLatency ( ) const
virtual

Default implementation returns 0

Definition at line 212 of file StatefulEffectBase.cpp.

213{
214 return 0;
215}

◆ Init()

bool StatefulEffectBase::Init ( )
virtual

Default implementation does nothing, returns true

Reimplemented in EffectAmplify, EffectAutoDuck, EffectChangeSpeed, EffectEqualization, EffectNoiseRemoval, NyquistEffect, EffectScienFilter, and VampEffect.

Definition at line 207 of file StatefulEffectBase.cpp.

208{
209 return true;
210}

◆ NeedsDither()

bool StatefulEffectBase::NeedsDither ( ) const
virtual

Reimplemented in EffectInvert, EffectRepair, EffectRepeat, and EffectTruncSilence.

Definition at line 217 of file StatefulEffectBase.cpp.

218{
219 return true;
220}

◆ Process()

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

◆ 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 228 of file StatefulEffectBase.cpp.

229{
230 return true;
231}

◆ 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 EffectFade, EffectNoise, EffectScienFilter, EffectToneGen, and StatefulPerTrackEffect.

Definition at line 222 of file StatefulEffectBase.cpp.

224{
225 return true;
226}

◆ 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 169 of file StatefulEffectBase.cpp.

171{
172 return true;
173}

◆ RealtimeFinalize()

bool StatefulEffectBase::RealtimeFinalize ( EffectSettings settings)
virtualnoexcept

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

Definition at line 202 of file StatefulEffectBase.cpp.

203{
204 return false;
205}

◆ 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 164 of file StatefulEffectBase.cpp.

165{
166 return false;
167}

◆ 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 190 of file StatefulEffectBase.cpp.

193{
194 return 0;
195}

◆ 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 197 of file StatefulEffectBase.cpp.

198{
199 return true;
200}

◆ 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 185 of file StatefulEffectBase.cpp.

186{
187 return true;
188}

◆ RealtimeResume()

bool StatefulEffectBase::RealtimeResume ( )
virtual

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

Definition at line 180 of file StatefulEffectBase.cpp.

181{
182 return true;
183}

◆ RealtimeSuspend()

bool StatefulEffectBase::RealtimeSuspend ( )
virtual

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

Definition at line 175 of file StatefulEffectBase.cpp.

176{
177 return true;
178}

◆ SetBlockSize()

size_t StatefulEffectBase::SetBlockSize ( size_t  maxBlockSize)
virtual

Default implementation assigns mEffectBlockSize, returns it

Reimplemented in StatefulPerTrackEffect.

Definition at line 143 of file StatefulEffectBase.cpp.

144{
145 mEffectBlockSize = maxBlockSize;
146 return mEffectBlockSize;
147}

References 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: