views:

43

answers:

2

AudioServicesPlaySystemSound doesn't do anything but AudioServicesPlayAlertSound makes the iPhone vibrate.

AudioServicesCreateSystemSoundID returns success. I'm developing on iPhone3G running iOS4.

Any ideas? Peter

=====

Here's how I create the sound:

NSString *sndPath = [[NSBundle mainBundle] pathForResource:@"first_touch" ofType:@"wav" inDirectory:@"/"];
CFURLRef sndURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:sndPath];
int e = AudioServicesCreateSystemSoundID(sndURL, &_firstTouch);  // TODO: call 'AudioServicesDisposeSystemSoundID'

And that's who I play it:

AudioServicesPlayAlertSound(_firstTouch);
+1  A: 

Showing some code helps.

At a guess, you're creating a sound, playing the sound, and then immediately deleting the sound. This doesn't work; deleting the sound causes it to stop playing.

tc.
A: 

I'm not deleting the sound. I added the source code.

After I rebooted both my machine and the iPhone, it started working on the simulator but not on the iPhone.

It worked once on the iPhone. I'm testing with a new project with just the create and play sound in it.

Peter