1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

MultiOutSynthPlugin: Avoid assertions in VST3PluginTestHost

This commit is contained in:
reuk 2022-05-20 19:14:16 +01:00
parent 5d5610286f
commit 560e75da27
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -123,6 +123,10 @@ public:
auto midiChannelBuffer = filterMidiMessagesForChannel (midiBuffer, busNr + 1);
auto audioBusBuffer = getBusBuffer (buffer, false, busNr);
// Voices add to the contents of the buffer. Make sure the buffer is clear before
// rendering, just in case the host left old data in the buffer.
audioBusBuffer.clear();
synth [busNr]->renderNextBlock (audioBusBuffer, midiChannelBuffer, 0, audioBusBuffer.getNumSamples());
}
}
@ -146,11 +150,15 @@ public:
bool isBusesLayoutSupported (const BusesLayout& layout) const override
{
for (const auto& bus : layout.outputBuses)
if (bus != AudioChannelSet::stereo())
return false;
const auto& outputs = layout.outputBuses;
return layout.inputBuses.isEmpty() && 1 <= layout.outputBuses.size();
return layout.inputBuses.isEmpty()
&& 1 <= outputs.size()
&& outputs.getFirst() != AudioChannelSet::disabled()
&& std::all_of (outputs.begin(), outputs.end(), [] (const auto& bus)
{
return bus == AudioChannelSet::stereo() || bus == AudioChannelSet::disabled();
});
}
//==============================================================================