From 7e5dd4196846f61307e156d55ae0fc12fbd29512 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 8 Aug 2022 03:44:25 -0700 Subject: Add an option for higher quality UHJ filters --- alc/alc.cpp | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'alc/alc.cpp') 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)) -- cgit v1.2.3