mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
AudioProcessorPlayer: Allow client AudioProcessor to keep a supported layout
Previously, the AudioProcessorPlayer would attempt to find a supported layout that matched the audio device's output channel count, and would force the processor to use the audio device's i/o channel counts if no better and compatible alternative could be found. This change allows the AudioProcessor to retain its current i/o configuration if no better alternative can be found. This may lead to the AudioProcessor having different numbers of inputs and outputs to the audio device. If there's only one audio device input, this will be copied to all of the AudioProcessor's inputs. Otherwise, each audio device input channel will be copied to the corresponding AudioProcessor input channel. If there are more device inputs than AudioProcessor inputs, then some device inputs will be discarded. AudioProcessor inputs without a corresponding device input will be cleared/silenced. Similar rules apply to the output channels. If there are more device outputs than AudioProcessor outputs, then device outputs without a corresponding AudioProcessor output will be cleared. If there are more AudioProcessor outputs than device outputs, some AudioProcessor outputs will be discarded.
This commit is contained in:
parent
869a20ca30
commit
f521a6cac1
1 changed files with 4 additions and 5 deletions
|
|
@ -133,7 +133,10 @@ AudioProcessorPlayer::NumChannels AudioProcessorPlayer::findMostSuitableLayout (
|
|||
return proc.checkBusesLayoutSupported (chans.toLayout());
|
||||
});
|
||||
|
||||
return it != std::end (layouts) ? *it : layouts[0];
|
||||
if (it == layouts.end())
|
||||
return defaultProcessorChannels;
|
||||
|
||||
return *it;
|
||||
}
|
||||
|
||||
void AudioProcessorPlayer::resizeChannels()
|
||||
|
|
@ -252,10 +255,6 @@ void AudioProcessorPlayer::audioDeviceIOCallbackWithContext (const float* const*
|
|||
|
||||
if (processor != nullptr)
|
||||
{
|
||||
// The processor should be prepared to deal with the same number of output channels
|
||||
// as our output device.
|
||||
jassert (processor->isMidiEffect() || numOutputChannels == actualProcessorChannels.outs);
|
||||
|
||||
const ScopedLock sl2 (processor->getCallbackLock());
|
||||
|
||||
if (std::exchange (currentWorkgroup, currentDevice->getWorkgroup()) != currentDevice->getWorkgroup())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue