Audacity 3.2.0
|
#include <VSTInstance.h>
Public Member Functions | |
VSTInstance (const PerTrackEffect &effect, const PluginPath &path, size_t blockSize, size_t userBlockSize, bool useLatency) | |
~VSTInstance () 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 (VSTUIWrapper *vi) |
bool | OnePresetWasLoadedWhilePlaying () |
void | DeferChunkApplication () |
bool | HasGUI () const |
Public Member Functions inherited from PerTrackEffect::Instance | |
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 |
Public Member Functions inherited from EffectInstanceEx | |
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 | |
Public Member Functions inherited from EffectInstance | |
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 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... | |
Public Member Functions inherited from VSTWrapper | |
VSTWrapper (const PluginPath &path) | |
~VSTWrapper () | |
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 (VSTSettings &vst3Settings, bool doFetch=true) const |
bool | StoreSettings (const VSTSettings &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 | SetBufferDelay (int samples) |
std::unique_ptr< EffectInstance::Message > | MakeMessageFS (const VSTSettings &settings) const |
Public Member Functions inherited from VSTLink | |
virtual | ~VSTLink () |
virtual intptr_t | callDispatcher (int opcode, int index, intptr_t value, void *ptr, float opt)=0 |
Public Member Functions inherited from XMLTagHandler | |
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) |
Public Member Functions inherited from VSTUIWrapper | |
virtual void | Idle () |
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 } |
Public Attributes inherited from VSTWrapper | |
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 } |
VSTUIWrapper * | mpOwningValidator {} |
std::atomic_bool | mPresetLoadedWhilePlaying { false } |
std::mutex | mDeferredChunkMutex |
std::vector< char > | mChunkToSetAtIdleTime {} |
bool | mIsMeldaPlugin { false } |
Additional Inherited Members | |
Public Types inherited from EffectInstance | |
using | Message = EffectSettingsAccess::Message |
using | SampleCount = uint64_t |
Public Types inherited from VSTWrapper | |
using | ParameterVisitor = std::function< bool(const ParameterInfo &pi) > |
using | ModuleHandle = std::unique_ptr< wxDynamicLibrary > |
using | BundleHandle = CF_ptr< CFBundleRef > |
Static Public Member Functions inherited from VSTWrapper | |
static VSTSettings & | GetSettings (EffectSettings &settings) |
static const VSTSettings & | GetSettings (const EffectSettings &settings) |
static intptr_t | AudioMaster (AEffect *effect, int32_t opcode, int32_t index, intptr_t value, void *ptr, float opt) |
Protected Attributes inherited from PerTrackEffect::Instance | |
const PerTrackEffect & | mProcessor |
Definition at line 25 of file VSTInstance.h.
VSTInstance::VSTInstance | ( | const PerTrackEffect & | effect, |
const PluginPath & | path, | ||
size_t | blockSize, | ||
size_t | userBlockSize, | ||
bool | useLatency | ||
) |
Definition at line 451 of file VSTInstance.cpp.
References DoProcessInitialize(), VstTimeInfo::flags, IsReady(), kVstNanosValid, kVstTempoValid, VSTWrapper::Load(), mBlockSize, mIsMeldaPlugin, VSTWrapper::mTimeInfo, mUserBlockSize, VSTWrapper::mVendor, VstTimeInfo::nanoSeconds, VstTimeInfo::samplePos, VstTimeInfo::sampleRate, VstTimeInfo::tempo, VstTimeInfo::timeSigDenominator, and VstTimeInfo::timeSigNumerator.
|
override |
Definition at line 491 of file VSTInstance.cpp.
References PowerOff().
|
private |
Definition at line 236 of file VSTInstance.cpp.
References VSTWrapper::callSetChunk(), VSTWrapper::mAEffect, mSlaves, AEffect::numParams, AEffect::uniqueID, and AEffect::version.
Referenced by DeferChunkApplication(), and RealtimeProcessStart().
|
overridevirtual |
Reimplemented from VSTUIWrapper.
Definition at line 440 of file VSTInstance.cpp.
References VSTUIWrapper::Automate(), VSTWrapper::mMainThreadId, and mpOwningValidator.
|
private |
Definition at line 432 of file VSTInstance.cpp.
References VSTWrapper::mAEffect, and AEffect::processReplacing.
Referenced by ProcessBlock().
|
private |
Definition at line 249 of file VSTInstance.cpp.
References mIsMeldaPlugin, and VSTWrapper::mMainThreadId.
Referenced by RealtimeProcessStart().
void VSTInstance::DeferChunkApplication | ( | ) |
Definition at line 225 of file VSTInstance.cpp.
References ApplyChunk(), mChunkToSetAtIdleTime, and mDeferredChunkMutex.
Referenced by VSTEditor::OnIdle().
bool VSTInstance::DoProcessInitialize | ( | double | sampleRate | ) |
Definition at line 96 of file VSTInstance.cpp.
References VSTWrapper::callDispatcher(), effSetBlockSize, effSetSampleRate, VstTimeInfo::flags, AEffect::initialDelay, kVstNanosValid, kVstTempoValid, kVstTransportPlaying, VSTWrapper::mAEffect, mBlockSize, mReady, VSTWrapper::mTimeInfo, VstTimeInfo::nanoSeconds, PowerOn(), anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, VstTimeInfo::sampleRate, SetBufferDelay(), VstTimeInfo::tempo, VstTimeInfo::timeSigDenominator, and VstTimeInfo::timeSigNumerator.
Referenced by ProcessInitialize(), and VSTInstance().
|
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 37 of file VSTInstance.cpp.
References VSTWrapper::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 42 of file VSTInstance.cpp.
References VSTWrapper::mAudioOuts.
Referenced by SetBlockSize().
|
overridevirtual |
|
overridevirtual |
Default implementation returns 0
Reimplemented from EffectInstance.
Definition at line 69 of file VSTInstance.cpp.
|
inline |
bool VSTInstance::IsReady | ( | ) |
Definition at line 77 of file VSTInstance.cpp.
References mReady.
Referenced by VSTInstance().
|
overridevirtual |
Called on the main thread, in which the result may be cloned.
Default implementation returns a null
Reimplemented from EffectInstance.
Definition at line 17 of file VSTInstance.cpp.
References VSTWrapper::FetchSettings(), VSTWrapper::mAEffect, AEffect::numParams, and settings().
Referenced by VSTEditor::ValidateUI().
std::unique_ptr< EffectInstance::Message > VSTInstance::MakeMessage | ( | int | id, |
double | value | ||
) | const |
Definition at line 31 of file VSTInstance.cpp.
References VSTWrapper::mAEffect, and AEffect::numParams.
|
overridevirtual |
Reimplemented from VSTUIWrapper.
Definition at line 369 of file VSTInstance.cpp.
References mpOwningValidator, and VSTUIWrapper::NeedIdle().
bool VSTInstance::OnePresetWasLoadedWhilePlaying | ( | ) |
Definition at line 220 of file VSTInstance.cpp.
References mPresetLoadedWhilePlaying.
void VSTInstance::PowerOff | ( | ) |
Definition at line 395 of file VSTInstance.cpp.
References VSTWrapper::callDispatcher(), effMainsChanged, effStopProcess, mHasPower, and VSTWrapper::mVstVersion.
Referenced by ProcessFinalize(), RealtimeSuspend(), and ~VSTInstance().
void VSTInstance::PowerOn | ( | ) |
Definition at line 377 of file VSTInstance.cpp.
References VSTWrapper::callDispatcher(), effMainsChanged, effStartProcess, mHasPower, and VSTWrapper::mVstVersion.
Referenced by VSTEditor::BuildFancy(), DoProcessInitialize(), and RealtimeResume().
|
overridevirtual |
Called for destructive effect computation.
Implements EffectInstance.
Definition at line 133 of file VSTInstance.cpp.
References callProcessReplacing(), VSTWrapper::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:
Reimplemented from PerTrackEffect::Instance.
Definition at line 121 of file VSTInstance.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 Reimplemented from PerTrackEffect::Instance.
Definition at line 82 of file VSTInstance.cpp.
References DoProcessInitialize(), VSTWrapper::GetSettings(), anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, settings(), and VSTWrapper::StoreSettings().
Referenced by RealtimeInitialize().
|
overridevirtual |
Reimplemented from EffectInstance.
Definition at line 159 of file VSTInstance.cpp.
References mBlockSize, VSTWrapper::mPath, PerTrackEffect::Instance::mProcessor, mRecruited, mSlaves, mUseLatency, mUserBlockSize, anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, and settings().
|
overridevirtualnoexcept |
Reimplemented from EffectInstance.
Definition at line 183 of file VSTInstance.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 149 of file VSTInstance.cpp.
References mpOwningValidator, ProcessInitialize(), anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, settings(), and valueRestorer().
|
overridevirtual |
Reimplemented from EffectInstance.
Definition at line 336 of file VSTInstance.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 361 of file VSTInstance.cpp.
|
overridevirtual |
settings are possibly changed, since last call, by an asynchronous dialog
Reimplemented from EffectInstance.
Definition at line 265 of file VSTInstance.cpp.
References ApplyChunk(), VSTWrapper::callSetParameter(), ChunkMustBeAppliedInMainThread(), VSTWrapper::mAEffect, VSTMessage::mChunk, mChunkToSetAtIdleTime, mDeferredChunkMutex, VSTWrapper::mMainThreadId, mPresetLoadedWhilePlaying, mSlaves, AEffect::numParams, and EffectInstance::MessagePackage::pMessage.
|
overridevirtual |
Reimplemented from EffectInstance.
Definition at line 210 of file VSTInstance.cpp.
References mSlaves, and PowerOn().
|
overridevirtual |
Reimplemented from EffectInstance.
Definition at line 200 of file VSTInstance.cpp.
References mSlaves, and PowerOff().
|
overridevirtual |
Implements EffectInstance.
Definition at line 47 of file VSTInstance.cpp.
References GetAudioInCount(), GetAudioOutCount(), anonymous_namespace{StaffPadTimeAndPitch.cpp}::maxBlockSize, mBlockSize, min(), and mUserBlockSize.
|
overridevirtual |
Reimplemented from VSTWrapper.
Definition at line 421 of file VSTInstance.cpp.
References VSTWrapper::mBufferDelay, and mUseLatency.
Referenced by DoProcessInitialize().
void VSTInstance::SetOwningValidator | ( | VSTUIWrapper * | vi | ) |
Definition at line 496 of file VSTInstance.cpp.
References mpOwningValidator.
Referenced by VSTEditor::OnClose(), and VSTEditor::~VSTEditor().
|
overridevirtual |
Reimplemented from VSTUIWrapper.
Definition at line 413 of file VSTInstance.cpp.
References mpOwningValidator, and VSTUIWrapper::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 260 of file VSTInstance.cpp.
size_t VSTInstance::mBlockSize { 8192 } |
Definition at line 84 of file VSTInstance.h.
Referenced by DoProcessInitialize(), GetBlockSize(), RealtimeAddProcessor(), RealtimeProcess(), SetBlockSize(), and VSTInstance().
|
private |
Definition at line 127 of file VSTInstance.h.
Referenced by DeferChunkApplication(), and RealtimeProcessStart().
|
private |
Definition at line 126 of file VSTInstance.h.
Referenced by DeferChunkApplication(), and RealtimeProcessStart().
|
private |
Definition at line 114 of file VSTInstance.h.
Referenced by PowerOff(), and PowerOn().
|
private |
Definition at line 133 of file VSTInstance.h.
Referenced by ChunkMustBeAppliedInMainThread(), and VSTInstance().
|
private |
Definition at line 122 of file VSTInstance.h.
Referenced by Automate(), NeedIdle(), RealtimeInitialize(), SetOwningValidator(), and SizeWindow().
|
private |
Definition at line 124 of file VSTInstance.h.
Referenced by OnePresetWasLoadedWhilePlaying(), and RealtimeProcessStart().
|
private |
Definition at line 118 of file VSTInstance.h.
Referenced by DoProcessInitialize(), IsReady(), and ProcessFinalize().
|
private |
Definition at line 120 of file VSTInstance.h.
Referenced by RealtimeAddProcessor(), and RealtimeProcess().
|
private |
Definition at line 112 of file VSTInstance.h.
Referenced by ApplyChunk(), RealtimeAddProcessor(), RealtimeProcess(), RealtimeProcessStart(), RealtimeResume(), and RealtimeSuspend().
const bool VSTInstance::mUseLatency |
Definition at line 82 of file VSTInstance.h.
Referenced by RealtimeAddProcessor(), and SetBufferDelay().
|
private |
Definition at line 116 of file VSTInstance.h.
Referenced by RealtimeAddProcessor(), SetBlockSize(), and VSTInstance().