Skip to content

Instantly share code, notes, and snippets.

@kharmabum
Last active August 29, 2015 14:00
Show Gist options
  • Save kharmabum/11022763 to your computer and use it in GitHub Desktop.
Save kharmabum/11022763 to your computer and use it in GitHub Desktop.
Create audio sound id
#import <AudioToolbox/AudioToolbox.h>
+(SystemSoundID)bleatSoundID {
static SystemSoundID bleatSoundID = 0;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"Bleat" ofType:@"aif"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath: soundPath], &bleatSoundID);
});
return bleatSoundID;
}
// AudioServicesPlaySystemSound([[self class] bleatSoundID]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment