[Vorbis] How can you synchronise audio with an already-playing stream?

richard richard at red-redemption.com
Thu Sep 23 07:15:12 PDT 2010


  Hey all,
  I'm having trouble synchronising pieces of audio with an 
already-playing stream.

I have a common background track is always playing, then themes that can 
mix with this track at arbitrary points.
The theme and background tracks are all the same length, so the plan is 
that themes will start playing at a position that corresponds with that 
of the background track.
Currently when I seek and play the second track it is ~0.5s late (it 
starts playing immediately, but is offset by ~0.5s).
All files are already stored in their compressed state in memory at the 
time the seek request is given. Each playback occurs on its own (OpenAL) 
source.

I'm using ov_pcm_tell/ov_pcm_seek to seek the second file to the 
position of the first, and have implemented all of ov_callbacks to 
facilitate this.
I suspect the problem is related to the time that passes between 
querying with _tell and the playing of the second source.

For the benefit of future google searches, I also asked this question here;
http://stackoverflow.com/questions/3770231/how-can-i-mix-a-melody-track-over-the-top-of-my-background-track

Any help or comments would be greatly appreciated.

-- 
Richard


More information about the Vorbis mailing list