I’m using AudioServicesCreateSystemSoundID to play sound, it works fine except I’m not sure if I need to run it on a thread block or, by itself it run on it’s own thread.
I’m just afraid it might make my application not responsive if it’s run on main thread.
NSURL *tapSound = [[NSBundle mainBundle] URLForResource: @"mysound"
withExtension: @"aiff"];
// Store the URL as a CFURLRef instance
// soundFileURLRef = (__bridge CFURLRef) tapSound ;
// Create a system sound object representing the sound file.
SystemSoundID soundFileObject;
AudioServicesCreateSystemSoundID (
(__bridge_retained CFURLRef) tapSound,
&soundFileObject
);
// AudioServicesPlayAlertSound (soundFileObject);
AudioServicesPlaySystemSound (soundFileObject);
The sound will play asynchronously. You do not need to run it in its own thread.