Audacity 3.2.0
Classes | 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]

Classes

struct  MessagePackage
 

Public Types

using Message = EffectSettingsAccess::Message
 
using SampleCount = uint64_t
 

Public Member Functions

virtual ~EffectInstance ()
 
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, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual std::unique_ptr< MessageMakeMessage () const
 Called on the main thread, in which the result may be cloned. More...
 
virtual bool UsesMessages () const noexcept
 
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 void RealtimePassThrough (size_t group, EffectSettings &settings, const float *const *inBuf, size_t numSamples)
 Called instead of RealtimeProcess when the effect is bypassed. Default implementation does nothing. More...
 
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 SampleCount GetLatency (const EffectSettings &settings, double sampleRate) const
 
virtual bool NeedsDither () const
 
virtual bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap)=0
 
virtual bool ProcessFinalize () noexcept=0
 
virtual size_t ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen)=0
 Called for destructive effect computation. More...
 

Detailed Description

Performs effect computation.

Definition at line 449 of file EffectInterface.h.

Member Typedef Documentation

◆ Message

Type of messages to send from main thread to processing, which can describe the transitions of settings (instead of their states)

Definition at line 506 of file EffectInterface.h.

◆ SampleCount

using EffectInstance::SampleCount = uint64_t

Definition at line 562 of file EffectInterface.h.

Constructor & Destructor Documentation

◆ ~EffectInstance()

EffectInstance::~EffectInstance ( )
virtualdefault

Member Function Documentation

◆ 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, BassTrebleBase::Instance, CompressorInstance, DistortionBase::Instance, DtmfBase::Instance, EchoBase::Instance, PhaserBase::Instance, ReverbBase::Instance, WahWahBase::Instance, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Referenced by EffectStage::Process(), and 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, BassTrebleBase::Instance, CompressorInstance, DistortionBase::Instance, DtmfBase::Instance, EchoBase::Instance, PhaserBase::Instance, ReverbBase::Instance, WahWahBase::Instance, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Referenced by EffectStage::Process(), and 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, CompressorInstance, StatefulEffect::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Definition at line 197 of file EffectInterface.cpp.

199{
200 return 0;
201}

◆ 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 192 of file EffectInterface.cpp.

193{
194 return 0;
195}

◆ MakeMessage()

auto EffectInstance::MakeMessage ( ) const
virtual

Called on the main thread, in which the result may be cloned.

Default implementation returns a null

Reimplemented in AudioUnitInstance, and VSTInstance.

Definition at line 155 of file EffectInterface.cpp.

156{
157 return nullptr;
158}

◆ NeedsDither()

bool EffectInstance::NeedsDither ( ) const
virtual

If true (default result), then results require dither if later rendered to a narrower sample format

Reimplemented in StatefulEffectBase::Instance.

Definition at line 203 of file EffectInterface.cpp.

204{
205 return true;
206}

Referenced by PerTrackEffect::ProcessPass().

Here is the caller graph for this function:

◆ ProcessBlock()

virtual size_t EffectInstance::ProcessBlock ( EffectSettings settings,
const float *const *  inBlock,
float *const *  outBlock,
size_t  blockLen 
)
pure virtual

Called for destructive effect computation.

Implemented in AudioUnitInstance, BassTrebleBase::Instance, CompressorInstance, DistortionBase::Instance, DtmfBase::Instance, EchoBase::Instance, PhaserBase::Instance, ReverbBase::Instance, WahWahBase::Instance, StatefulEffect::Instance, StatefulPerTrackEffect::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Referenced by EffectStage::Process().

Here is the caller graph for this function:

◆ ProcessFinalize()

virtual bool EffectInstance::ProcessFinalize ( )
pure 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:

Implemented in AudioUnitInstance, CompressorInstance, EchoBase::Instance, PerTrackEffect::Instance, StatefulEffectBase::Instance, StatefulPerTrackEffect::Instance, LadspaInstance, VSTInstance, VST3Instance, and ReverbBase::Instance.

◆ ProcessInitialize()

virtual bool EffectInstance::ProcessInitialize ( EffectSettings settings,
double  sampleRate,
ChannelNames  chanMap 
)
pure 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

Implemented in AudioUnitInstance, BassTrebleBase::Instance, CompressorInstance, DistortionBase::Instance, DtmfBase::Instance, EchoBase::Instance, PhaserBase::Instance, ReverbBase::Instance, WahWahBase::Instance, PerTrackEffect::Instance, StatefulEffectBase::Instance, StatefulPerTrackEffect::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

◆ RealtimeAddProcessor()

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

Reimplemented in ReverbBase::Instance, AudioUnitInstance, BassTrebleBase::Instance, CompressorInstance, DistortionBase::Instance, PhaserBase::Instance, WahWahBase::Instance, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Definition at line 139 of file EffectInterface.cpp.

141{
142 return true;
143}

◆ RealtimeFinalize()

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

Reimplemented in AudioUnitInstance, BassTrebleBase::Instance, CompressorInstance, DistortionBase::Instance, PhaserBase::Instance, ReverbBase::Instance, WahWahBase::Instance, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Definition at line 187 of file EffectInterface.cpp.

188{
189 return true;
190}

◆ 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, CompressorInstance, ReverbBase::Instance, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, VST3Instance, BassTrebleBase::Instance, DistortionBase::Instance, PhaserBase::Instance, and WahWahBase::Instance.

Definition at line 134 of file EffectInterface.cpp.

135{
136 return false;
137}

◆ RealtimePassThrough()

void EffectInstance::RealtimePassThrough ( size_t  group,
EffectSettings settings,
const float *const *  inBuf,
size_t  numSamples 
)
virtual

Called instead of RealtimeProcess when the effect is bypassed. Default implementation does nothing.

Reimplemented in CompressorInstance.

Definition at line 176 of file EffectInterface.cpp.

179{
180}

◆ 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, BassTrebleBase::Instance, CompressorInstance, DistortionBase::Instance, PhaserBase::Instance, ReverbBase::Instance, WahWahBase::Instance, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Definition at line 170 of file EffectInterface.cpp.

172{
173 return 0;
174}

◆ 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, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Definition at line 182 of file EffectInterface.cpp.

183{
184 return true;
185}

◆ RealtimeProcessStart()

bool EffectInstance::RealtimeProcessStart ( MessagePackage package)
virtual

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

Returns
success Default implementation does nothing, returns true

Reimplemented in AudioUnitInstance, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Definition at line 165 of file EffectInterface.cpp.

166{
167 return true;
168}

◆ RealtimeResume()

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

Reimplemented in AudioUnitInstance, CompressorInstance, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Definition at line 150 of file EffectInterface.cpp.

151{
152 return true;
153}

◆ RealtimeSuspend()

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

Reimplemented in AudioUnitInstance, ReverbBase::Instance, StatefulEffectBase::Instance, LadspaInstance, LV2Instance, VSTInstance, and VST3Instance.

Definition at line 145 of file EffectInterface.cpp.

146{
147 return true;
148}

◆ SetBlockSize()

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

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

Referenced by PerTrackEffect::ProcessPass().

Here is the caller graph for this function:

◆ UsesMessages()

bool EffectInstance::UsesMessages ( ) const
virtualnoexcept

If true, the effect makes no use EffectSettings for inter-thread comminication

Default implementation returns false. In future, all effects should be rewritten to use messages and this function will be removed.

Reimplemented in AudioUnitInstance, and VSTInstance.

Definition at line 160 of file EffectInterface.cpp.

161{
162 return false;
163}

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