[Openal] Synchronising two sample streams
dpeacock at creativelabs.com
Tue Apr 10 16:47:25 PDT 2007
A simple solution might be to play both streams (on two different Sources)
all the time. One Source will be silent (gain = 0) and the other audible
(gain = 1). When you need to switch between the streams, simply raise the
gain on one Source, and lower it on the other.
You can use the alSourcePlayv (vector version of alSourcePlay) function to
start the playback of the two Sources at the same time.
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying or distribution of the message, or
any action taken by you in reliance on it, is prohibited and may be
unlawful. If you have received this message in error, please delete it
and contact the sender immediately. Thank you.
<msched at msched.no
Sent by: openal at opensource.creative.com
openal-bounces at op cc
[Openal] Synchronising two sample
Please respond to
m.sched at gmx.at
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
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
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
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,
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".
Openal mailing list
Openal at opensource.creative.com
More information about the Openal