Game Development Community

Crash when playing mp3 on device, works on simulator

by Randy Condon · in iTorque 2D · 08/12/2011 (12:00 pm) · 5 replies

When I try to play an mp3 on the device via startiPhoneAudioStream, I get an EXC_BAD_ACCESS error in the sound engine code.

When running the simulator, all works perfectly. (iTorque 1.4.1)

I've seen a couple of threads with a similar problem, but there was never a listed resolution.

The console lists these errors:

Error opening file: -43
Error opening file: -43
Error getting file format: -50
Error getting file data size: -50
Error getting file data info: -50
Error creating queue: 560360820
Error adding isRunning property listener to queue: -50
Error setting up queue: -50
Error getting packet upper bound size: -50
Error allocating buffer for queue: -50

From what I can tell, the path name looks fine (and it does play in the simulator).
I also tried a few variations, like game/data/audio/music/FE_Music.mp3

startiPhoneAudioStream("~/data/audio/music/FE_Music.mp3", true);

Any help appreciated. Thanks.

#1
08/12/2011 (12:05 pm)
Works in simulator, but not on device? Hmm, weird. I wonder if there is something wrong with the encoding. Can you send me the music so I can test it on my device? Use michaelp@garagegames.com
#2
08/12/2011 (12:21 pm)
Thanks for the quick response Micheal.

And now it began working. I guess I just needed to post for suitable embarrassment.

The -43 error code is file not found. Maybe the mp3 wasn't getting copied over to the device until suitable profanity was uttered. I've since taken care of that.

Thanks.
#3
08/12/2011 (12:24 pm)
Oh, one more thing. For this particular path, I made sure the path and file name matched case sensitivity of the listed directories. Not sure if that was the problem or not.
#4
08/12/2011 (12:25 pm)
Well, that's good news then. One less thing for me to debug over the weekend =)

Glad you got it working.
#5
06/17/2012 (5:41 am)
I'm having this same problem. The game runs on the simulator, but it crashes after the splash screen on my iPhone with this error. Anyone have any advice? Thanks! :)


EDIT: Just wanted to say I got it working. I think the problem was I was having two mp3 files trying to play at the same time, which doesn't work.