aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-09-25 23:05:27 -0700
committerChris Robinson <[email protected]>2018-09-25 23:05:27 -0700
commit79314c4461333c7dfd7d425d69ffd121d6c163b6 (patch)
treec73f512dba6a9ca1ed8bcc2f2e09768046ca5a70 /Alc/ALc.c
parent2d6309d6fc68e5c2f658b48e6e44ba10be42848e (diff)
Include the limiter's lookAhead delay in the device latency
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index a65a56b6..70663780 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2051,6 +2051,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->RealOut.NumChannels = 0;
UpdateClockBase(device);
+ device->FixedLatency = 0;
device->DitherSeed = DITHER_RNG_SEED;
@@ -2253,6 +2254,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
al_free(device->Limiter);
device->Limiter = CreateDeviceLimiter(device, log10f(thrshld) * 20.0f);
+ device->FixedLatency += (ALuint)(device->Limiter->LookAhead * DEVICE_CLOCK_RES /
+ device->Frequency);
}
else
{
@@ -2263,6 +2266,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
aluSelectPostProcess(device);
+ TRACE("Fixed device latency: %uns\n", device->FixedLatency);
+
/* Need to delay returning failure until replacement Send arrays have been
* allocated with the appropriate size.
*/
@@ -2422,6 +2427,7 @@ static void InitDevice(ALCdevice *device, enum DeviceType type)
device->ClockBase = 0;
device->SamplesDone = 0;
+ device->FixedLatency = 0;
device->SourcesMax = 0;
device->AuxiliaryEffectSlotMax = 0;
@@ -3637,7 +3643,7 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname,
values[i++] = ALC_OUTPUT_LIMITER_SOFT;
values[i++] = device->Limiter ? ALC_TRUE : ALC_FALSE;
- clock = V0(device->Backend,getClockLatency)();
+ clock = GetClockLatency(device);
values[i++] = ALC_DEVICE_CLOCK_SOFT;
values[i++] = clock.ClockTime;
@@ -3663,7 +3669,7 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname,
case ALC_DEVICE_LATENCY_SOFT:
almtx_lock(&device->BackendLock);
- clock = V0(device->Backend,getClockLatency)();
+ clock = GetClockLatency(device);
almtx_unlock(&device->BackendLock);
*values = clock.Latency;
break;
@@ -3674,7 +3680,7 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname,
else
{
almtx_lock(&device->BackendLock);
- clock = V0(device->Backend,getClockLatency)();
+ clock = GetClockLatency(device);
almtx_unlock(&device->BackendLock);
values[0] = clock.ClockTime;
values[1] = clock.Latency;