kstenerud / ObjectAL-for-iPhone

Mac and iOS Audio development, minus the headache. ObjectAL is the easy Objective-C interface to OpenAL, AVAudioPlayer, and audio session management.
http://kstenerud.github.com/ObjectAL-for-iPhone
886 stars 171 forks source link

interruptions handled properly? #31

Open sjchristi opened 12 years ago

sjchristi commented 12 years ago

Not sure if this is an issue; really this is more of a question. I noticed that in OALAudioSession.m, there is no special code to handle interruptions ending with the flag 'AVAudioSessionInterruptionFlags_ShouldResume'. According to the docs:

"To resume using audio after an interruption ends, you must ensure that your audio session is active. AVAudioPlayer and AVAudioRecorder instances reactivate your audio session automatically when an interruption ends. If you are using another audio technology, such as OpenAL, audio units, or audio queues, you must reactivate your audio session yourself before you can again use audio.

You can also use this method to update the user interface and application state, as necessary.

If this delegate method receives the AVAudioSessionInterruptionFlags_ShouldResume constant in its flags parameter, the audio session is immediately ready to be used.

If you implement this method, it is called instead of the endInterruption method when an interruption ends."

I don't see any special case handling to see if this flag was passed which then reactivates the session as necessary. Maybe I"m just missing it? Or is this left up to the delegate??

kstenerud commented 12 years ago

When implementing AVAudioSessionDelegate, you have the choice of using the basic endInterruption, or the flag version (flag version is iOS 4.0+ only). OALAudioSession uses the basic one and activates the session manually. If the session was already activated, it remains active. If it was suspended, it gets reactivated.

Bottom line is that ObjectAL handles it so you don't have to do a thing :)