Skip to content

Commit

Permalink
VST3 Wrapper: Avoid calling processBlock when there is no audio input…
Browse files Browse the repository at this point in the history
…/output
  • Loading branch information
reuk committed Jan 17, 2022
1 parent df20637 commit bd52350
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3155,9 +3155,27 @@ class JuceVST3Component : public Vst::IComponent,
return kResultFalse;
}

if (processSetup.symbolicSampleSize == Vst::kSample32) processAudio<float> (data, channelListFloat);
else if (processSetup.symbolicSampleSize == Vst::kSample64) processAudio<double> (data, channelListDouble);
else jassertfalse;
// If all of these are zero, the host is attempting to flush parameters without processing audio.
if (data.numSamples != 0 || data.numInputs != 0 || data.numOutputs != 0)
{
if (processSetup.symbolicSampleSize == Vst::kSample32) processAudio<float> (data, channelListFloat);
else if (processSetup.symbolicSampleSize == Vst::kSample64) processAudio<double> (data, channelListDouble);
else jassertfalse;
}

if (auto* changes = data.outputParameterChanges)
{
comPluginInstance->forAllChangedParameters ([&] (Vst::ParamID paramID, float value)
{
Steinberg::int32 queueIndex = 0;

if (auto* queue = changes->addParameterData (paramID, queueIndex))
{
Steinberg::int32 pointIndex = 0;
queue->addPoint (0, value, pointIndex);
}
});
}

#if JucePlugin_ProducesMidiOutput
if (isMidiOutputBusEnabled && data.outputEvents != nullptr)
Expand Down Expand Up @@ -3381,20 +3399,6 @@ class JuceVST3Component : public Vst::IComponent,
jassert (midiBuffer.getNumEvents() <= numMidiEventsComingIn);
#endif
}

if (auto* changes = data.outputParameterChanges)
{
comPluginInstance->forAllChangedParameters ([&] (Vst::ParamID paramID, float value)
{
Steinberg::int32 queueIndex = 0;

if (auto* queue = changes->addParameterData (paramID, queueIndex))
{
Steinberg::int32 pointIndex = 0;
queue->addPoint (0, value, pointIndex);
}
});
}
}

//==============================================================================
Expand Down

0 comments on commit bd52350

Please sign in to comment.