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

Method FetchSettings

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

Source from the content-addressed store, hash-verified

591}
592
593void VST3Wrapper::FetchSettings(EffectSettings& settings)
594{
595 //TODO: perform version check
596 {
597 auto componentHandler = static_cast<ComponentHandler*>(mComponentHandler.get());
598 componentHandler->ResetCache();
599 componentHandler->BeginStateChange(settings);
600 auto cleanup = finally([&] { componentHandler->EndStateChange(); });
601
602 //Restore state
603 const auto* vst3settings = &GetSettings(settings);
604 if(!vst3settings->processorState.has_value())
605 vst3settings = &GetSettings(GetCache(mEffectClassInfo.ID())->defaultSettings);
606
607 if(vst3settings->processorState.has_value())
608 {
609 auto processorState = PresetsBufferStream::fromString(*vst3settings->processorState);
610 processorState->seek(0, Steinberg::IBStream::kIBSeekSet);
611 if(mEffectComponent->setState(processorState) == Steinberg::kResultOk)
612 {
613 processorState->seek(0, Steinberg::IBStream::kIBSeekSet);
614 if(mEditController->setComponentState(processorState) == Steinberg::kResultOk)
615 {
616 if(vst3settings->controllerState.has_value())
617 {
618 auto controllerState = PresetsBufferStream::fromString(*vst3settings->controllerState);
619 controllerState->seek(0, Steinberg::IBStream::kIBSeekSet);
620 mEditController->setState(controllerState);
621 }
622 }
623 }
624 }
625 }
626 //restore parameters if present
627 auto& vst3setting = GetSettings(settings);
628 for(auto& p : vst3setting.parameterChanges)
629 mEditController->setParamNormalized(p.first, p.second);
630}
631
632void VST3Wrapper::StoreSettings(EffectSettings& settings) const
633{

Callers

nothing calls this directly

Calls 11

finallyFunction · 0.85
GetSettingsFunction · 0.85
GetCacheFunction · 0.85
ResetCacheMethod · 0.80
BeginStateChangeMethod · 0.80
EndStateChangeMethod · 0.80
has_valueMethod · 0.80
setStateMethod · 0.80
getMethod · 0.45
IDMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected