Last active
August 29, 2015 14:00
-
-
Save kharmabum/11022763 to your computer and use it in GitHub Desktop.
Create audio sound id
This file contains 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
#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