我需要在同一时间用 2 个 AVAudioPlayer 对象播放 2 个声音......所以我在 Apple AVAudioPlayer 类参考(https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/ AVAudioPlayerClassReference/Reference/Reference.html):
- (void) startSynchronizedPlayback {
NSTimeInterval shortStartDelay = 0.01; // seconds
NSTimeInterval now = player.deviceCurrentTime;
[player playAtTime: now + shortStartDelay];
[secondPlayer playAtTime: now + shortStartDelay];
// Here, update state and user interface for each player, as appropriate
}
我不明白的是:为什么 secondPlayer 也有 shorStartDelay?不应该没有吗?我认为第一个玩家需要 0.1 秒的延迟,因为它在第二个玩家之前被调用......但是在这段代码中,2 个玩家有延迟......如果这是正确的,任何人都可以解释我,为什么?非常感谢马西