Hello!!
I need to play a sound when succes and an other when error. It's something like this
if succes {
//Play sound for succes!!!!
}
else {
//Play sound for error
}
I know that I can use the AudioServicesPlayAlertSound function but .... how?
Thank you for your help!!!
(and.... sorry for my English...)
I did it this way.
func playInputClick(success: Bool) {
var filePath: String?
if success {
filePath = NSBundle.mainBundle().pathForResource("ButtonTap", ofType: "wav") // select the sound you want
} else {
filePath = NSBundle.mainBundle().pathForResource("SecondBeep", ofType: "wav") // select the sound you want
}
let fileURL = NSURL(fileURLWithPath: filePath!)
var soundID:SystemSoundID = 0
AudioServicesCreateSystemSoundID(fileURL, &soundID)
AudioServicesPlaySystemSound(soundID)
}
Call as you need.