No Sound in iPhone Simulator

I am having problems with running the CrashLanding example on my MacBook - there is no sound. All i get is following error message:

Error generating buffer
: a002
Error loading looping file info: 40962

The App runs fine on the real device and i was developing on a different MacBook before where Sound was working fine. Did anyone experience similar problems and is there a way to solve this?

I am using a MacBook2,1 with OSX 10.5.4.

Can anyone give me some hints on why this could be?
System Sounds and other Audio files run without problems.

MacBook 2, 1, Mac OS X (10.5.4)

Posted on Aug 14, 2008 2:39 AM

Reply
21 replies

Aug 14, 2008 4:25 AM in response to lores3000

Strangely enough, this code works fine in the simulator and on the phone (i put the code into the CrashLanding example):

SystemSoundID clickId;

NSString *file = [bundle pathForResource:@"Start" ofType:@"caf"];
NSURL *url = [NSURL fileURLWithPath:file];

AudioServicesCreateSystemSoundID( (CFURLRef) url, &clickId );
AudioServicesPlaySystemSound( clickId );
AudioServicesDisposeSystemSoundID( clickId );

Aug 28, 2008 8:34 PM in response to lores3000

I was having the same problem on my desktop iMac - no sound in the simulator, but sound fine on the app on a device. I ended up ifdef'ing the sound stuff for the simulator. But two days ago i got a new MacBook, and on THAT unit, the sounds plays fine on the simulator! It's running the exact same version of MacOS (the latest), and all the XCode files were directly copied from my desktop files, so they're identical too. Go figure. I have no idea what's up.

Aug 29, 2008 11:13 PM in response to kagakuninja

OK, in my case, my CAF files are using IMA4 format, and SoundEngine will only play them when you use the "background track" methods, e.g. SoundEngine_LoadBackgroundMusicTrack. If I try and play them using the "sound effect" methods (e.g. SoundEngine_StartEffect), nothing useful will happen. When I convert the files to 16 bit little-endian (the "prefered format"), then they do play as "sound effects". I would prefer to not convert them, as that bloats the files hugely. Anyway, going to drill down into the implementation a bit more, there may be a way to get it to work.

Aug 30, 2008 8:25 PM in response to kagakuninja

I've been trying to solve exactly this problem for a couple weeks now, with no success.

I've tried both AudioQueueEnqueueBuffer() and AudioQueueEnqueueBufferWithParameters(), both of which play LEI16 CAF and IMA4 if using SoundEngine_LoadBackgroundMusicTrack, but neither with SoundEngine_StartEffect.

The documentation, as usual, is unhelpful. I'm not sure there's a way to avoid the bloat of uncompressed SFX. The IMA4 compression is not great, around 4:1, but it's something. I'd like to take advantage of it.

There's something ironic about an ipod not being able to play compressed sound easily.

Sep 2, 2008 3:57 PM in response to prauz

I'm having a similar problem myself. I was using both the CrashLanding example and the regular OSX OpenALExample. I got as far as

alGenSources(1, &gSource);

and would get the error you described when running in the simulator. I didn't even try to play a sound yet. However, when I ran my app on the device itself I did not get that error. No saying I won't get an error down the road, but is OpenAL setup to NOT work on simulators, but only on devices?
Thank you
Mike

Oct 3, 2008 12:56 PM in response to lores3000

Hello all,

Has anyone figured out why this error is occurring? The odd thing about this is that I created an application yesterday using SoundEngine.h/cpp and it ran flawlessly then today, in a new app with the same files, I am getting this error and sound will not play.

The only difference between the two apps is that one uses Interface Builder and the other doesn't. Perhaps this is the reason there is an error and I'm going to try creating an app without IB and identical sound configuraion (using CrashLanding's SoundEngine) to see if this error occurs then.

In any case, any help is appreciated.

Oct 6, 2008 12:33 PM in response to prauz

No, no difference.

I finally realized these errors were related with the simulator not being able to load the correct buffers to make sound since the iPod/iPhone devices work fine with the code.

I read somewhere that iPhone 2.1 fixed this problem, but I have this OS installed but the buffer problem still exists for the simulator. For now, I ignore these errors and test sound on the device (and this is just a tad annoying but as long as I understand how to deal with the error msgs, I'm a happy camper.)

Oct 17, 2008 9:00 PM in response to lores3000

I have a Mac Mini with the same setup as my MBP. I know I used to have sound on the simulator on the MBP. But now it doesn't work, even the CrashLanding which did have sound before. Now, I noticed there is an aggregate audio device called "iPhoneSimulatorAudioDevice" being created by the simulator. The Mac Mini doesn't have this. Even if I changed the version to 2.1, there is no difference.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

No Sound in iPhone Simulator

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.