1

我是 Xcode 中声音的新手,我希望反复播放声音,无论它是否已经在播放。例如。我有三个正在发射的激光,我希望同时播放三个激光声,而不是等待每个激光声都播放完。我如何使用 实现这一目标AVAudioPlayer

4

1 回答 1

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];
于 2012-09-25T09:59:19.010 回答