Tag Archives: sound id

(Objective C) Play a sound file

// Play sound //To load sound file. +(void) playSound:(NSString *)fileName { NSString *path = [NSString stringWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath],fileName];</code> <code>//declare a system sound id SystemSoundID soundID; //Get a URL for the sound file NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO]; //Use audio sevices to create the sound AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID); </code> <code> //Use audio services to play the [...]

Posted in Objective-C | Also tagged , , , , , , , | Leave a comment