2012-09-25 33 views
1

我對Xcode中的聲音很陌生,我希望重複播放聲音,無論它是否已經播放。例如。我有三個正在拍攝的激光,我希望激光聲音能夠同時播放三次,而不用等待每個人完成演奏。我如何使用AVAudioPlayer來實現這個目標?如何用自己的聲音過濾聲音?

回答

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