mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
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.
This commit is contained in:
parent
6c3b410e6f
commit
6feeb7dcdd
1 changed files with 22 additions and 13 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue