MCPcopy Create free account
hub / github.com/audacity/audacity / FlushParameters

Method FlushParameters

libraries/lib-vst3/VST3Wrapper.cpp:825–858  ·  view source on GitHub ↗

Used as a workaround for issue #2555: some plugins do not accept changes via IEditController::setParamNormalized, but seem to read current parameter values directly from the DSP model. When processing is disabled this call helps synchronize internal state of the IEditController, so that next time UI is opened it displays correct values. As a side effect subsequent call to IAudioProcessor::proces

Source from the content-addressed store, hash-verified

823//As a side effect subsequent call to IAudioProcessor::process may flush
824//plugin internal buffers
825void VST3Wrapper::FlushParameters(EffectSettings& settings, bool* hasChanges)
826{
827 if(!mActive)
828 {
829 auto componentHandler = static_cast<ComponentHandler*>(mComponentHandler.get());
830 componentHandler->FlushCache(settings);
831
832 const auto doProcessing = !GetSettings(settings).parameterChanges.empty();
833
834 if(hasChanges != nullptr)
835 *hasChanges = doProcessing;
836
837 if(!doProcessing)
838 return;
839
840 SetupProcessing(*mEffectComponent, mSetup);
841 mActive = true;
842 if(mEffectComponent->setActive(true) == Steinberg::kResultOk)
843 {
844 ConsumeChanges(settings);
845 if(mAudioProcessor->setProcessing(true) != Steinberg::kResultFalse)
846 {
847 mProcessContext.sampleRate = mSetup.sampleRate;
848 mProcessContext.state = 0;
849 Process(nullptr, nullptr, 0);
850 mAudioProcessor->setProcessing(false);
851 }
852 }
853 mEffectComponent->setActive(false);
854 mActive = false;
855 }
856 else if(hasChanges != nullptr)
857 *hasChanges = false;
858}
859
860size_t VST3Wrapper::Process(const float* const* inBlock, float* const* outBlock, size_t blockLen)
861{

Callers 4

LoadFactoryPresetMethod · 0.80
OnIdleMethod · 0.80
ValidateUIMethod · 0.80
OnCloseMethod · 0.80

Calls 6

GetSettingsFunction · 0.85
SetupProcessingFunction · 0.85
ProcessFunction · 0.85
FlushCacheMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected