Game Development Community

BUG: OS 3.0 - When device goes into sleep mode and then is woken up, sound fails to resume.

by Geoff Rowland · in iTorque 2D · 06/04/2009 (8:39 am) · 6 replies

I'm not sure if this is a bug with Torque, or if it is a bug with OS 3.0 -

If a device is running the OS 3.0 Beta and you let it go into sleep mode (or force it) while playing a game created with iTGB, once the device is woken up, sound will no longer play.

The only way to fix it is to restart your game. I tested this on a 2nd gen iPod Touch running OS 3.0.

#1
06/04/2009 (9:26 am)
It may be the way that the iTGB engine is handling recovering from a sleep/wake scenario. I have this issue on 3.0 beta 5 on my iPhone 3G, but not on my other iPhone using 2.2.1.
#2
06/04/2009 (9:32 am)
I actually encountered this bug in a lot of other apps, and not just iTGB. Might have something to do with SoundEngine.
#3
06/17/2009 (8:44 pm)
The problem is that currently iTGB doesn't correctly handle audio sessions. I had to reimplement that part as per Apple guidelines. After iphone goes into sleep (if a call comes through for example), the application must reinitialize the audio session or sound will be suspended for the app. Also I found that the default session is a bit finicky. For games it's best to use kAudioSessionCategory_AmbientSound sessions.
#4
06/17/2009 (9:41 pm)
I think the problem went away on the 3.0 GM seed, anyone else confirm?
#5
06/18/2009 (3:49 am)
In OS 3 you better don't use the ambient sound session anymore as its meaning has changed pretty heavily.
In OS 3 you would need to solo session.
What this means in short is that iTGB needs to detect the OS on which is running and use the corresponding session or there will be pretty "interesting" issues (complete different behaviour) comming up.
#6
06/18/2009 (4:11 am)
Yeah I can confirm that the problem went away in the 3.0 GM seed.