diff options
-rw-r--r-- | alc/alc.cpp | 21 | ||||
-rw-r--r-- | alc/panning.cpp | 16 | ||||
-rw-r--r-- | alsoftrc.sample | 20 | ||||
-rw-r--r-- | core/uhjfilter.cpp | 3 | ||||
-rw-r--r-- | core/uhjfilter.h | 3 | ||||
-rw-r--r-- | core/voice.cpp | 4 |
6 files changed, 49 insertions, 18 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; diff --git a/alsoftrc.sample b/alsoftrc.sample index dff355fb..50aa7b01 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -353,12 +353,20 @@ ## [uhj] -## filter: (global) -# Specifies the all-pass filter type for UHJ encoding, decoding, and Super -# Stereo processing. The default is 'fir256', which utilizes a 256-point FIR -# filter. 'fir512' utilizes a 512-point FIR filter, providing higher quality -# at the cost of higher CPU use. -#filter = fir256 +## decode-filter: (global) +# Specifies the all-pass filter type for UHJ decoding and Super Stereo +# processing. Valid values are: +# fir256 - utilizes a 256-point FIR filter. +# fir512 - utilizes a 512-point FIR filter, providing a wider pass-band, at +# the cost of more CPU use. +# iir - utilizes dual IIR filters, providing a wide pass-band with low CPU +# use, but may exhibit some low-level distortion. +#decode-filter = fir256 + +## encode-filter: (global) +# Specifies the all-pass filter type for UHJ output encoding. Valid values are +# the same as for decode-filter. +#encode-filter = fir256 ## ## Reverb effect stuff (includes EAX reverb) diff --git a/core/uhjfilter.cpp b/core/uhjfilter.cpp index 7b2c1191..b12a094a 100644 --- a/core/uhjfilter.cpp +++ b/core/uhjfilter.cpp @@ -12,7 +12,8 @@ #include "phase_shifter.h" -UhjQualityType UhjQuality{UhjQualityType::Default}; +UhjQualityType UhjDecodeQuality{UhjQualityType::Default}; +UhjQualityType UhjEncodeQuality{UhjQualityType::Default}; namespace { diff --git a/core/uhjfilter.h b/core/uhjfilter.h index a276cb06..e90dd18b 100644 --- a/core/uhjfilter.h +++ b/core/uhjfilter.h @@ -19,7 +19,8 @@ enum class UhjQualityType : uint8_t { Default = FIR256 }; -extern UhjQualityType UhjQuality; +extern UhjQualityType UhjDecodeQuality; +extern UhjQualityType UhjEncodeQuality; struct UhjAllPassState { diff --git a/core/voice.cpp b/core/voice.cpp index ae8582da..8d6737ca 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -856,7 +856,7 @@ void Voice::prepare(DeviceBase *device) mDecoderPadding = 0; if(mFmtChannels == FmtSuperStereo) { - switch(UhjQuality) + switch(UhjDecodeQuality) { case UhjQualityType::IIR: mDecoder = std::make_unique<UhjStereoDecoderIIR>(); @@ -874,7 +874,7 @@ void Voice::prepare(DeviceBase *device) } else if(IsUHJ(mFmtChannels)) { - switch(UhjQuality) + switch(UhjDecodeQuality) { case UhjQualityType::IIR: mDecoder = std::make_unique<UhjDecoderIIR>(); |