1
我正在開發播放聲音的iPhone應用程序。不管中斷什麼時候「產生」,我都不想中斷或播放另一個聲音。我的代碼如下:等待,直到另一個聲音完成之前播放一個新的
if(distance <= 10)
{
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"wav"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath: soundPath], &soundID);
AudioServicesPlaySystemSound(soundID);
}
簡而言之,我不想播放新的聲音,如果一個已經播放。
我不想排隊另一個聲音播放,如果一個已經播放。
這可能嗎?
你可能想[AudioServicesAddSystemSoundCompletion()](http://developer.apple.com/library/ios/documentation/AudioToolbox/Reference/SystemSoundServicesReference /Reference/reference.html#//apple_ref/c/func/AudioServicesAddSystemSoundCompletion)。 – 2011-04-18 01:37:51