From ee40a2e7e4867a769765d447a15ac88832eb8aa0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 21 Oct 2022 10:33:41 -0700 Subject: Add an IIR filter option for UHJ encoding/decoding This uses the reversed-allpass trick to maintain linear phase. with a 256- sample look-ahead/delay to minimize distortion. This should better preserve low frequencies while maintaining a proper phase response. --- alc/alc.cpp | 6 ++++-- alc/panning.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'alc') diff --git a/alc/alc.cpp b/alc/alc.cpp index e89ad598..1f70569a 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1148,9 +1148,11 @@ void alc_initconfig(void) if(auto uhjfiltopt = ConfigValueStr(nullptr, "uhj", "filter")) { if(al::strcasecmp(uhjfiltopt->c_str(), "fir256") == 0) - UhjQuality = UhjLengthLq; + UhjQuality = UhjQualityType::FIR256; else if(al::strcasecmp(uhjfiltopt->c_str(), "fir512") == 0) - UhjQuality = UhjLengthHq; + UhjQuality = UhjQualityType::FIR512; + else if(al::strcasecmp(uhjfiltopt->c_str(), "iir") == 0) + UhjQuality = UhjQualityType::IIR; else WARN("Unsupported uhj/filter: %s\n", uhjfiltopt->c_str()); } diff --git a/alc/panning.cpp b/alc/panning.cpp index 6447f0f8..0e6b68d4 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -1060,7 +1060,7 @@ void aluInitRenderer(ALCdevice *device, int hrtf_id, al::optional= UhjLengthHq) + if(UhjQuality != UhjQualityType::FIR256) device->mUhjEncoder = std::make_unique>(); else device->mUhjEncoder = std::make_unique>(); -- cgit v1.2.3