1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-26 02:14:22 +00:00

VST3: Added explicit check for current program value in setComponentState() so it is recalled correctly when loading

This commit is contained in:
ed 2021-01-25 09:13:15 +00:00
parent 99112cf71f
commit cc9fdc3d6a

View file

@ -705,9 +705,22 @@ public:
//==============================================================================
tresult PLUGIN_API setComponentState (IBStream* stream) override
{
// Cubase and Nuendo need to inform the host of the current parameter values
for (auto vstParamId : audioProcessor->vstParamIDs)
setParamNormalized (vstParamId, audioProcessor->getParamForVSTParamID (vstParamId)->getValue());
if (auto* pluginInstance = getPluginInstance())
{
for (auto vstParamId : audioProcessor->vstParamIDs)
{
auto paramValue = [&]
{
if (vstParamId == JuceAudioProcessor::paramPreset)
return EditController::plainParamToNormalized (JuceAudioProcessor::paramPreset,
pluginInstance->getCurrentProgram());
return (double) audioProcessor->getParamForVSTParamID (vstParamId)->getValue();
}();
setParamNormalized (vstParamId, paramValue);
}
}
if (auto* handler = getComponentHandler())
handler->restartComponent (Vst::kParamValuesChanged);