Created
November 5, 2014 08:26
-
-
Save pebble8888/deab8fc5b1cdff022b92 to your computer and use it in GitHub Desktop.
OpenAL phone call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static BOOL shouldHandleEndInterruptionOnBecomingActive = NO; | |
+ (void)endInterruption | |
{ | |
if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) { | |
[self innerHandleEndInterruption]; | |
} else { | |
shouldHandleEndInterruptionOnBecomingActive = YES; | |
} | |
} | |
+ (void)appDidBecomeActive:(NSNotification *)notification { | |
if (shouldHandleEndInterruptionOnBecomingActive) { | |
shouldHandleEndInterruptionOnBecomingActive = NO; | |
[self innerHandleEndInterruption]; | |
} | |
} | |
+ (void)innerHandleEndInterruption { | |
AudioSessionSetActive(YES); | |
alcMakeContextCurrent(context); | |
alcProcessContext(context); | |
[SPAudioEngine postNotification:SP_NOTIFICATION_AUDIO_INTERRUPTION_ENDED object:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment