diff options
author | Chris Robinson <[email protected]> | 2021-12-21 08:18:07 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-12-21 08:18:07 -0800 |
commit | 0af1b5f7218cf60e3a51f43903f3c5461cdcbdf8 (patch) | |
tree | b5eb6fb7e170369b25701297b9220885e7129a14 /alc/alc.cpp | |
parent | 633c332deee0500b85927906be1084606a286ac9 (diff) |
Don't do direct channels with UHJ output
Directly mixing a non-UHJ stereo signal into a UHJ stereo signal results in a
non-UHJ stereo signal. Such a mix can't be properly decoded anymore.
An option can probably be added for users that intend to listen to UHJ output
undecoded and let a stereo sound come through as-is on their speakers, but it
probably shouldn't be the default for cases where the output may be decoded
back.
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index b63f0f82..bbcd6d01 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1430,15 +1430,6 @@ ALCenum EnumFromDevAmbi(DevAmbiScaling scaling) * existing ones. Based on Wine's DSound downmix values, which are based on * PulseAudio's. */ -const std::array<InputRemixMap,7> MonoDownmix{{ - { FrontLeft, {{{FrontCenter, 0.5f}, {LFE, 0.0f}}} }, - { FrontRight, {{{FrontCenter, 0.5f}, {LFE, 0.0f}}} }, - { SideLeft, {{{FrontCenter, 0.5f/9.0f}, {LFE, 0.0f}}} }, - { SideRight, {{{FrontCenter, 0.5f/9.0f}, {LFE, 0.0f}}} }, - { BackLeft, {{{FrontCenter, 0.5f/9.0f}, {LFE, 0.0f}}} }, - { BackRight, {{{FrontCenter, 0.5f/9.0f}, {LFE, 0.0f}}} }, - { BackCenter, {{{FrontCenter, 1.0f/9.0f}, {LFE, 0.0f}}} }, -}}; const std::array<InputRemixMap,6> StereoDownmix{{ { FrontCenter, {{{FrontLeft, 0.5f}, {FrontRight, 0.5f}}} }, { SideLeft, {{{FrontLeft, 1.0f/9.0f}, {FrontRight, 0.0f}}} }, @@ -1855,17 +1846,6 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), device->Frequency, device->UpdateSize, device->BufferSize); - switch(device->FmtChans) - { - case DevFmtMono: device->RealOut.RemixMap = MonoDownmix; break; - case DevFmtStereo: device->RealOut.RemixMap = StereoDownmix; break; - case DevFmtQuad: device->RealOut.RemixMap = QuadDownmix; break; - case DevFmtX51: device->RealOut.RemixMap = X51Downmix; break; - case DevFmtX61: device->RealOut.RemixMap = X61Downmix; break; - case DevFmtX71: device->RealOut.RemixMap = X71Downmix; break; - case DevFmtAmbi3D: break; - } - if(device->Type != DeviceType::Loopback) { if(auto modeopt = device->configValue<std::string>(nullptr, "stereo-mode")) @@ -1899,6 +1879,20 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) device->SourcesMax, device->NumMonoSources, device->NumStereoSources, device->AuxiliaryEffectSlotMax, device->NumAuxSends); + switch(device->FmtChans) + { + case DevFmtMono: break; + case DevFmtStereo: + if(!device->mUhjEncoder) + device->RealOut.RemixMap = StereoDownmix; + break; + case DevFmtQuad: device->RealOut.RemixMap = QuadDownmix; break; + case DevFmtX51: device->RealOut.RemixMap = X51Downmix; break; + case DevFmtX61: device->RealOut.RemixMap = X61Downmix; break; + case DevFmtX71: device->RealOut.RemixMap = X71Downmix; break; + case DevFmtAmbi3D: break; + } + nanoseconds::rep sample_delay{0}; if(device->mUhjEncoder) sample_delay += UhjEncoder::sFilterDelay; |