0

複数のオーディオ ファイルを特定の順序で再生しようとしていますが、コードを実行すると、すべてのオーディオ ファイルが一度に再生されます。問題がどこにあるかはわかっていますが、各ファイルを分割する方法がわかりません。私はxcode 4.3を使用しています

[callSignPlayer play];
[VFRPlayer play];
[airportPlayer play];
[weRAPlayer play];
[aircraftPlayer play];
4

1 に答える 1

0

私が見つけた最良の方法は、次のオーディオファイルに移動するループを作成することでした...ここに見られるように

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++;
}
于 2013-08-11T19:07:49.473 に答える