Somehow my iPhone Simulator is unable to play sounds. First an app I\'m working on using AudioServicesPlaySystemSound()
stopped working.. I spent a while debug
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:
AudioSessionInitialize
as soon as your app finishes launchingkAudioSessionProperty_AudioCategory
property for the session via AudioSessionSetProperty
(with a value such as kAudioSessionCategory_MediaPlayback
)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.
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.
if reactivating system sounds didn't work for you try this: launch audio-midi-setup, then configure your "built in output" to use 44.100Hz, 2 channels, 24 bits. (from http://www.cocos2d-iphone.org/forum/topic/4159)
somehow after a few days, my iphone simulator now wants 48.000Hz, 2 channels, 24 bits. just play with it for a bit and be warned that it might change randomly when plugging in headphones, going to standby, restarting, etc.
and here's a an off-topic hint: when you plug headphones into your iphone/ipad the buffer size might double (e.g. from 512bytes to 1024 bytes), make sure you don't rely on the buffersize you requested!
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'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.
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.