(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> //Use audio services to play the sound



Go to Source cialis 40 mg pills.

This entry was posted in Objective-C and tagged , , , , , , , , . Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Why ask?