Hi everyone, I wonder if someone has encountered this issue: I’m trying to build an Audio Unit plug-in which supports mono and stereo input, and from mono to 7.1 surround output. This is how I wrote it:
#ifndef JucePlugin_PreferredChannelConfigurations
bool Shuffling::isBusesLayoutSupported(const BusesLayout& layouts) const
{
#if JucePlugin_IsMidiEffect
ignoreUnused (layouts);
return true;
#else
if(layouts.getMainInputChannelSet()==AudioChannelSet::mono())
{
if (!layouts.getMainInputChannelSet().isDisabled())
{
if (!layouts.getMainOutputChannelSet().isDisabled())
{
if (layouts.getMainOutputChannelSet()==AudioChannelSet::mono())
return true;
else if (layouts.getMainOutputChannelSet()==AudioChannelSet::stereo())
return true;
else if (layouts.getMainOutputChannelSet()==AudioChannelSet::quadraphonic())
return true;
else if (layouts.getMainOutputChannelSet()==AudioChannelSet::create5point0())
return true;
else if(layouts.getMainOutputChannelSet()==AudioChannelSet::create5point1())
return true;
else if (layouts.getMainOutputChannelSet()==AudioChannelSet::create7point1())
return true;
else
return false;
}
else
return false;
}
else
return false;
}
if (layouts.getMainInputChannelSet()==AudioChannelSet::stereo())
{
if (!layouts.getMainInputChannelSet().isDisabled())
{
if (!layouts.getMainOutputChannelSet().isDisabled())
{
if (layouts.getMainOutputChannelSet()==AudioChannelSet::stereo())
return true;
else if (layouts.getMainOutputChannelSet()==AudioChannelSet::quadraphonic())
return true;
else if (layouts.getMainOutputChannelSet()==AudioChannelSet::create5point0())
return true;
else if(layouts.getMainOutputChannelSet()==AudioChannelSet::create5point1())
return true;
else if (layouts.getMainOutputChannelSet()==AudioChannelSet::create7point1())
return true;
else
return false;
}
else
return false;
}
else
return false;
}
return false;
#endif
}
#endif
However, the way the plug-in behaves depends on the constructor: if I start my plug-in with a stereo input like this:
Shuffling::Shuffling()
#ifndef JucePlugin_PreferredChannelConfigurations
: MyEffect(BusesProperties().withInput("Input", AudioChannelSet::stereo()).withOutput("Output", AudioChannelSet::stereo()))
#endif
the plug-in won’t support mono input with anything else than mono or stereo output, like shown in the auval analysis:
FORMAT TESTS:
Reported Channel Capabilities (explicit):
[1, 1] [1, 2] [2, 2] [2, 4] [2, 5] [2, 6] [2, 8]
Input/Output Channel Handling:
1-1 1-2 1-4 1-5 1-6 1-7 1-8 2-2 2-4 2-5 2-6 2-7 2-8 4-4 4-5 5-5 6-6 7-7 8-8
X X X X X X X
In: 1 , Out: 1
In: 1 , Out: 2
In: 1 , Out: 4
WARNING: Can Initialize Unit to un-supported num channels:InputChan:1, OutputChan:4
In: 1 , Out: 5
WARNING: Can Initialize Unit to un-supported num channels:InputChan:1, OutputChan:5
In: 1 , Out: 6
WARNING: Can Initialize Unit to un-supported num channels:InputChan:1, OutputChan:6
ca_require: ValidFormat(inScope, inElement, newDesc) InvalidFormat /Users/stagiaireprod/Desktop/Octave_Roulleau/GRm_vst_wrapper/Shuffling_test_AU/GRM_Tools_SRC/Common/au/CoreAudioUtilityClasses/AUBase.cpp:870
In: 1 , Out: 8
WARNING: Can Initialize Unit to un-supported num channels:InputChan:1, OutputChan:8
In: 2 , Out: 2
In: 2 , Out: 4
In: 2 , Out: 5
In: 2 , Out: 6
ca_require: ValidFormat(inScope, inElement, newDesc) InvalidFormat /Users/stagiaireprod/Desktop/Octave_Roulleau/GRm_vst_wrapper/Shuffling_test_AU/GRM_Tools_SRC/Common/au/CoreAudioUtilityClasses/AUBase.cpp:870
In: 2 , Out: 8
ca_require: ValidFormat(inScope, inElement, newDesc) InvalidFormat /Users/stagiaireprod/Desktop/Octave_Roulleau/GRm_vst_wrapper/Shuffling_test_AU/GRM_Tools_SRC/Common/au/CoreAudioUtilityClasses/AUBase.cpp:870
ca_require: ValidFormat(inScope, inElement, newDesc) InvalidFormat /Users/stagiaireprod/Desktop/Octave_Roulleau/GRm_vst_wrapper/Shuffling_test_AU/GRM_Tools_SRC/Common/au/CoreAudioUtilityClasses/AUBase.cpp:870
ca_require: ValidFormat(inScope, inElement, newDesc) InvalidFormat /Users/stagiaireprod/Desktop/Octave_Roulleau/GRm_vst_wrapper/Shuffling_test_AU/GRM_Tools_SRC/Common/au/CoreAudioUtilityClasses/AUBase.cpp:870
ca_require: ValidFormat(inScope, inElement, newDesc) InvalidFormat /Users/stagiaireprod/Desktop/Octave_Roulleau/GRm_vst_wrapper/Shuffling_test_AU/GRM_Tools_SRC/Common/au/CoreAudioUtilityClasses/AUBase.cpp:870
ca_require: ValidFormat(inScope, inElement, newDesc) InvalidFormat /Users/stagiaireprod/Desktop/Octave_Roulleau/GRm_vst_wrapper/Shuffling_test_AU/GRM_Tools_SRC/Common/au/CoreAudioUtilityClasses/AUBase.cpp:870
ca_require: ValidFormat(inScope, inElement, newDesc) InvalidFormat /Users/stagiaireprod/Desktop/Octave_Roulleau/GRm_vst_wrapper/Shuffling_test_AU/GRM_Tools_SRC/Common/au/CoreAudioUtilityClasses/AUBase.cpp:870
In: 2 , Out: 2
ca_require: IsStreamFormatWritable(inScope, inElement) NotWritable /Users/stagiaireprod/Desktop/Octave_Roulleau/GRm_vst_wrapper/Shuffling_test_AU/GRM_Tools_SRC/Common/au/CoreAudioUtilityClasses/AUBase.cpp:875
This will also be the case if I switch from stereo to mono input in the constructor: the plug-in won’t support stereo output with anything else than stereo output, while all the mono input configurations seem to work fine.
The problem doesn’t occur when I define the JucePlugin_PreferredChannelConfigurations macro instead.
I tried that with Juce version 4.3.1, 5.0.1 and 5.0.2 but nothing changes. Does anyone kwon how to work my way around that?