Multiple audio stream on iOS (multiRoute)

Hi JUCE team,

do you plan to implement to implement multiRoute for iOS?


No immediate plans for this, although from reading the docs it looks like we have a lot of the foundations for this in place already in the iOS audio code.

Does it work if you make the following modification in juce_ios_Audio.cpp to handleRouteChange() to reconfigure the device on route change:

switch (reason)
case AVAudioSessionRouteChangeReasonCategoryChange:
case AVAudioSessionRouteChangeReasonOverride:
case AVAudioSessionRouteChangeReasonUnknown:
case AVAudioSessionRouteChangeReasonNewDeviceAvailable:
case AVAudioSessionRouteChangeReasonOldDeviceUnavailable:
case AVAudioSessionRouteChangeReasonWakeFromSleep:
case AVAudioSessionRouteChangeReasonNoSuitableRouteForCategory:
case AVAudioSessionRouteChangeReasonRouteConfigurationChange:
    hardwareInfoNeedsUpdating = true;
// No default so the code doesn't compile if this enum is extended.

As well as changing the call to setAudioSessionCategory() in iOSAudioIODevice::Pimpl::open() to use AVAudioSessionCategoryMultiRoute.

Hi Ed @ed95
I just tested your suggestion. setAudioSessionCategory() triggers with the adaption a semantic issue as AVAudioSessionCategoryMultiRoute seems to deliver the wrong, non binary, return value. Do you see a possibility to add the multiRoute category in one of the next JUCE releases? Would be a very valuable feature to have multi-device playback and output routing options on IOS

Yes, you’re right that code is incorrect. I’ve modified my reply above so hopefully it won’t confuse anyone else. Does it work correctly with the modified changes above?

The updated code compiled well, great. I have not yet tested whether selecting the routing paths works correctly, however, will post an update in case any issues are occuring.