mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AU: Refactor getAUChannelInfo to reduce duplication
This commit is contained in:
parent
b5ea607dcc
commit
0fb62bd240
1 changed files with 18 additions and 20 deletions
|
|
@ -440,31 +440,29 @@ struct AudioUnitHelpers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto hasUnsupportedInput = ! hasMainInputBus, hasUnsupportedOutput = ! hasMainOutputBus;
|
const auto computeHasUnsupportedLayout = [&] (bool isInput)
|
||||||
|
|
||||||
for (auto inChanNum = hasMainInputBus ? 1 : 0; inChanNum <= (hasMainInputBus ? maxNumChanToCheckFor : 0); ++inChanNum)
|
|
||||||
{
|
{
|
||||||
Channels channelConfiguration { static_cast<SInt16> (inChanNum),
|
const auto hasMainBus = isInput ? hasMainInputBus : hasMainOutputBus;
|
||||||
static_cast<SInt16> (hasInOutMismatch ? defaultOutputs : inChanNum) };
|
const auto begin = hasMainBus ? 1 : 0;
|
||||||
|
const auto end = hasMainBus ? maxNumChanToCheckFor : 0;
|
||||||
|
|
||||||
if (! supportedChannels.contains (channelConfiguration))
|
for (auto chan = begin; chan <= end; ++chan)
|
||||||
{
|
{
|
||||||
hasUnsupportedInput = true;
|
const Channels channelConfig
|
||||||
break;
|
{
|
||||||
}
|
static_cast<SInt16> (! isInput && hasInOutMismatch ? defaultInputs : chan),
|
||||||
|
static_cast<SInt16> ( isInput && hasInOutMismatch ? defaultOutputs : chan)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (! supportedChannels.contains (channelConfig))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto outChanNum = hasMainOutputBus ? 1 : 0; outChanNum <= (hasMainOutputBus ? maxNumChanToCheckFor : 0); ++outChanNum)
|
return ! hasMainBus;
|
||||||
{
|
};
|
||||||
Channels channelConfiguration { static_cast<SInt16> (hasInOutMismatch ? defaultInputs : outChanNum),
|
|
||||||
static_cast<SInt16> (outChanNum) };
|
|
||||||
|
|
||||||
if (! supportedChannels.contains (channelConfiguration))
|
const auto hasUnsupportedInput = computeHasUnsupportedLayout (true);
|
||||||
{
|
const auto hasUnsupportedOutput = computeHasUnsupportedLayout (false);
|
||||||
hasUnsupportedOutput = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto& supported : supportedChannels)
|
for (const auto& supported : supportedChannels)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue