mirror of
https://github.com/yawut/SDL.git
synced 2026-07-06 19:54:20 -05:00
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
017bece619
commit
1899a26c04
|
|
@ -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…
Reference in New Issue
Block a user