27 return std::make_unique<VSTMessage>( std::move(
settings.mChunk), std::move(paramVector) );
123 return GuardedCall<bool>([&] {
134 const float *
const *inBlock,
float *
const *outBlock,
size_t blockLen)
170 auto slave = std::make_unique<VSTInstance>(
179 mSlaves.emplace_back(move(slave));
185return GuardedCall<bool>([&]{
187 if (mpOwningValidator)
188 mpOwningValidator->Flush();
192 for (
const auto &slave : mSlaves)
193 slave->ProcessFinalize();
196 return ProcessFinalize();
204 for (
const auto &slave :
mSlaves)
214 for (
const auto &slave :
mSlaves)
241 const auto len = chunk.size();
242 const auto data = chunk.data();
246 slave->callSetChunk(
true, len, data, &info);
255 const bool IsAudioThread = (
mMainThreadId != std::this_thread::get_id());
269 if (applyChunkInMainThread)
277 auto &chunk = message.
mChunk;
281 if (applyChunkInMainThread)
299 const bool IsAudioThread = (
mMainThreadId != std::this_thread::get_id());
315 if (message.mParamsVec[paramID])
317 float val = (float)(*message.mParamsVec[paramID]);
325 slave->callSetParameter(paramID, val);
329 message.mParamsVec[paramID] = std::nullopt;
337 const float *
const *inbuf,
float *
const *outbuf,
size_t numSamples)
352 else if (group <=
mSlaves.size())
355 return mSlaves[group - 1]->ProcessBlock(
settings, inbuf, outbuf, numSamples);
363 if ( ChunkMustBeAppliedInMainThread() )
364 mDeferredChunkMutex.unlock();
433 float *
const *outputs,
int sampleframes)
436 const_cast<float**
>(inputs),
437 const_cast<float**
>(outputs), sampleframes);
456 size_t userBlockSize,
462 , mUseLatency{ useLatency }
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
for(int ii=0, nn=names.size();ii< nn;++ii)
static Settings & settings()
const int effMainsChanged
const int effStartProcess
const int effSetBlockSize
const int kVstTransportPlaying
const int effSetSampleRate
void(* processReplacing)(AEffect *, float **, float **, int)
Hold values to send to effect output meters.
const PerTrackEffect & mProcessor
Base class for many of the effects in Audacity.
size_t GetBlockSize() const override
void SizeWindow(int w, int h) override
bool ProcessInitialize(EffectSettings &settings, double sampleRate, ChannelNames chanMap) override
void ApplyChunk(std::vector< char > &chunk)
bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override
bool RealtimeSuspend() override
bool UsesMessages() const noexcept override
bool RealtimeProcessStart(MessagePackage &package) override
settings are possibly changed, since last call, by an asynchronous dialog
std::mutex mDeferredChunkMutex
void DeferChunkApplication()
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
void Automate(int index, float value) override
bool DoProcessInitialize(double sampleRate)
bool RealtimeResume() override
VSTUIWrapper * mpOwningValidator
VSTInstance(const PerTrackEffect &effect, const PluginPath &path, size_t blockSize, size_t userBlockSize, bool useLatency)
bool RealtimeInitialize(EffectSettings &settings, double sampleRate) override
bool OnePresetWasLoadedWhilePlaying()
std::vector< char > mChunkToSetAtIdleTime
size_t ProcessBlock(EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
Called for destructive effect computation.
void SetBufferDelay(int samples) override
std::unique_ptr< Message > MakeMessage() const override
Called on the main thread, in which the result may be cloned.
bool RealtimeFinalize(EffectSettings &settings) noexcept override
size_t SetBlockSize(size_t maxBlockSize) override
bool RealtimeProcessEnd(EffectSettings &settings) noexcept override
settings can be updated to let a dialog change appearance at idle
size_t RealtimeProcess(size_t group, EffectSettings &settings, const float *const *inbuf, float *const *outbuf, size_t numSamples) override
void callProcessReplacing(const float *const *inputs, float *const *outputs, int sampleframes)
void SetOwningValidator(VSTUIWrapper *vi)
bool ChunkMustBeAppliedInMainThread() const
std::atomic_bool mPresetLoadedWhilePlaying
SampleCount GetLatency(const EffectSettings &settings, double sampleRate) const override
bool ProcessFinalize() noexcept override
constexpr auto sampleRate
constexpr auto maxBlockSize
Externalized state of a plug-in.
std::vector< std::optional< double > > ParamVector
std::vector< char > mChunk
virtual void SizeWindow(int w, int h)
virtual void Automate(int index, float value)
bool FetchSettings(VSTSettings &vst3Settings, bool doFetch=true) const
static VSTSettings & GetSettings(EffectSettings &settings)
bool StoreSettings(const VSTSettings &vst3settings) const
intptr_t callDispatcher(int opcode, int index, intptr_t value, void *ptr, float opt) override
void callSetParameter(int index, float value) const
std::thread::id mMainThreadId
void callSetChunk(bool isPgm, int len, void *buf)