Skip to content

Instantly share code, notes, and snippets.

@pebble8888
Created November 5, 2014 08:26
Show Gist options
  • Save pebble8888/deab8fc5b1cdff022b92 to your computer and use it in GitHub Desktop.
Save pebble8888/deab8fc5b1cdff022b92 to your computer and use it in GitHub Desktop.
OpenAL phone call
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