我是Xcode的新手,我想重复播放声音,无论是否已经播放。例如。我有三个正在拍摄的激光器,我希望激光声能同时播放三次,而不是等待每一个完成播放。如何使用AVAudioPlayer
实现此目的?
答案 0 :(得分:0)
这样做:
AVAudioPlayer *laserSound1 = .........
laserSound1.numberOfLoops = 2; //plays three times simultaneously
[laserSound1 play];
AVAudioPlayer *laserSound2 = .........
laserSound2.numberOfLoops = 2;//plays three times simultaneously
[laserSound2 play];
AVAudioPlayer *laserSound3 = .........
laserSound3.numberOfLoops = 2;//plays three times simultaneously
[laserSound3 play];