1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

AU Client: Report correct AUChannelInfo for MIDI FX plugins

Previously, MIDI FX would report an input and output channel count of 0.
However, a non-empty output bus is required in order to retrieve the
processing sample rate.

With this change in place, MIDI FX plugins will now report an output
channel count of -1, which indicates that any number of output channels
is valid.
This commit is contained in:
reuk 2024-05-29 13:27:29 +01:00
parent 203934d949
commit a66fd53630

View file

@ -366,21 +366,18 @@ struct AudioUnitHelpers
static Array<AUChannelInfo> getAUChannelInfo (const AudioProcessor& processor) static Array<AUChannelInfo> getAUChannelInfo (const AudioProcessor& processor)
{ {
#if JucePlugin_IsMidiEffect
// A MIDI effect requires an output bus in order to determine the sample rate.
// No audio will be written to the output bus, so it can have any number of channels.
// No input bus is required.
return { AUChannelInfo { 0, -1 } };
#endif
Array<AUChannelInfo> channelInfo; Array<AUChannelInfo> channelInfo;
auto hasMainInputBus = (AudioUnitHelpers::getBusCountForWrapper (processor, true) > 0); auto hasMainInputBus = (AudioUnitHelpers::getBusCountForWrapper (processor, true) > 0);
auto hasMainOutputBus = (AudioUnitHelpers::getBusCountForWrapper (processor, false) > 0); auto hasMainOutputBus = (AudioUnitHelpers::getBusCountForWrapper (processor, false) > 0);
if ((! hasMainInputBus) && (! hasMainOutputBus))
{
// midi effect plug-in: no audio
AUChannelInfo info;
info.inChannels = 0;
info.outChannels = 0;
return { &info, 1 };
}
auto layout = processor.getBusesLayout(); auto layout = processor.getBusesLayout();
// The 'standard' layout with the most channels defined is AudioChannelSet::create9point1point6(). // The 'standard' layout with the most channels defined is AudioChannelSet::create9point1point6().