ipod: PLAYMUSIC or STOPMUSIC shortly before quit causes very weird stuff

Previous topic - Next topic

BdR

I was trying out the PLAYSOUND and PLAYMUSIC commands in my ipod game. It was working fine but then I found that sometimes when I quit the program the ipod wasn't responding normally anymore. :doubt:

It took a lot of time to narrow it down, but I think I've found what is causing it. The bug appears when I do a STOPMUSIC and then PLAYMUSIC and then quit the app with the home button.

Here are the steps to reproduce it:
1) first you do something like "PLAYMUSIC "Media//music1.mp3", TRUE" let it play for a while (for example about five seconds)
2) do a STOPMUSIC
3) do PLAYMUSIC with another mp3 file
4) quickly (within 1 second) press the HOME button to quit the app.
5) now restart the app and sound isn't working

Actually, not only is the sound not working in the glbasic app... Any app or ipod function that want to make a sound will be silent and work slow. It's as if any sound the ipod wants to do waits and then time-out. For example if you go to the ipod search screen (on the home screen all the way to the left) and type something it looks like it is frozen (each letter typed wants to make a typewriter noise). After I shut the ipod down and restart, everything is back to normal.

I also think it has to do with multitasking, because when I set the property "Application does not run in background" to TRUE (checked) then the bug doesn't happen. (btw changes in the plist are not always installed correctly by xcode, always delete the app and then build-and-run to ensure the changes to the plist are also copied correctly)

Man, I spent the last hours starting and restarting the app and the ipod over and over :bed: i'm off to bed..

BdR

Actually, here is my GLBasic test project for the iphone, see attachment zip file. I didn't include the mp3 files (copyright issues), but you can just put any music1.mp3, music2.mp3, sound1.wav and sound2.wav files in the Media folder, in order to run the sound test.

[attachment deleted by admin]

Kitty Hello

pressing the home button with multitasking enabled does NOT quit the app. It's running in the bacground, trying to play the sound or so.
Implement SUB GLB_ON_PAUSE: and call STOPMUSIC here. in SUB GLB_ON_RESUME: call PLAYMUSIC again. I try to get/set the current music position one day, but that's a lot of work.

BdR

Even when I do not use multitasking (AUTOPAUSE FALSE, and in plist "Application does not run in background"=false) I can still reproduce the error. But I've stopped looking for a solution, because you cannot get it with "normal" use. To get it you have to:

1) Start PLAYMUSIC on a file, let it play for a while
2) STOPMUSIC and start PLAYMUSIC with another file
3) now immediately quit after second PLAYMUSIC
4) immediately restart the same app

That's just asking for trouble :P (it still annoys me that it's there though)

Kitty Hello

try ALLOWESCAPE TRUE, that should definitely kill your App when you press the home button. See if it goes into GLB_ON_QUIT.
I have no idea what to change here. The music engine is a bit cryptic to me.