複数のオーディオ ファイルを特定の順序で再生しようとしていますが、コードを実行すると、すべてのオーディオ ファイルが一度に再生されます。問題がどこにあるかはわかっていますが、各ファイルを分割する方法がわかりません。私はxcode 4.3を使用しています
[callSignPlayer play];
[VFRPlayer play];
[airportPlayer play];
[weRAPlayer play];
[aircraftPlayer play];
私が見つけた最良の方法は、次のオーディオファイルに移動するループを作成することでした...ここに見られるように
for (int soundsIn=0; soundsIn < totalSoundsInQueue;) {
NSString *sound = [theSoundArray objectAtIndex:soundsIn];
while(![Player isPlaying]){
Player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:sound ofType:@"caf"]] error:nil];
[Player setVolume:1.0f];
[Player play];
//Increment for loop counter & move onto next iteration
soundsIn++;
}