aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-10-21 23:33:06 -0700
committerChris Robinson <[email protected]>2022-10-21 23:33:06 -0700
commit7a91637d483210404935fc0b859bc886097a058e (patch)
tree44c0b3a28999be552953ef7bf36ab38832e8d448 /alc
parentee40a2e7e4867a769765d447a15ac88832eb8aa0 (diff)
Add separate filter options for UHJ encoding and decoding
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp21
-rw-r--r--alc/panning.cpp16
2 files changed, 29 insertions, 8 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 1f70569a..923e3438 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -1145,16 +1145,27 @@ void alc_initconfig(void)
}
Voice::InitMixer(ConfigValueStr(nullptr, nullptr, "resampler"));
- if(auto uhjfiltopt = ConfigValueStr(nullptr, "uhj", "filter"))
+ if(auto uhjfiltopt = ConfigValueStr(nullptr, "uhj", "decode-filter"))
{
if(al::strcasecmp(uhjfiltopt->c_str(), "fir256") == 0)
- UhjQuality = UhjQualityType::FIR256;
+ UhjDecodeQuality = UhjQualityType::FIR256;
else if(al::strcasecmp(uhjfiltopt->c_str(), "fir512") == 0)
- UhjQuality = UhjQualityType::FIR512;
+ UhjDecodeQuality = UhjQualityType::FIR512;
else if(al::strcasecmp(uhjfiltopt->c_str(), "iir") == 0)
- UhjQuality = UhjQualityType::IIR;
+ UhjDecodeQuality = UhjQualityType::IIR;
else
- WARN("Unsupported uhj/filter: %s\n", uhjfiltopt->c_str());
+ WARN("Unsupported uhj/decode-filter: %s\n", uhjfiltopt->c_str());
+ }
+ if(auto uhjfiltopt = ConfigValueStr(nullptr, "uhj", "encode-filter"))
+ {
+ if(al::strcasecmp(uhjfiltopt->c_str(), "fir256") == 0)
+ UhjEncodeQuality = UhjQualityType::FIR256;
+ else if(al::strcasecmp(uhjfiltopt->c_str(), "fir512") == 0)
+ UhjEncodeQuality = UhjQualityType::FIR512;
+ else if(al::strcasecmp(uhjfiltopt->c_str(), "iir") == 0)
+ UhjEncodeQuality = UhjQualityType::IIR;
+ else
+ WARN("Unsupported uhj/encode-filter: %s\n", uhjfiltopt->c_str());
}
auto traperr = al::getenv("ALSOFT_TRAP_ERROR");
diff --git a/alc/panning.cpp b/alc/panning.cpp
index 0e6b68d4..bed27dec 100644
--- a/alc/panning.cpp
+++ b/alc/panning.cpp
@@ -1060,10 +1060,20 @@ void aluInitRenderer(ALCdevice *device, int hrtf_id, al::optional<StereoEncoding
if(stereomode.value_or(StereoEncoding::Default) == StereoEncoding::Uhj)
{
- if(UhjQuality != UhjQualityType::FIR256)
- device->mUhjEncoder = std::make_unique<UhjEncoder<UhjLengthHq>>();
- else
+ switch(UhjEncodeQuality)
+ {
+ case UhjQualityType::IIR:
+ device->mUhjEncoder = std::make_unique<UhjEncoderIIR>();
+ break;
+ case UhjQualityType::FIR256:
device->mUhjEncoder = std::make_unique<UhjEncoder<UhjLengthLq>>();
+ break;
+ case UhjQualityType::FIR512:
+ device->mUhjEncoder = std::make_unique<UhjEncoder<UhjLengthHq>>();
+ break;
+ }
+ assert(device->mUhjEncoder != nullptr);
+
TRACE("UHJ enabled\n");
InitUhjPanning(device);
device->PostProcess = &ALCdevice::ProcessUhj;