Summary
Some VST3 plug-ins can fail to load while JUCE is initialising the hosted parameter list because
VST3PluginInstanceHeadless::initialiseParameterList() re-queries
IEditController::getParameterCount() on every loop iteration.
We hit this while loading Neural DSP's Archetype Gojira X.vst3 on Windows. The plug-in scanned
successfully, but instantiation failed during JUCE's VST3 parameter initialisation path. A local
change that snapshots the parameter count once before the loop resolves the load failure.
Affected code
In modules/juce_audio_processors_headless/format_types/juce_VST3PluginFormatImpl.h,
initialiseParameterList() currently does:
for (int i = 0; i < editController->getParameterCount(); ++i)
Inside that loop, JUCE constructs a VST3Parameter, which fetches/caches parameter info via
getParameterInfo(). For the affected plug-in, repeatedly querying getParameterCount() while
enumerating parameters appears to produce an unstable enumeration boundary.
The nearby helper getAllParamIDs() already uses the safer pattern of reading
getParameterCount() once before iterating.
Expected behaviour
JUCE should enumerate the parameter list using a stable count for the current initialisation pass.
Actual behaviour
JUCE re-queries the VST3 edit controller's parameter count in the loop condition while parameter
wrappers are being constructed, and the affected plug-in fails to load.
Proposed fix
Related pull request: #1660
Snapshot the parameter count before the loop:
const auto parameterCount = editController->getParameterCount();
for (int i = 0; i < parameterCount; ++i)
Environment
- JUCE branch tested:
develop
- Platform: Windows
- Plug-in format: VST3
- Affected plug-in observed: Neural DSP
Archetype Gojira X.vst3
Summary
Some VST3 plug-ins can fail to load while JUCE is initialising the hosted parameter list because
VST3PluginInstanceHeadless::initialiseParameterList()re-queriesIEditController::getParameterCount()on every loop iteration.We hit this while loading Neural DSP's
Archetype Gojira X.vst3on Windows. The plug-in scannedsuccessfully, but instantiation failed during JUCE's VST3 parameter initialisation path. A local
change that snapshots the parameter count once before the loop resolves the load failure.
Affected code
In
modules/juce_audio_processors_headless/format_types/juce_VST3PluginFormatImpl.h,initialiseParameterList()currently does:Inside that loop, JUCE constructs a
VST3Parameter, which fetches/caches parameter info viagetParameterInfo(). For the affected plug-in, repeatedly queryinggetParameterCount()whileenumerating parameters appears to produce an unstable enumeration boundary.
The nearby helper
getAllParamIDs()already uses the safer pattern of readinggetParameterCount()once before iterating.Expected behaviour
JUCE should enumerate the parameter list using a stable count for the current initialisation pass.
Actual behaviour
JUCE re-queries the VST3 edit controller's parameter count in the loop condition while parameter
wrappers are being constructed, and the affected plug-in fails to load.
Proposed fix
Related pull request: #1660
Snapshot the parameter count before the loop:
Environment
developArchetype Gojira X.vst3