diff options
author | Chris Robinson <[email protected]> | 2020-05-19 10:27:52 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-05-19 10:27:52 -0700 |
commit | 825206bfa2b59ae124cc8fb34c5b668f8a682224 (patch) | |
tree | e0198b6590c7e22352c651e0352db2e8b374a9d9 /alc/alc.cpp | |
parent | a512eae7bb3554723b7b290985404e7c480b9bf1 (diff) |
Apply the ambisonic HF scaling in real-time with HRTF
Rather than applying the HF scale to the IRs necessitating them to be truncated
along with increasing the IR size, it can be applied to the input signal for
the same results. Consequently, the IR size can be notably shortened while
avoiding the extra truncation. In its place, the delayed reversed all-pass
technique can still be used on the input for maintaining phase when applying
the bandsplit/hfscalar filter to the input signal.
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 707fc34d..74fed67a 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2098,11 +2098,16 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) device->SourcesMax, device->NumMonoSources, device->NumStereoSources, device->AuxiliaryEffectSlotMax, device->NumAuxSends); - if(Uhj2Encoder *uhj{device->Uhj_Encoder.get()}) + 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; } + if(device->mHrtfState) + device->FixedLatency += nanoseconds{seconds{HRTF_DIRECT_DELAY}} / device->Frequency; /* Enable the stablizer only for formats that have front-left, front-right, * and front-center outputs. @@ -2125,10 +2130,6 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) stablizer->MidFilter.init(5000.0f / static_cast<float>(device->Frequency)); device->Stablizer = std::move(stablizer); - /* NOTE: Don't know why this has to be "copied" into a local static - * constexpr variable to avoid a reference on - * FrontStablizer::DelayLength... - */ constexpr size_t StablizerDelay{FrontStablizer::DelayLength}; device->FixedLatency += nanoseconds{seconds{StablizerDelay}} / device->Frequency; } |