Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sound not working in iPhone Simulator?

On your Mac, go to System Preferences > Sound > Sound Effects and then uncheck and recheck "Play user interface sound effects".

You need to re-activate your system sounds, see the end of this page.


I had no sound in the simulator, so I tested it with mobile safari and tried playing an mp3: No sound!

All the above tips didn't help. Eventually, I changed my INPUT source from the virtual soundflower device to Line-In, and the Simulator worked!

So, even if the app wasn't using input, it didn't work well with Soundflower.


I've seen this problem after my update from OSX10.5.7 to 10.6.2

And I made the following changes to make the simulater sing again: Goto "Applications/Utilities" and run "Audio MIDI Setup", then change midi format from 48000 to 44100.


OpenAL not working on the simulator was fixed with the 2.1 SDK. Make sure Active SDK and Active Executable are set to 2.1.

By the way, make sure you're using the last version of CrashLanding (v1.8). Some nasty leaks in SoundEngine were fixed recently.


I've found sound to be very inconsistent in the simulator (2.1 SDK). Sometimes it works, sometimes it doesn't. Even when it does work, it's usually very choppy and distorted (when playing audio files such as mp3).

A few things to remember:

  • call AudioSessionInitialize as soon as your app finishes launching
  • set the kAudioSessionProperty_AudioCategory property for the session via AudioSessionSetProperty (with a value such as kAudioSessionCategory_MediaPlayback)
  • call AudioSessionSetActive(YES)

Of course when all else fails, just run it on your hardware!

EDIT: Now that the 2.2 SDK has been released, I haven't had any problems with sound in the simulator. They must have fixed the bugs! I highly recommend you upgrade to the 2.2 SDK.