Hello, I am a beginner in this very confusing Objective-C game.
I would like to play a very short sound effect every time a certain button is pushed.
How can I do this?
Can I use an mp3 file? Or will I have to convert to wav?
Thankya
Hello, I am a beginner in this very confusing Objective-C game.
I would like to play a very short sound effect every time a certain button is pushed.
How can I do this?
Can I use an mp3 file? Or will I have to convert to wav?
Thankya
You can use System Sound Services to play short sounds:
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef = CFBundleCopyResourceURL(mainBundle, CFSTR("filename"), CFSTR("aiff"), NULL);
SystemSoundID soundId;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundId);
AudioServicesPlaySystemSound(soundId);
.caf, .aiff and .wav formats are supported.