diff options
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index e4db2681..c72bc320 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1985,23 +1985,15 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) device->SourcesMax, device->NumMonoSources, device->NumStereoSources, device->AuxiliaryEffectSlotMax, device->NumAuxSends); + nanoseconds::rep sample_delay{0}; if(device->Uhj_Encoder) - { - /* NOTE: Don't know why this has to be "copied" into a local constexpr - * variable to avoid a reference on Uhj2Encoder::sFilterSize... - */ - constexpr size_t filter_len{Uhj2Encoder::sFilterSize}; - device->FixedLatency += nanoseconds{seconds{filter_len}} / device->Frequency; - } + sample_delay += Uhj2Encoder::sFilterSize; if(device->mHrtfState) - device->FixedLatency += nanoseconds{seconds{HRTF_DIRECT_DELAY}} / device->Frequency; + sample_delay += HRTF_DIRECT_DELAY; if(auto *ambidec = device->AmbiDecoder.get()) { if(ambidec->hasStablizer()) - { - constexpr size_t StablizerDelay{FrontStablizer::DelayLength}; - device->FixedLatency += nanoseconds{seconds{StablizerDelay}} / device->Frequency; - } + sample_delay += FrontStablizer::DelayLength; } if(GetConfigValueBool(device->DeviceName.c_str(), nullptr, "dither", 1)) @@ -2089,12 +2081,14 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) const float thrshld_dB{std::log10(thrshld) * 20.0f}; auto limiter = CreateDeviceLimiter(device, thrshld_dB); - /* Convert the lookahead from samples to nanosamples to nanoseconds. */ - device->FixedLatency += nanoseconds{seconds{limiter->getLookAhead()}} / device->Frequency; + + sample_delay += limiter->getLookAhead(); device->Limiter = std::move(limiter); TRACE("Output limiter enabled, %.4fdB limit\n", thrshld_dB); } + /* Convert the sample delay from samples to nanosamples to nanoseconds. */ + device->FixedLatency += nanoseconds{seconds{sample_delay}} / device->Frequency; TRACE("Fixed device latency: %" PRId64 "ns\n", int64_t{device->FixedLatency.count()}); FPUCtl mixer_mode{}; |