Audacity 3.2.0
Public Types | Public Member Functions | List of all members
EffectInstance Class Referenceabstract

Performs effect computation. More...

#include <EffectInterface.h>

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

Public Types

using SampleCount = uint64_t
 

Public Member Functions

virtual ~EffectInstance ()
 
virtual bool Init ()
 Call once to set up state for whole list of tracks to be processed. More...
 
virtual bool Process (EffectSettings &settings)=0
 Actually do the effect here. More...
 
virtual size_t GetBlockSize () const =0
 
virtual size_t SetBlockSize (size_t maxBlockSize)=0
 
virtual unsigned GetAudioInCount () const =0
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const =0
 How many output buffers to allocate at once. More...
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (EffectSettings &settings)
 settings are possibly changed, since last call, by an asynchronous dialog More...
 
virtual size_t RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 settings can be updated to let a dialog change appearance at idle More...
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t GetTailSize () const
 
virtual void AssignSettings (EffectSettings &dst, EffectSettings &&src) const
 Main thread receives updates to settings from a processing thread. More...
 
virtual SampleCount GetLatency (const EffectSettings &settings, double sampleRate) const
 

Detailed Description

Performs effect computation.

Definition at line 378 of file EffectInterface.h.

Member Typedef Documentation

◆ SampleCount

using EffectInstance::SampleCount = uint64_t

Definition at line 483 of file EffectInterface.h.

Constructor & Destructor Documentation

◆ ~EffectInstance()

EffectInstance::~EffectInstance ( )
virtualdefault

Member Function Documentation

◆ AssignSettings()

void EffectInstance::AssignSettings ( EffectSettings dst,
EffectSettings &&  src 
) const
virtual

Main thread receives updates to settings from a processing thread.

Default implementation simply assigns by copy, not move This might be overridden to copy contents only selectively

Reimplemented in VST3Instance.

Definition at line 171 of file EffectInterface.cpp.

173{
174 dst = src;
175}

◆ GetAudioInCount()

virtual unsigned EffectInstance::GetAudioInCount ( ) const
pure 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

Implemented in AudioUnitInstance, EffectDtmf::Instance, EffectEcho::Instance, LadspaEffect::Instance, LV2Instance, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

Referenced by PerTrackEffect::ProcessPass().

Here is the caller graph for this function:

◆ GetAudioOutCount()

virtual unsigned EffectInstance::GetAudioOutCount ( ) const
pure virtual

How many output buffers to allocate at once.

The result is not necessarily well defined before RealtimeInitialize

Implemented in AudioUnitInstance, EffectDtmf::Instance, EffectEcho::Instance, LadspaEffect::Instance, LV2Instance, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

Referenced by PerTrackEffect::ProcessPass().

Here is the caller graph for this function:

◆ GetBlockSize()

virtual size_t EffectInstance::GetBlockSize ( ) const
pure virtual

◆ GetLatency()

auto EffectInstance::GetLatency ( const EffectSettings settings,
double  sampleRate 
) const
virtual

Default implementation returns 0

Reimplemented in AudioUnitInstance, StatefulEffect::Instance, LadspaEffect::Instance, LV2Instance, VSTEffectInstance, and VST3Instance.

Definition at line 177 of file EffectInterface.cpp.

179{
180 return 0;
181}

◆ GetTailSize()

size_t EffectInstance::GetTailSize ( ) const
virtual

Function that has not yet found a use Correct definitions of it will likely depend on settings and state

Reimplemented in VST3Instance.

Definition at line 166 of file EffectInterface.cpp.

167{
168 return 0;
169}

◆ Init()

bool EffectInstance::Init ( )
virtual

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

Returns
success Default implementation does nothing, returns true

Reimplemented in StatefulEffectBase::Instance, and VST3Instance.

Definition at line 120 of file EffectInterface.cpp.

121{
122 return true;
123}

◆ Process()

virtual bool EffectInstance::Process ( EffectSettings settings)
pure virtual

Actually do the effect here.

Returns
success

Implemented in PerTrackEffect::Instance, and StatefulEffect::Instance.

◆ RealtimeAddProcessor()

bool EffectInstance::RealtimeAddProcessor ( EffectSettings settings,
unsigned  numChannels,
float  sampleRate 
)
virtual
Returns
success Default implementation does nothing, returns true

Reimplemented in AudioUnitInstance, LadspaEffect::Instance, LV2Instance, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

Definition at line 130 of file EffectInterface.cpp.

131{
132 return true;
133}

◆ RealtimeFinalize()

bool EffectInstance::RealtimeFinalize ( EffectSettings settings)
virtualnoexcept
Returns
success Default implementation does nothing, returns true

Reimplemented in AudioUnitInstance, LadspaEffect::Instance, LV2Instance, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

Definition at line 161 of file EffectInterface.cpp.

162{
163 return true;
164}

◆ RealtimeInitialize()

bool EffectInstance::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.

Reimplemented in AudioUnitInstance, LadspaEffect::Instance, LV2Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, EffectReverb::Instance, and EffectWahwah::Instance.

Definition at line 125 of file EffectInterface.cpp.

126{
127 return false;
128}

◆ RealtimeProcess()

size_t EffectInstance::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

Reimplemented in AudioUnitInstance, LadspaEffect::Instance, LV2Instance, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

Definition at line 150 of file EffectInterface.cpp.

152{
153 return 0;
154}

◆ RealtimeProcessEnd()

bool EffectInstance::RealtimeProcessEnd ( EffectSettings settings)
virtualnoexcept

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

Returns
success Default implementation does nothing, returns true

Reimplemented in AudioUnitInstance, LadspaEffect::Instance, LV2Instance, StatefulEffectBase::Instance, VSTEffectInstance, and VST3Instance.

Definition at line 156 of file EffectInterface.cpp.

157{
158 return true;
159}

◆ RealtimeProcessStart()

bool EffectInstance::RealtimeProcessStart ( EffectSettings settings)
virtual

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

Returns
success Default implementation does nothing, returns true

Reimplemented in AudioUnitInstance, LadspaEffect::Instance, LV2Instance, StatefulEffectBase::Instance, VSTEffectInstance, and VST3Instance.

Definition at line 145 of file EffectInterface.cpp.

146{
147 return true;
148}

◆ RealtimeResume()

bool EffectInstance::RealtimeResume ( )
virtual
Returns
success Default implementation does nothing, returns true

Reimplemented in AudioUnitInstance, LadspaEffect::Instance, LV2Instance, StatefulEffectBase::Instance, VSTEffectInstance, and VST3Instance.

Definition at line 140 of file EffectInterface.cpp.

141{
142 return true;
143}

◆ RealtimeSuspend()

bool EffectInstance::RealtimeSuspend ( )
virtual
Returns
success Default implementation does nothing, returns true

Reimplemented in AudioUnitInstance, LadspaEffect::Instance, LV2Instance, StatefulEffectBase::Instance, VSTEffectInstance, and VST3Instance.

Definition at line 135 of file EffectInterface.cpp.

136{
137 return true;
138}

◆ SetBlockSize()

virtual size_t EffectInstance::SetBlockSize ( size_t  maxBlockSize)
pure virtual

Implemented in EffectInstanceWithBlockSize, AudioUnitInstance, LV2Instance, StatefulEffectBase::Instance, VSTEffectInstance, and VST3Instance.

Referenced by PerTrackEffect::ProcessPass().

Here is the caller graph for this function:

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