I guess I could use AVAudioPlayer to play a sound, however, what I need is to just play a short sound and I don\'t need any loops or fine-grained control over t
My answer is Bill's answer, but I use it without init or dealloc and release the sound after it's played:
- (void)playSound:(NSURL *)url
SystemSoundID ssID = 0;
AudioServicesCreateSystemSoundID((CFURLRef)url, &ssID);
AudioServicesAddSystemSoundCompletion(ssID, NULL, NULL, (AudioServicesSystemSoundCompletionProc)MyAudioServicesSystemSoundCompletionProc, NULL);
AudioServicesPlaySystemSound(ssID);
//AudioServicesDisposeSystemSoundID(ssID);
}
void MyAudioServicesSystemSoundCompletionProc (SystemSoundID ssID, void *clientData) {
AudioServicesDisposeSystemSoundID(ssID);
}