Browse Source

VST3 Host: Avoid updating bus layout and activation of activated plug-ins

According to the VST3 spec, activateBus and setBusArrangements shall not
be called when a plugin is in the 'activated' state.

Previously, if prepareToPlay was called twice in a row on a hosted VST3
plugin, during the second call the plug-in would already be activated,
but its bus layout would still be adjusted. Now, we always ensure that
the plugin is inactive before the bus properties are adjusted.
v7.0.9
reuk 3 years ago
parent
commit
6feeb7dcdd
No known key found for this signature in database GPG Key ID: FCB43929F012EE5C
1 changed files with 22 additions and 13 deletions
  1. +22
    -13
      modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp

+ 22
- 13
modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -2511,6 +2511,11 @@ public:
using namespace Vst;
// If the plugin has already been activated (prepareToPlay has been called twice without
// a matching releaseResources call) deactivate it so that the speaker layout and bus
// activation can be updated safely.
deactivate();
ProcessSetup setup;
setup.symbolicSampleSize = isUsingDoublePrecision() ? kSample64 : kSample32;
setup.maxSamplesPerBlock = estimatedSamplesPerBlock;
@@ -2565,19 +2570,7 @@ public:
void releaseResources() override
{
const SpinLock::ScopedLockType lock (processMutex);
if (! isActive)
return; // Avoids redundantly calling things like setActive
isActive = false;
if (processor != nullptr)
warnOnFailureIfImplemented (processor->setProcessing (false));
if (holder->component != nullptr)
warnOnFailure (holder->component->setActive (false));
setStateForAllMidiBuses (false);
deactivate();
}
bool supportsDoublePrecisionProcessing() const override
@@ -3104,6 +3097,22 @@ public:
}
private:
void deactivate()
{
if (! isActive)
return;
isActive = false;
if (processor != nullptr)
warnOnFailureIfImplemented (processor->setProcessing (false));
if (holder->component != nullptr)
warnOnFailure (holder->component->setActive (false));
setStateForAllMidiBuses (false);
}
//==============================================================================
#if JUCE_LINUX || JUCE_BSD
SharedResourcePointer<RunLoop> runLoop;


Loading…
Cancel
Save