Playing back multiple audio files simultaneously

edited June 2013

I am trying to play back multiple audio files in sync with one another. I tried using multiple AEAudioUnitFilePlayer instances, but the tracks did not start together. Then I tried using AUAudioFilePlayer directly, but I kept getting an error when I tried to add more than one ScheduledAudioFileRegion via kAudioUnitProperty_ScheduledFileRegion. Any other suggestions on how this might be accomplished? Is there a way to force all the tracks to start playback at the same time via timecode or something similar?

Comments

  • AUAudioFilePlayer is monophonic, you can't have overlapping regions. Use one AUAudioFilePlayer per track, and set the timestamp to start them at the same time.

  • Thanks. How do I set the timestamp? By using the kAudioUnitProperty_ScheduleStartTimeStamp property?

  • I'm not entirely sure how it works, but you set the timestamp for the ScheduledAudioFileRegion in its mTimeStamp field. So you can schedule several (non-overlapping) regions for the same player. I assume these timestamps are relative the start set with kAudioUnitProperty_ScheduleStartTimeStamp.

    So maybe the way to go is to leave mTimeStamp at zero, and set kAudioUnitProperty_ScheduleStartTimeStamp for the same timestamp in the future for all players.

Sign In or Register to comment.