mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
VST3 Client: Avoid assertion failure in setBusesLayout when using PreferredChannelConfigurations
Using a preferred channel config with no input or output channels could cause an assertion here because the AudioProcessor will always have a single input/output bus by default.
This commit is contained in:
parent
c5b8b7eae0
commit
0836cf33b1
1 changed files with 11 additions and 5 deletions
|
|
@ -3186,10 +3186,10 @@ public:
|
||||||
|
|
||||||
if (type == Vst::kAudio)
|
if (type == Vst::kAudio)
|
||||||
{
|
{
|
||||||
const auto numInputBuses = getNumAudioBuses (true);
|
const auto numPublicInputBuses = getNumAudioBuses (true);
|
||||||
const auto numOutputBuses = getNumAudioBuses (false);
|
const auto numPublicOutputBuses = getNumAudioBuses (false);
|
||||||
|
|
||||||
if (! isPositiveAndBelow (index, dir == Vst::kInput ? numInputBuses : numOutputBuses))
|
if (! isPositiveAndBelow (index, dir == Vst::kInput ? numPublicInputBuses : numPublicOutputBuses))
|
||||||
return kResultFalse;
|
return kResultFalse;
|
||||||
|
|
||||||
// The host is allowed to enable/disable buses as it sees fit, so the plugin needs to be
|
// The host is allowed to enable/disable buses as it sees fit, so the plugin needs to be
|
||||||
|
|
@ -3212,12 +3212,18 @@ public:
|
||||||
|
|
||||||
AudioProcessor::BusesLayout desiredLayout;
|
AudioProcessor::BusesLayout desiredLayout;
|
||||||
|
|
||||||
for (auto i = 0; i < numInputBuses; ++i)
|
for (auto i = 0; i < numPublicInputBuses; ++i)
|
||||||
desiredLayout.inputBuses.add (bufferMapper.getRequestedLayoutForInputBus ((size_t) i));
|
desiredLayout.inputBuses.add (bufferMapper.getRequestedLayoutForInputBus ((size_t) i));
|
||||||
|
|
||||||
for (auto i = 0; i < numOutputBuses; ++i)
|
while (desiredLayout.inputBuses.size() < pluginInstance->getBusCount (true))
|
||||||
|
desiredLayout.inputBuses.add (AudioChannelSet::disabled());
|
||||||
|
|
||||||
|
for (auto i = 0; i < numPublicOutputBuses; ++i)
|
||||||
desiredLayout.outputBuses.add (bufferMapper.getRequestedLayoutForOutputBus ((size_t) i));
|
desiredLayout.outputBuses.add (bufferMapper.getRequestedLayoutForOutputBus ((size_t) i));
|
||||||
|
|
||||||
|
while (desiredLayout.outputBuses.size() < pluginInstance->getBusCount (false))
|
||||||
|
desiredLayout.outputBuses.add (AudioChannelSet::disabled());
|
||||||
|
|
||||||
const auto prev = pluginInstance->getBusesLayout();
|
const auto prev = pluginInstance->getBusesLayout();
|
||||||
|
|
||||||
const auto busesLayoutSupported = [&]
|
const auto busesLayoutSupported = [&]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue