From a2bf8d49b64b1b63e8b850c8a3449cf0a06f033a Mon Sep 17 00:00:00 2001 From: tpoole Date: Thu, 9 Nov 2017 17:33:11 +0000 Subject: [PATCH] iOS: Fixed a bug in the audio channels of the simulator and older versions of iOS --- modules/juce_audio_devices/native/juce_ios_Audio.cpp | 7 ++++++- .../processors/juce_AudioProcessor.cpp | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/juce_audio_devices/native/juce_ios_Audio.cpp b/modules/juce_audio_devices/native/juce_ios_Audio.cpp index 798f63cc84..fa1243dbc2 100644 --- a/modules/juce_audio_devices/native/juce_ios_Audio.cpp +++ b/modules/juce_audio_devices/native/juce_ios_Audio.cpp @@ -1195,6 +1195,10 @@ struct iOSAudioIODevice::Pimpl : public AudioPlayHead, result.add (nsStringToJuce (desc.channelName)); } + // A fallback for the iOS simulator and older iOS versions + if (result.isEmpty()) + return { "Left", "Right" }; + return result; } @@ -1202,8 +1206,9 @@ struct iOSAudioIODevice::Pimpl : public AudioPlayHead, BigInteger requiredChannels) { requiredChannels.setRange (numHardwareChannelsAvailable, - requiredChannels.getHighestBit(), + requiredChannels.getHighestBit() + 1, false); + return requiredChannels; } diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp index 36593ea076..960392c4f4 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp @@ -395,9 +395,15 @@ void AudioProcessor::setPlayConfigDetails (const int newNumIns, if (getTotalNumInputChannels() != newNumIns) success &= setChannelLayoutOfBus (true, 0, AudioChannelSet::canonicalChannelSet (newNumIns)); + // failed to find a compatible input configuration + jassert (success); + if (getTotalNumOutputChannels() != newNumOuts) success &= setChannelLayoutOfBus (false, 0, AudioChannelSet::canonicalChannelSet (newNumOuts)); + // failed to find a compatible output configuration + jassert (success); + // if the user is using this method then they do not want any side-buses or aux outputs success &= disableNonMainBuses(); jassert (success);