iOS non-exclusive audio device setup


#1

Hey there Jules,

For my iOS game on JUCE, I want to enable audio session behaviour which lets the user continue to listen to their own music while playing the game sound effects mixed in.  Currently iOSAudioIODevice::open kills audio from other apps with the line:

setSessionUInt32Property (kAudioSessionProperty_AudioCategory, kAudioSessionCategory_MediaPlayback);

To allow other applications' background audio to continue playing this needs to be:

setSessionUInt32Property (kAudioSessionProperty_AudioCategory, kAudioSessionCategory_AmbientSound);

In my local version, I've added a "bool exclusive" parameter to iOSAudioIODevice::open to switch between these behaviours and a corresponding flag in AudioDeviceSetup to enable it to be set on the AudioDeviceManager::initialise call. Is this a sensible way to proceed?

Cheers,

Steve.

 


#2

Yes, that could be a good plan - other device types like ASIO also have exclusive modes, so it might be a good idea to just make this a property of the AudioIODevice base class.


#3

Yay!! And fix the WASAPI device to work this also :)