Audio Woes Become Audio Woos!

Sweet merciful crap, I’ve finally got my audio working properly! It took me 3 days of trying things before finally figuring it out. Even after I simplified things (as Bemmu had suggested in the comments to an earlier post), I still ran into a bunch of problems that would have prevented me from shipping the game. I’ve finally fixed it all, and in its simplified form I think things work much more intuitively, so that’s a bonus.

Now the audio for the game works like this:

  • If the user is playing iPod music when the game launches, it plays the game’s sound fx, but uses the iPod music.
  • If the user is not playing iPod music when the game launches, it plays the custom game music along with the game’s sound fx.
  • If the user brings up the iPod music controls mid-game and starts playing their own music, the game will stop playing its music and let them play theirs instead.
  • If the user brings up the iPod music controls mid-game and stops playing their own music, the game will start playing the custom game music again.

If you have an iPhone developer account and want to see the details (including code snippets) of what happened and how I fixed it, you can see the thread on the forums here: Audio Session Problems (devforums.apple.com – Note: You must have an iPhone developer login to access this page).

I’m very pleased with how well this works. I think it makes the game feel much more polished, as it puts control into the users’ hands and lets them play how they want to play.

Next up this afternoon: adding sfx to the front-end menus.

Owen