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 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 454 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 511 of file EffectInterface.h.

◆ SampleCount

using EffectInstance::SampleCount = uint64_t

Definition at line 559 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, EffectBassTreble::Instance, EffectDistortion::Instance, EffectDtmf::Instance, EffectEcho::Instance, LadspaEffect::Instance, LV2Instance, EffectPhaser::Instance, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

Referenced by AudioGraph::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, EffectBassTreble::Instance, EffectDistortion::Instance, EffectDtmf::Instance, EffectEcho::Instance, LadspaEffect::Instance, LV2Instance, EffectPhaser::Instance, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

Referenced by AudioGraph::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, StatefulEffect::Instance, LadspaEffect::Instance, LV2Instance, VSTEffectInstance, and VST3Instance.

Definition at line 191 of file EffectInterface.cpp.

193{
194 return 0;
195}

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

187{
188 return 0;
189}

◆ 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 VSTEffectInstance.

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

198{
199 return true;
200}

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, EffectBassTreble::Instance, EffectDistortion::Instance, EffectDtmf::Instance, EffectEcho::Instance, StatefulEffect::Instance, LadspaEffect::Instance, LV2Instance, EffectPhaser::Instance, EffectReverb::Instance, StatefulPerTrackEffect::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

Referenced by AudioGraph::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, EffectEcho::Instance, LadspaEffect::Instance, PerTrackEffect::Instance, StatefulEffectBase::Instance, StatefulPerTrackEffect::Instance, VSTEffectInstance, VST3Instance, and EffectReverb::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, EffectBassTreble::Instance, EffectDistortion::Instance, EffectDtmf::Instance, EffectEcho::Instance, LadspaEffect::Instance, LV2Instance, PerTrackEffect::Instance, EffectPhaser::Instance, EffectReverb::Instance, StatefulEffectBase::Instance, StatefulPerTrackEffect::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

◆ RealtimeAddProcessor()

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

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

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, EffectBassTreble::Instance, EffectDistortion::Instance, LadspaEffect::Instance, LV2Instance, EffectPhaser::Instance, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, and EffectWahwah::Instance.

Definition at line 181 of file EffectInterface.cpp.

182{
183 return true;
184}

◆ 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, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, VST3Instance, EffectBassTreble::Instance, EffectDistortion::Instance, EffectPhaser::Instance, and EffectWahwah::Instance.

Definition at line 134 of file EffectInterface.cpp.

135{
136 return false;
137}

◆ RealtimeProcess()

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

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

177{
178 return true;
179}

◆ 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, LadspaEffect::Instance, LV2Instance, StatefulEffectBase::Instance, VSTEffectInstance, 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, LadspaEffect::Instance, LV2Instance, StatefulEffectBase::Instance, VSTEffectInstance, 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, LadspaEffect::Instance, LV2Instance, EffectReverb::Instance, StatefulEffectBase::Instance, VSTEffectInstance, 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 EffectInstanceWithBlockSize, AudioUnitInstance, LV2Instance, StatefulEffectBase::Instance, VSTEffectInstance, 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 VSTEffectInstance.

Definition at line 160 of file EffectInterface.cpp.

161{
162 return false;
163}

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