[openal] Synchronizing 3D sources
doug at enkisoftware.com
Mon Jan 27 12:24:29 EST 2014
[Just an FYI, TL;DR: wait until I finish the prototype.]
I've started a prototype implementation, with temporary extension name
AL_SOFT_device_clock on a branch on my github fork of OpenAL (otherwise
unchanged from the main repo).
Currently the functionality is just for getting the required data
atomically, as per example I've added here:
The extension add three source enums, only the first two of which work as
AL_SAMPLE_OFFSET_DEVICE_CLOCK_SOFT returns source offset, output
sample count, output frequency, and output update size.
AL_SAMPLE_OFFSET_LATENCY_DEVICE_CLOCK_SOFT returns source offset in
32.32 format as per AL_SAMPLE_OFFSET_LATENCY along with latency,
output sample count, output frequency and output update size.
These should be sufficient for deciding when to play a source with the
new (not implemented yet) AL_PLAY_ON_DEVICE_CLOCK_SOFT timing.
After some thought the device clock is just in output samples for now.
This is sufficient for the use cases I am aware of for now, and we can
add a more generally applicable clock later, but we'll likely need
sub-sample timing precision if we're to support synchronization of
sources with different frequencies from the output clock.
On 24 January 2014 14:39, Doug Binks <doug at enkisoftware.com> wrote:
> I'll have a think - this would accumulate a small amount of error but it
> should be OK. Another potential would be to recalculate the number of
> samples when the frequency is changed into the new sample rate.
> On 24 January 2014 14:22, Chris Robinson <chris.kcat at gmail.com> wrote:
>> On 01/24/2014 05:14 AM, Doug Binks wrote:
>>> Sounds good - presumably there are no current plans to add a device
>>> frequency change to the spec, but can always change the code at that
>>> if needed.
>> Hmm, that's a good point, actually. The playback frequency can change if
>> a new context is created and specifies an ALC_FREQUENCY attribute.
>> In that case, a better option would be to store the clock time in the
>> device, instead of the samples mixed. Then you'd increase the clock time in
>> aluMixData by converting the number of samples to mix into a time increment.
>> openal mailing list
>> openal at openal.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the openal