如何与自己叠加声音?

时间:2012-09-25 09:36:54

标签: iphone objective-c audio avaudioplayer

我是Xcode的新手,我想重复播放声音,无论是否已经播放。例如。我有三个正在拍摄的激光器,我希望激光声能同时播放三次,而不是等待每一个完成播放。如何使用AVAudioPlayer实现此目的?

1 个答案:

答案 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];