Error processing ObjectAL auto-interrupt

I play with phone calls while (SpriteKit) is working to check for interruptions. I use an example from the ObjectAL documentation: "Using OpenAL and OALAudioTrack Objects" .

So, I let the library handle this automatically ...

[OALAudioSession sharedInstance ]. handleInterruptions = YES 

And it works, but partially. For example, with a simple setup with three sounds, I get the following error message:

OALAudioSession activateAudioSession]: Failed to activate the audio session after 2 attempts: Domain error = NSOSStatusErrorDomain Code = 561015905 "Operation could not be completed. (OSStatus Error 561015905.)"

Error 561015905 == 0x21706C61 == !pla and referring to the error declared in AVAudioSession.h:

AVAudioSessionErrorCodeCannotStartPlaying = '! pla ', / * 0x21706C61, 561015905

And actually it works, there are two unsuccessful attempts, the third was successful, nothing can be noticed, because everything is fast and everything seems to work as it should.

I noticed that if I add more sounds (say 20), I will get the same messages:

Failed to activate audio session after 20 attempts:

After that, the session is activated. Then I just added a debug message in the appropriate method:

OALAudioSession.m

 - (void) activateAudioSession { NSError* error; for(int try = 1; try <= kMaxSessionActivationRetries; try++) { if([[AVAudioSession sharedInstance] setActive:YES error:&error]) { NSLog(@"Session activated after %d", try); audioSessionActive = YES; return; } OAL_LOG_ERROR(@"Could not activate audio session after %d tries: %@", try, error); [NSThread sleepForTimeInterval:0.2]; } OAL_LOG_ERROR(@"Failed to activate the audio session"); } 

So, finally, after 20 unsuccessful attempts, I get a message that says: "Session activated after 21 attempts"

But since kMaxSessionActivationRetries is set to 40, the sound will ultimately break because the number of attempts can easily go beyond the allowed 40 attempts. I know that I can change this value, but this does not actually solve the problem.

Did I miss something important here? I thought that if the handleInterruptions property handleInterruptions set to YES, we don’t need to do manual interrupts / session processing? I am testing iPhone 6 and iOS8 if that matters. Can anyone shed some light on this?

+8
objective-c sprite-kit avaudiosession objectal
source share

No one has answered this question yet.

See similar questions:

4
OpenAL vs AVAudioPlayer and other ways to play sounds

or similar:

1066
Shortcuts in Objective-C for combining NSStrings
41
iOS8 AVAudioSession setActive error
7
AVAudioRecorder does not record in the background after an audio session is interrupted
7
Unable to restart interrupted audio input queue in background on iOS
6
How to stop AVAudioSession sequentially after AVSpeechUtterance
3
NSOSStatusError
2
No sound is played on the device if AVAudioSession MixWithOthers is set to yes
2
How to keep the background audio application in the background during breaks?
one
Resuming an interrupted music player without deactivating the current application audio session
0
AudioUnitInitialize error with error code 1701737535 'ent?' after interruption of alarm

All Articles