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,6 +538,14 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
impl->DetectDevices = COREAUDIO_DetectDevices;
|
impl->DetectDevices = COREAUDIO_DetectDevices;
|
||||||
#else
|
#else
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
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
|
#endif
|
||||||
|
|
||||||
impl->ProvidesOwnCallbackThread = 1;
|
impl->ProvidesOwnCallbackThread = 1;
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050
|
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050
|
||||||
#include <AudioUnit/AUNTComponent.h>
|
#include <AudioUnit/AUNTComponent.h>
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#include <AudioToolbox/AudioToolbox.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <AudioUnit/AudioUnit.h>
|
#include <AudioUnit/AudioUnit.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue