diff options
author | Chris Robinson <[email protected]> | 2022-08-08 03:44:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-08-08 03:44:25 -0700 |
commit | 7e5dd4196846f61307e156d55ae0fc12fbd29512 (patch) | |
tree | ac818d0bcde0328b13fbe563a5a6d3fa82a605d7 /alc | |
parent | 250f1624964c2c53e00d18fd1ec2bbc77c860298 (diff) |
Add an option for higher quality UHJ filters
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 40 | ||||
-rw-r--r-- | alc/panning.cpp | 5 |
2 files changed, 30 insertions, 15 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index d17969f4..571088c9 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1124,25 +1124,37 @@ void alc_initconfig(void) if(auto limopt = ConfigValueBool(nullptr, nullptr, "rt-time-limit")) AllowRTTimeLimit = *limopt; - CompatFlagBitset compatflags{}; - auto checkflag = [](const char *envname, const char *optname) -> bool { - if(auto optval = al::getenv(envname)) + CompatFlagBitset compatflags{}; + auto checkflag = [](const char *envname, const char *optname) -> bool { - if(al::strcasecmp(optval->c_str(), "true") == 0 - || strtol(optval->c_str(), nullptr, 0) == 1) - return true; - return false; - } - return GetConfigValueBool(nullptr, "game_compat", optname, false); - }; - compatflags.set(CompatFlags::ReverseX, checkflag("__ALSOFT_REVERSE_X", "reverse-x")); - compatflags.set(CompatFlags::ReverseY, checkflag("__ALSOFT_REVERSE_Y", "reverse-y")); - compatflags.set(CompatFlags::ReverseZ, checkflag("__ALSOFT_REVERSE_Z", "reverse-z")); + if(auto optval = al::getenv(envname)) + { + if(al::strcasecmp(optval->c_str(), "true") == 0 + || strtol(optval->c_str(), nullptr, 0) == 1) + return true; + return false; + } + return GetConfigValueBool(nullptr, "game_compat", optname, false); + }; + compatflags.set(CompatFlags::ReverseX, checkflag("__ALSOFT_REVERSE_X", "reverse-x")); + compatflags.set(CompatFlags::ReverseY, checkflag("__ALSOFT_REVERSE_Y", "reverse-y")); + compatflags.set(CompatFlags::ReverseZ, checkflag("__ALSOFT_REVERSE_Z", "reverse-z")); - aluInit(compatflags, ConfigValueFloat(nullptr, "game_compat", "nfc-scale").value_or(1.0f)); + aluInit(compatflags, ConfigValueFloat(nullptr, "game_compat", "nfc-scale").value_or(1.0f)); + } Voice::InitMixer(ConfigValueStr(nullptr, nullptr, "resampler")); + if(auto uhjfiltopt = ConfigValueStr(nullptr, "uhj", "filter-type")) + { + if(al::strcasecmp(uhjfiltopt->c_str(), "fir256") == 0) + UhjQuality = UhjLengthLq; + else if(al::strcasecmp(uhjfiltopt->c_str(), "fir512") == 0) + UhjQuality = UhjLengthHq; + else + WARN("Unsupported uhj/filter-type: %s\n", uhjfiltopt->c_str()); + } + auto traperr = al::getenv("ALSOFT_TRAP_ERROR"); if(traperr && (al::strcasecmp(traperr->c_str(), "true") == 0 || std::strtol(traperr->c_str(), nullptr, 0) == 1)) diff --git a/alc/panning.cpp b/alc/panning.cpp index 22688bc9..ea716e4d 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -1093,7 +1093,10 @@ void aluInitRenderer(ALCdevice *device, int hrtf_id, al::optional<StereoEncoding if(stereomode.value_or(StereoEncoding::Default) == StereoEncoding::Uhj) { - device->mUhjEncoder = std::make_unique<UhjEncoder<UhjLengthStd>>(); + if(UhjQuality >= UhjLengthHq) + device->mUhjEncoder = std::make_unique<UhjEncoder<UhjLengthHq>>(); + else + device->mUhjEncoder = std::make_unique<UhjEncoder<UhjLengthLq>>(); TRACE("UHJ enabled\n"); InitUhjPanning(device); device->PostProcess = &ALCdevice::ProcessUhj; |