diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2022-10-21 10:33:41 -0700 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2022-10-21 10:33:41 -0700 |
commit | ee40a2e7e4867a769765d447a15ac88832eb8aa0 (patch) | |
tree | 0ff9157bc237db41795d27dd731b0191289bb5e2 /alc | |
parent | 53b63f329c3daa82f3c02ed43b67338af3a3d77d (diff) |
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.
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 6 | ||||
-rw-r--r-- | alc/panning.cpp | 2 |
2 files changed, 5 insertions, 3 deletions
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<StereoEncoding if(stereomode.value_or(StereoEncoding::Default) == StereoEncoding::Uhj) { - if(UhjQuality >= UhjLengthHq) + if(UhjQuality != UhjQualityType::FIR256) device->mUhjEncoder = std::make_unique<UhjEncoder<UhjLengthHq>>(); else device->mUhjEncoder = std::make_unique<UhjEncoder<UhjLengthLq>>(); |