Allow playing iPod music in the background of SDL applications.
You can always change your audio session category afterwards if you want custom behavior.
This commit is contained in:
parent
9549fda7e0
commit
68ee3bad84
2 changed files with 11 additions and 1 deletions
|
@ -538,8 +538,16 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl)
|
|||
impl->DetectDevices = COREAUDIO_DetectDevices;
|
||||
#else
|
||||
impl->OnlyHasDefaultOutputDevice = 1;
|
||||
|
||||
/* Set category to ambient sound so that other music continues playing.
|
||||
You can change this at runtime in your own code if you need different
|
||||
behavior. If this is common, we can add an SDL hint for this.
|
||||
*/
|
||||
AudioSessionInitialize(NULL, NULL, NULL, nil);
|
||||
UInt32 category = kAudioSessionCategory_AmbientSound;
|
||||
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(UInt32), &category);
|
||||
#endif
|
||||
|
||||
|
||||
impl->ProvidesOwnCallbackThread = 1;
|
||||
|
||||
return 1; /* this audio target is available. */
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050
|
||||
#include <AudioUnit/AUNTComponent.h>
|
||||
#endif
|
||||
#else
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
#endif
|
||||
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue