[Openal] double buffering and context
Garin Hiebert
garinh at cheesetoast.net
Sat Jun 25 17:03:17 PDT 2005
> I am not entirely sure but I guess I need double
> buffering, my sounds flicker during play, one source
> turns off before the next plays
What is this "flickering"? If you have one sample in a buffer and
attached to a source, calling play on that source should result in
continuous playback of that sample from start to finish. If you are
trying to "stitch" the contents of multiple buffers together to get
continuous playback, the trick is to do it using OpenAL's queueing
mechanism -- play it back on _one_ source, not multiple sources. If
you use queueing, then as long as you have attached a new buffer
before the source stops playing the first, it will play
continuously. See "openal\demos\altest" in the source tree for an
example (the "Streaming Test").
Trying to get continuous playback using two sources can't be done
reliably -- there will inevitably be audible gaps. You'll hear it if
any samples are missed between detecting that one source is stopped
and playing the new one. Use queueing and that problem goes away,
because the OpenAL library will guarantee proper behavior.
Garin
More information about the Openal
mailing list