mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-20 01:14:20 +00:00
Fixed a bug where the VST3 plug-in wrapper would not respect the legacy layout field when disabling/enabling buses
This commit is contained in:
parent
1c2d1479b4
commit
63a71ff20d
2 changed files with 50 additions and 1 deletions
|
|
@ -1538,11 +1538,32 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
int getNumAudioBuses (bool isInput) const
|
||||
{
|
||||
int busCount = pluginInstance->getBusCount (isInput);
|
||||
|
||||
#ifdef JucePlugin_PreferredChannelConfigurations
|
||||
short configs[][2] = {JucePlugin_PreferredChannelConfigurations};
|
||||
const int numConfigs = sizeof (configs) / sizeof (short[2]);
|
||||
|
||||
bool hasOnlyZeroChannels = true;
|
||||
|
||||
for (int i = 0; i < numConfigs && hasOnlyZeroChannels == true; ++i)
|
||||
if (configs[i][isInput ? 0 : 1] != 0)
|
||||
hasOnlyZeroChannels = false;
|
||||
|
||||
busCount = jmin (busCount, hasOnlyZeroChannels ? 0 : 1);
|
||||
#endif
|
||||
|
||||
return busCount;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Steinberg::int32 PLUGIN_API getBusCount (Vst::MediaType type, Vst::BusDirection dir) override
|
||||
{
|
||||
if (type == Vst::kAudio)
|
||||
return pluginInstance->getBusCount (dir == Vst::kInput);
|
||||
return getNumAudioBuses (dir == Vst::kInput);
|
||||
|
||||
if (type == Vst::kEvent)
|
||||
{
|
||||
|
|
@ -1561,6 +1582,9 @@ public:
|
|||
{
|
||||
if (type == Vst::kAudio)
|
||||
{
|
||||
if (index < 0 || index >= getNumAudioBuses (dir == Vst::kInput))
|
||||
return kResultFalse;
|
||||
|
||||
if (const AudioProcessor::Bus* bus = pluginInstance->getBus (dir == Vst::kInput, index))
|
||||
{
|
||||
info.mediaType = Vst::kAudio;
|
||||
|
|
@ -1628,8 +1652,30 @@ public:
|
|||
}
|
||||
|
||||
if (type == Vst::kAudio)
|
||||
{
|
||||
if (index < 0 || index >= getNumAudioBuses (dir == Vst::kInput))
|
||||
return kResultFalse;
|
||||
|
||||
if (AudioProcessor::Bus* bus = pluginInstance->getBus (dir == Vst::kInput, index))
|
||||
{
|
||||
#ifdef JucePlugin_PreferredChannelConfigurations
|
||||
AudioProcessor::BusesLayout newLayout = pluginInstance->getBusesLayout();
|
||||
AudioChannelSet targetLayout
|
||||
= (state != 0 ? bus->getLastEnabledLayout() : AudioChannelSet::disabled());
|
||||
|
||||
(dir == Vst::kInput ? newLayout.inputBuses : newLayout.outputBuses).getReference (index) = targetLayout;
|
||||
|
||||
short configs[][2] = {JucePlugin_PreferredChannelConfigurations};
|
||||
AudioProcessor::BusesLayout compLayout
|
||||
= pluginInstance->getNextBestLayoutInLayoutList (newLayout, configs);
|
||||
|
||||
if ((dir == Vst::kInput ? compLayout.inputBuses : compLayout.outputBuses).getReference (index) != targetLayout)
|
||||
return kResultFalse;
|
||||
#endif
|
||||
|
||||
return (bus->enable (state != 0) ? kResultTrue : kResultFalse);
|
||||
}
|
||||
}
|
||||
|
||||
return kResultFalse;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -769,7 +769,10 @@ AudioProcessor::BusesLayout AudioProcessor::getNextBestLayoutInList (const Buses
|
|||
hasInputs = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < numChannelConfigs; ++i)
|
||||
{
|
||||
if (legacyLayouts[i].outChannels > 0)
|
||||
{
|
||||
hasOutputs = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue