diff options
author | Chris Robinson <[email protected]> | 2016-05-28 00:43:14 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-05-28 00:43:14 -0700 |
commit | 6d4380a48c28f21d271d4eb5e668443bc8a0f50e (patch) | |
tree | 1c9c9f6a7b19185cce76f75fbb6c37bff4a9fa8f /OpenAL32 | |
parent | 800e38bac68315d372ca1f865c7c448356309f70 (diff) |
Change the backend getLatency method to return the clock time too
This will also allow backends to better synchronize the tracked clock time with
the device output latency, without necessarily needing to lock if the backend
API can allow for it.
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/alSource.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index ec32ac8d..e04199b3 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1006,6 +1006,7 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p { ALCdevice *device = Context->Device; ALbufferlistitem *BufferList; + ClockLatency clocktime; ALint ivals[3]; ALboolean err; @@ -1107,9 +1108,10 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SEC_OFFSET_LATENCY_SOFT: LockContext(Context); + clocktime = V0(device->Backend,getClockLatency)(); + values[0] = GetSourceSecOffset(Source); - values[1] = (ALdouble)(V0(device->Backend,getLatency)()) / - 1000000000.0; + values[1] = (ALdouble)clocktime.Latency / 1000000000.0; UnlockContext(Context); return AL_TRUE; @@ -1382,6 +1384,7 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64 *values) { ALCdevice *device = Context->Device; + ClockLatency clocktime; ALdouble dvals[6]; ALint ivals[3]; ALboolean err; @@ -1390,8 +1393,10 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp { case AL_SAMPLE_OFFSET_LATENCY_SOFT: LockContext(Context); + clocktime = V0(device->Backend,getClockLatency)(); + values[0] = GetSourceSampleOffset(Source); - values[1] = V0(device->Backend,getLatency)(); + values[1] = clocktime.Latency; UnlockContext(Context); return AL_TRUE; |