[Openal] Synchronising two sample streams

Marian Schedenig msched at msched.no-ip.org
Tue Apr 10 16:35:51 PDT 2007


Hi!

I'm thinking about implementing the following concept, but I'm not sure how 
i'd go about doing that with OpenAL:

I want to play a music stream through one source and two (or more buffers). 
Then, at some point, I want to switch to a somewhat different music stream by 
starting it *at the exact (!) same point* (offset from beginning) currently 
being played by the first stream and smoothly fading to the new stream.

My first idea was to simply start the second stream on a separate source with 
a separate set of buffers and then fade over. But how do I know *when* to 
start playback of the second source? Assuming I've found the correct offset 
in the second stream which I have already *buffered* for the first stream - 
how to I know when OpenAL is actually about to start playing that latest 
buffer on the first source, so I can sync up the second source accordingly?

I guess if I can't get the required "trigger" from OpenAL, I'll have to mix my 
buffers manually in software and play the result through a single source - 
but that's something I'd really like to avoid.

Thanks for any hints,
Marian.

-- 
http://www.musgit.com | http://marian.musgit.com

Hofstadter's law: "It always takes longer than you think,
even when you take account of Hofstadter's law".


More information about the Openal mailing list