[Openal] Synchronizing multiple sources, and determining current
position
Garin Hiebert
garinh at cheesetoast.net
Wed Oct 4 07:49:19 PDT 2006
> I could play the
> data using a single OpenAL source and use this to time the presentation of
> the video frames. Would this be a recommended solution? i.e. is there a
> more appropriate solution than polling AL_SEC_OFFSET?
>
Using one of the offset values is the appropriate solution -- there will
be some sound-card-specific drift (I think it will be on the order of a
few seconds over an hour of playback), but the drift will be consistent
and the same for all sources. Syncing the video to the audio should do
the trick.
> If possible, I would prefer to play back each audio track as it's own
> OpenAL source to take advantage of hardware mixing. But what sort of
> synchronism can be expected between sources with different sampling rates
> / frequencies / channels etc... playing back on the same hardware?
>
That shouldnt' be an issue -- all the sources will ultimately be re
sampled and mixed together at one sample rate (normally 48kHz, but it
may be higher for some audio cards), so they should all be drifting at
the same rate. (I use weasel-words such as "should" because if you use
the "Generic Hardware" device, you're ultimately dependent on the
vendor's DS3D drivers, which may have their own bugs... This is a good
reason to support enumeration, so that if there is an issue with a
specific sound card, "Generic Software" could be selected. The "Generic
Software" mixer linearly-interpolates all sources into a 44.1kHz mixer,
BTW.)
Garin
More information about the Openal
mailing list