Sound does not work in iPhone Simulator?

Somehow my iPhone Simulator cannot play sounds. At first, the application I'm working on when using AudioServicesPlaySystemSound() stopped working. I spent some time debugging, but the sound still works on the iPhone when I launch the application on the device. I get the same results with other iPhone apps, for example with the Crash Hit app example.

I can’t find the sound setting anywhere in the simulator or Xcode settings. I tried to reset the simulator through the Reset Contents and Settings menu item to no avail.

+45
objective-c iphone cocoa-touch ios-simulator audio
Nov 19 '08 at 16:05
source share
6 answers

On your Mac, go to System Preferences> Sound> Sound Effects, and then uncheck Play Sound UI Effects and Recheck.

You need to reactivate system sounds, see the end of this page.

+62
Feb 12 '09 at 23:55
source share

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

All of the above tips did not help. In the end, I changed my INPUT source from a virtual audio device to a line input, and the simulator works!

Thus, even if the application did not use the input data, it did not work with Soundflower.

+17
Jul 10 '10 at 11:30
source share

I saw this problem after my upgrade from OSX10.5.7 to 10.6.2

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

+4
Dec 08 '09 at 6:13
source share

I found the sound very inconsistent in the simulator (2.1 SDK). Sometimes it works, sometimes it doesn’t. Even when it works, it is usually very intermittent and distorted (when playing audio files such as mp3).

A few things to remember:

  • call AudioSessionInitialize as soon as your application finishes launching
  • set the kAudioSessionProperty_AudioCategory property for a session through AudioSessionSetProperty (with a value, for example kAudioSessionCategory_MediaPlayback )
  • call AudioSessionSetActive(YES)

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

EDIT: Now that the 2.2 SDK is released, I had no problems with the sound in the simulator. They must have fixed the bugs! I highly recommend you upgrade to 2.2 SDK.

+3
Nov 19 '08 at 19:47
source share

OpenAL, not running on the simulator, has been fixed with the 2.1 SDK. Ensure that the Active SDK and Active Executable are installed in 2.1.

By the way, make sure you are using the latest version of CrashLanding (v1.8). Some unpleasant leaks in SoundEngine have been fixed recently.

+3
Nov 20 '08 at 1:53
source share

if you couldn’t succeed in reusing system sounds, try this: start the MIDI audio setup and then configure your “built-in output” to use 44.100Hz, 2 channels, 24 bits. (from http://www.cocos2d-iphone.org/forum/topic/4159 )

somehow in a few days, my iphone simulator now wants 48.000 Hz, 2 channels, 24 bits. just play with it a little and be careful so that it can accidentally change when you plug in the headphones, in standby mode, restart, etc.

and it’s not recommended here: if you connect the headphones to your iphone / ipad, the buffer size can double (for example, from 512 to 1024 bytes), make sure that you do not rely on the buffering that you requested!

+2
Jun 12 '10 at 21:26
source share



All Articles