| @@ -2338,6 +2338,8 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| tresult PLUGIN_API setActive (TBool state) override | tresult PLUGIN_API setActive (TBool state) override | ||||
| { | { | ||||
| active = (state != 0); | |||||
| if (! state) | if (! state) | ||||
| { | { | ||||
| getPluginInstance().releaseResources(); | getPluginInstance().releaseResources(); | ||||
| @@ -2904,6 +2906,9 @@ public: | |||||
| tresult PLUGIN_API activateBus (Vst::MediaType type, Vst::BusDirection dir, Steinberg::int32 index, TBool state) override | tresult PLUGIN_API activateBus (Vst::MediaType type, Vst::BusDirection dir, Steinberg::int32 index, TBool state) override | ||||
| { | { | ||||
| // The host is misbehaving! The plugin must be deactivated before setting new arrangements. | |||||
| jassert (! active); | |||||
| if (type == Vst::kEvent) | if (type == Vst::kEvent) | ||||
| { | { | ||||
| #if JucePlugin_WantsMidiInput | #if JucePlugin_WantsMidiInput | ||||
| @@ -2979,6 +2984,13 @@ public: | |||||
| tresult PLUGIN_API setBusArrangements (Vst::SpeakerArrangement* inputs, Steinberg::int32 numIns, | tresult PLUGIN_API setBusArrangements (Vst::SpeakerArrangement* inputs, Steinberg::int32 numIns, | ||||
| Vst::SpeakerArrangement* outputs, Steinberg::int32 numOuts) override | Vst::SpeakerArrangement* outputs, Steinberg::int32 numOuts) override | ||||
| { | { | ||||
| if (active) | |||||
| { | |||||
| // The host is misbehaving! The plugin must be deactivated before setting new arrangements. | |||||
| jassertfalse; | |||||
| return kResultFalse; | |||||
| } | |||||
| auto numInputBuses = pluginInstance->getBusCount (true); | auto numInputBuses = pluginInstance->getBusCount (true); | ||||
| auto numOutputBuses = pluginInstance->getBusCount (false); | auto numOutputBuses = pluginInstance->getBusCount (false); | ||||
| @@ -3536,6 +3548,8 @@ private: | |||||
| AudioBuffer<float> emptyBufferFloat; | AudioBuffer<float> emptyBufferFloat; | ||||
| AudioBuffer<double> emptyBufferDouble; | AudioBuffer<double> emptyBufferDouble; | ||||
| bool active = false; | |||||
| #if JucePlugin_WantsMidiInput | #if JucePlugin_WantsMidiInput | ||||
| std::atomic<bool> isMidiInputBusEnabled { true }; | std::atomic<bool> isMidiInputBusEnabled { true }; | ||||
| #endif | #endif | ||||