Created
January 2, 2013 19:57
-
-
Save codeswimmer/4437399 to your computer and use it in GitHub Desktop.
iOS: How to play sounds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SystemSoundID soundID; | |
| id sndpath = [[NSBundle mainBundle] pathForResource:@"mySound" ofType:@"mp3" inDirectory:@"/"]; | |
| CFURLRef baseURL = (CFURLRef) [[NSURL alloc] initFileURLWithPath:sndpath]; | |
| AudioServicesCreateSystemSoundID (baseURL, &soundID); | |
| AudioServicesPlaySystemSound(soundID); | |
| [baseURL release]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment