![]() |
Audacity 3.2.0
|
#include <VSTEffect.h>
Public Member Functions | |
VSTEffectInstance (PerTrackEffect &effect, const PluginPath &path, size_t blockSize, size_t userBlockSize, bool useLatency) | |
~VSTEffectInstance () override | |
bool | ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap) override |
bool | ProcessFinalize () noexcept override |
size_t | SetBlockSize (size_t maxBlockSize) override |
size_t | GetBlockSize () const override |
bool | RealtimeInitialize (EffectSettings &settings, double sampleRate) override |
bool | RealtimeAddProcessor (EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override |
bool | RealtimeFinalize (EffectSettings &settings) noexcept override |
bool | RealtimeSuspend () override |
bool | RealtimeResume () override |
bool | UsesMessages () const noexcept override |
bool | RealtimeProcessStart (MessagePackage &package) override |
settings are possibly changed, since last call, by an asynchronous dialog More... | |
size_t | RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inbuf, float *const *outbuf, size_t numSamples) override |
bool | RealtimeProcessEnd (EffectSettings &settings) noexcept override |
settings can be updated to let a dialog change appearance at idle More... | |
size_t | ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override |
Called for destructive effect computation. More... | |
SampleCount | GetLatency (const EffectSettings &settings, double sampleRate) const override |
bool | IsReady () |
unsigned | GetAudioInCount () const override |
How many input buffers to allocate at once. More... | |
unsigned | GetAudioOutCount () const override |
How many output buffers to allocate at once. More... | |
bool | DoProcessInitialize (double sampleRate) |
void | PowerOn () |
void | PowerOff () |
std::unique_ptr< Message > | MakeMessage () const override |
Called on the main thread, in which the result may be cloned. More... | |
std::unique_ptr< Message > | MakeMessage (int id, double value) const |
void | Automate (int index, float value) override |
void | NeedIdle () override |
void | SizeWindow (int w, int h) override |
void | SetBufferDelay (int samples) override |
void | SetOwningValidator (VSTEffectUIWrapper *vi) |
bool | OnePresetWasLoadedWhilePlaying () |
void | DeferChunkApplication () |
bool | HasGUI () const |
![]() | |
Instance (const PerTrackEffect &processor) | |
~Instance () override | |
bool | Process (EffectSettings &settings) final |
Uses the other virtual functions of this class. More... | |
bool | ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap) override |
bool | ProcessFinalize () noexcept override |
![]() | |
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... | |
~EffectInstanceEx () override | |
![]() | |
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< Message > | MakeMessage () 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... | |
![]() | |
VSTEffectWrapper (const PluginPath &path) | |
~VSTEffectWrapper () | |
intptr_t | callDispatcher (int opcode, int index, intptr_t value, void *ptr, float opt) override |
intptr_t | constCallDispatcher (int opcode, int index, intptr_t value, void *ptr, float opt) const |
float | callGetParameter (int index) const |
void | callSetChunk (bool isPgm, int len, void *buf) |
void | callSetChunk (bool isPgm, int len, void *buf, VstPatchChunkInfo *info) const |
int | GetString (wxString &outstr, int opcode, int index=0) const |
wxString | GetString (int opcode, int index=0) const |
void | ForEachParameter (ParameterVisitor visitor) const |
bool | FetchSettings (VSTEffectSettings &vst3Settings, bool doFetch=true) const |
bool | StoreSettings (const VSTEffectSettings &vst3settings) const |
VstPatchChunkInfo | GetChunkInfo () const |
bool | IsCompatible (const VstPatchChunkInfo &) const |
bool | LoadXML (const wxFileName &fn) |
bool | HandleXMLTag (const std::string_view &tag, const AttributesList &attrs) override |
void | HandleXMLEndTag (const std::string_view &tag) override |
void | HandleXMLContent (const std::string_view &content) override |
XMLTagHandler * | HandleXMLChild (const std::string_view &tag) override |
void | SetString (int opcode, const wxString &str, int index=0) |
ComponentInterfaceSymbol | GetSymbol () const |
void | callSetParameter (int index, float value) const |
void | SaveXML (const wxFileName &fn) const |
bool | LoadFXB (const wxFileName &fn) |
bool | LoadFXP (const wxFileName &fn) |
bool | LoadFXProgram (unsigned char **bptr, ssize_t &len, int index, bool dryrun) |
void | callSetProgram (int index) |
void | SaveFXB (const wxFileName &fn) const |
void | SaveFXP (const wxFileName &fn) const |
void | SaveFXProgram (wxMemoryBuffer &buf, int index) const |
bool | Load () |
void | Unload () |
void | ResetModuleAndHandle () |
VstTimeInfo * | GetTimeInfo () |
float | GetSampleRate () |
int | GetProcessLevel () |
virtual void | UpdateDisplay () |
virtual void | SetBufferDelay (int samples) |
std::unique_ptr< EffectInstance::Message > | MakeMessageFS (const VSTEffectSettings &settings) const |
![]() | |
virtual | ~VSTEffectLink () |
virtual intptr_t | callDispatcher (int opcode, int index, intptr_t value, void *ptr, float opt)=0 |
![]() | |
XMLTagHandler () | |
virtual | ~XMLTagHandler () |
virtual bool | HandleXMLTag (const std::string_view &tag, const AttributesList &attrs)=0 |
virtual void | HandleXMLEndTag (const std::string_view &WXUNUSED(tag)) |
virtual void | HandleXMLContent (const std::string_view &WXUNUSED(content)) |
virtual XMLTagHandler * | HandleXMLChild (const std::string_view &tag)=0 |
void | ReadXMLEndTag (const char *tag) |
void | ReadXMLContent (const char *s, int len) |
XMLTagHandler * | ReadXMLChild (const char *tag) |
![]() | |
virtual void | NeedIdle () |
virtual void | SizeWindow (int w, int h) |
virtual void | Automate (int index, float value) |
virtual void | Flush () |
Public Attributes | |
const bool | mUseLatency |
size_t | mBlockSize { 8192 } |
![]() | |
AEffect * | mAEffect = nullptr |
std::thread::id | mMainThreadId |
std::recursive_mutex | mDispatcherLock |
int | mVstVersion |
wxString | mName |
bool | mInSet |
bool | mInChunk |
wxString | mChunk |
long | mXMLVersion |
VstPatchChunkInfo | mXMLInfo |
intptr_t | mCurrentEffectID {} |
PluginPath | mPath |
ModuleHandle | mModule {} |
wxString | mVendor |
wxString | mDescription |
int | mVersion |
bool | mInteractive { false } |
unsigned | mAudioIns { 0 } |
unsigned | mAudioOuts { 0 } |
int | mMidiIns { 0 } |
int | mMidiOuts { 0 } |
bool | mAutomatable |
BundleHandle | mBundleRef |
ResourceHandle | mResource |
VstTimeInfo | mTimeInfo |
int | mBufferDelay { 0 } |
int | mProcessLevel { 1 } |
bool | mGui { false } |
Private Member Functions | |
void | callProcessReplacing (const float *const *inputs, float *const *outputs, int sampleframes) |
void | ApplyChunk (std::vector< char > &chunk) |
bool | ChunkMustBeAppliedInMainThread () const |
Private Attributes | |
VSTInstanceArray | mSlaves |
bool | mHasPower { false } |
size_t | mUserBlockSize { mBlockSize } |
bool | mReady { false } |
bool | mRecruited { false } |
VSTEffectUIWrapper * | mpOwningValidator {} |
std::atomic_bool | mPresetLoadedWhilePlaying { false } |
std::mutex | mDeferredChunkMutex |
std::vector< char > | mChunkToSetAtIdleTime {} |
bool | mIsMeldaPlugin { false } |
Additional Inherited Members | |
![]() | |
using | Message = EffectSettingsAccess::Message |
using | SampleCount = uint64_t |
![]() | |
using | ParameterVisitor = std::function< bool(const ParameterInfo &pi) > |
using | ModuleHandle = std::unique_ptr< wxDynamicLibrary > |
using | BundleHandle = CF_ptr< CFBundleRef > |
![]() | |
static VSTEffectSettings & | GetSettings (EffectSettings &settings) |
static const VSTEffectSettings & | GetSettings (const EffectSettings &settings) |
static intptr_t | AudioMaster (AEffect *effect, int32_t opcode, int32_t index, intptr_t value, void *ptr, float opt) |
![]() | |
const PerTrackEffect & | mProcessor |
Definition at line 488 of file VSTEffect.h.
VSTEffectInstance::VSTEffectInstance | ( | PerTrackEffect & | effect, |
const PluginPath & | path, | ||
size_t | blockSize, | ||
size_t | userBlockSize, | ||
bool | useLatency | ||
) |
Definition at line 4006 of file VSTEffect.cpp.
References DoProcessInitialize(), VstTimeInfo::flags, IsReady(), kVstNanosValid, kVstTempoValid, VSTEffectWrapper::Load(), mBlockSize, mIsMeldaPlugin, VSTEffectWrapper::mTimeInfo, mUserBlockSize, VSTEffectWrapper::mVendor, VstTimeInfo::nanoSeconds, VstTimeInfo::samplePos, VstTimeInfo::sampleRate, VstTimeInfo::tempo, VstTimeInfo::timeSigDenominator, and VstTimeInfo::timeSigNumerator.
|
override |
Definition at line 4047 of file VSTEffect.cpp.
References PowerOff().
|
private |
Definition at line 1265 of file VSTEffect.cpp.
References VSTEffectWrapper::callSetChunk(), VSTEffectWrapper::mAEffect, mSlaves, AEffect::numParams, AEffect::uniqueID, and AEffect::version.
Referenced by DeferChunkApplication(), and RealtimeProcessStart().
|
overridevirtual |
Reimplemented from VSTEffectUIWrapper.
Definition at line 3984 of file VSTEffect.cpp.
References VSTEffectUIWrapper::Automate(), VSTEffectWrapper::mMainThreadId, and mpOwningValidator.
|
private |
Definition at line 2473 of file VSTEffect.cpp.
References VSTEffectWrapper::mAEffect, and AEffect::processReplacing.
Referenced by ProcessBlock().
|
private |
Definition at line 1279 of file VSTEffect.cpp.
References mIsMeldaPlugin, and VSTEffectWrapper::mMainThreadId.
Referenced by RealtimeProcessStart().
void VSTEffectInstance::DeferChunkApplication | ( | ) |
Definition at line 1253 of file VSTEffect.cpp.
References ApplyChunk(), mChunkToSetAtIdleTime, and mDeferredChunkMutex.
Referenced by VSTEffectEditor::OnIdle().
bool VSTEffectInstance::DoProcessInitialize | ( | double | sampleRate | ) |
Definition at line 1120 of file VSTEffect.cpp.
References VSTEffectWrapper::callDispatcher(), effSetBlockSize, effSetSampleRate, VstTimeInfo::flags, AEffect::initialDelay, kVstNanosValid, kVstTempoValid, kVstTransportPlaying, VSTEffectWrapper::mAEffect, mBlockSize, mReady, VSTEffectWrapper::mTimeInfo, VstTimeInfo::nanoSeconds, PowerOn(), VstTimeInfo::sampleRate, SetBufferDelay(), VstTimeInfo::tempo, VstTimeInfo::timeSigDenominator, and VstTimeInfo::timeSigNumerator.
Referenced by ProcessInitialize(), and VSTEffectInstance().
|
overridevirtual |
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
Implements EffectInstance.
Definition at line 1061 of file VSTEffect.cpp.
References VSTEffectWrapper::mAudioIns.
Referenced by SetBlockSize().
|
overridevirtual |
How many output buffers to allocate at once.
The result is not necessarily well defined before RealtimeInitialize
Implements EffectInstance.
Definition at line 1066 of file VSTEffect.cpp.
References VSTEffectWrapper::mAudioOuts.
Referenced by SetBlockSize().
|
overridevirtual |
|
overridevirtual |
Default implementation returns 0
Reimplemented from EffectInstance.
Definition at line 1093 of file VSTEffect.cpp.
|
inline |
bool VSTEffectInstance::IsReady | ( | ) |
Definition at line 1101 of file VSTEffect.cpp.
References mReady.
Referenced by VSTEffectInstance().
|
overridevirtual |
Called on the main thread, in which the result may be cloned.
Default implementation returns a null
Reimplemented from EffectInstance.
Definition at line 1021 of file VSTEffect.cpp.
References VSTEffectWrapper::FetchSettings(), VSTEffectWrapper::mAEffect, AEffect::numParams, and settings().
Referenced by VSTEffectEditor::ValidateUI().
std::unique_ptr< EffectInstance::Message > VSTEffectInstance::MakeMessage | ( | int | id, |
double | value | ||
) | const |
Definition at line 1035 of file VSTEffect.cpp.
References VSTEffectWrapper::mAEffect, and AEffect::numParams.
|
overridevirtual |
Reimplemented from VSTEffectUIWrapper.
Definition at line 2238 of file VSTEffect.cpp.
References mpOwningValidator, and VSTEffectUIWrapper::NeedIdle().
bool VSTEffectInstance::OnePresetWasLoadedWhilePlaying | ( | ) |
Definition at line 1248 of file VSTEffect.cpp.
References mPresetLoadedWhilePlaying.
void VSTEffectInstance::PowerOff | ( | ) |
Definition at line 2294 of file VSTEffect.cpp.
References VSTEffectWrapper::callDispatcher(), effMainsChanged, effStopProcess, mHasPower, and VSTEffectWrapper::mVstVersion.
Referenced by ProcessFinalize(), RealtimeSuspend(), and ~VSTEffectInstance().
void VSTEffectInstance::PowerOn | ( | ) |
Definition at line 2276 of file VSTEffect.cpp.
References VSTEffectWrapper::callDispatcher(), effMainsChanged, effStartProcess, mHasPower, and VSTEffectWrapper::mVstVersion.
Referenced by VSTEffectEditor::BuildFancy(), DoProcessInitialize(), and RealtimeResume().
|
overridevirtual |
Called for destructive effect computation.
Implements EffectInstance.
Definition at line 1159 of file VSTEffect.cpp.
References callProcessReplacing(), VSTEffectWrapper::mTimeInfo, and VstTimeInfo::samplePos.
Referenced by RealtimeProcess().
|
overridevirtualnoexcept |
Called at end of destructive processing, for each (mono/stereo) track Default implementation does nothing, returns true This may be called during stack unwinding:
Implements EffectInstance.
Definition at line 1146 of file VSTEffect.cpp.
References mReady, and PowerOff().
|
overridevirtual |
Called at start of destructive processing, for each (mono/stereo) track Default implementation does nothing, returns true
chanMap | null or array terminated with ChannelNameEOL. Do not retain the pointer |
GetAudioInCount()
and GetAudioOutCount()
are well defined Implements EffectInstance.
Definition at line 1106 of file VSTEffect.cpp.
References DoProcessInitialize(), VSTEffectWrapper::GetSettings(), settings(), and VSTEffectWrapper::StoreSettings().
Referenced by RealtimeInitialize().
|
overridevirtual |
Reimplemented from EffectInstance.
Definition at line 1186 of file VSTEffect.cpp.
References mBlockSize, VSTEffectWrapper::mPath, PerTrackEffect::Instance::mProcessor, mRecruited, mSlaves, mUseLatency, mUserBlockSize, and settings().
|
overridevirtualnoexcept |
Reimplemented from EffectInstance.
Definition at line 1210 of file VSTEffect.cpp.
References for().
|
overridevirtual |
GetAudioInCount()
and GetAudioOutCount()
are well definedDefault 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 from EffectInstance.
Definition at line 1176 of file VSTEffect.cpp.
References mpOwningValidator, ProcessInitialize(), settings(), and valueRestorer().
|
overridevirtual |
Reimplemented from EffectInstance.
Definition at line 1367 of file VSTEffect.cpp.
References mBlockSize, mRecruited, mSlaves, ProcessBlock(), and settings().
|
overridevirtualnoexcept |
settings can be updated to let a dialog change appearance at idle
Reimplemented from EffectInstance.
Definition at line 1392 of file VSTEffect.cpp.
|
overridevirtual |
settings are possibly changed, since last call, by an asynchronous dialog
Reimplemented from EffectInstance.
Definition at line 1296 of file VSTEffect.cpp.
References ApplyChunk(), VSTEffectWrapper::callSetParameter(), ChunkMustBeAppliedInMainThread(), VSTEffectWrapper::mAEffect, mChunkToSetAtIdleTime, mDeferredChunkMutex, VSTEffectWrapper::mMainThreadId, mPresetLoadedWhilePlaying, mSlaves, AEffect::numParams, and EffectInstance::MessagePackage::pMessage.
|
overridevirtual |
Reimplemented from EffectInstance.
Definition at line 1237 of file VSTEffect.cpp.
References mSlaves, and PowerOn().
|
overridevirtual |
Reimplemented from EffectInstance.
Definition at line 1227 of file VSTEffect.cpp.
References mSlaves, and PowerOff().
|
overridevirtual |
Implements EffectInstance.
Definition at line 1071 of file VSTEffect.cpp.
References GetAudioInCount(), GetAudioOutCount(), mBlockSize, min(), and mUserBlockSize.
|
overridevirtual |
Reimplemented from VSTEffectWrapper.
Definition at line 2414 of file VSTEffect.cpp.
References VSTEffectWrapper::mBufferDelay, and mUseLatency.
Referenced by DoProcessInitialize().
void VSTEffectInstance::SetOwningValidator | ( | VSTEffectUIWrapper * | vi | ) |
Definition at line 4053 of file VSTEffect.cpp.
References mpOwningValidator.
Referenced by VSTEffectEditor::OnClose(), and VSTEffectEditor::~VSTEffectEditor().
|
overridevirtual |
Reimplemented from VSTEffectUIWrapper.
Definition at line 2316 of file VSTEffect.cpp.
References mpOwningValidator, and VSTEffectUIWrapper::SizeWindow().
|
overridevirtualnoexcept |
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 from EffectInstance.
Definition at line 1291 of file VSTEffect.cpp.
size_t VSTEffectInstance::mBlockSize { 8192 } |
Definition at line 547 of file VSTEffect.h.
Referenced by DoProcessInitialize(), GetBlockSize(), RealtimeAddProcessor(), RealtimeProcess(), SetBlockSize(), and VSTEffectInstance().
|
private |
Definition at line 590 of file VSTEffect.h.
Referenced by DeferChunkApplication(), and RealtimeProcessStart().
|
private |
Definition at line 589 of file VSTEffect.h.
Referenced by DeferChunkApplication(), and RealtimeProcessStart().
|
private |
Definition at line 577 of file VSTEffect.h.
Referenced by PowerOff(), and PowerOn().
|
private |
Definition at line 596 of file VSTEffect.h.
Referenced by ChunkMustBeAppliedInMainThread(), and VSTEffectInstance().
|
private |
Definition at line 585 of file VSTEffect.h.
Referenced by Automate(), NeedIdle(), RealtimeInitialize(), SetOwningValidator(), and SizeWindow().
|
private |
Definition at line 587 of file VSTEffect.h.
Referenced by OnePresetWasLoadedWhilePlaying(), and RealtimeProcessStart().
|
private |
Definition at line 581 of file VSTEffect.h.
Referenced by DoProcessInitialize(), IsReady(), and ProcessFinalize().
|
private |
Definition at line 583 of file VSTEffect.h.
Referenced by RealtimeAddProcessor(), and RealtimeProcess().
|
private |
Definition at line 575 of file VSTEffect.h.
Referenced by ApplyChunk(), RealtimeAddProcessor(), RealtimeProcess(), RealtimeProcessStart(), RealtimeResume(), and RealtimeSuspend().
const bool VSTEffectInstance::mUseLatency |
Definition at line 545 of file VSTEffect.h.
Referenced by RealtimeAddProcessor(), and SetBufferDelay().
|
private |
Definition at line 579 of file VSTEffect.h.
Referenced by RealtimeAddProcessor(), SetBlockSize(), and VSTEffectInstance().