diff options
author | Chris Robinson <[email protected]> | 2021-06-24 08:21:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-06-24 08:21:25 -0700 |
commit | 41add6372870278434eeb789176431430ea7690a (patch) | |
tree | d34935d1e998ee83075da374bf162af2edfb2590 /alc | |
parent | 247a149115ef7b0b65e7451b53b321fcd5310ec2 (diff) |
Don't attenuate spatialized multichannel sources
It's inconsistent behavior with spatialized B-Format sources, and causes a very
apparent gain disparity between such a source on the listener compared to just
barely off-origin. It's also not something an app can easy correct for if it
doesn't want that behavior, since the source gain clamps to 1 by default. In
contrast, an app can attenuate sources as they want with little issue.
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alu.cpp | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index 507a5de1..2ab4dcbc 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -734,7 +734,6 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con DirectMode DirectChannels{props->DirectChannels}; const ChanMap *chans{nullptr}; - float downmix_gain{1.0f}; switch(voice->mFmtChannels) { case FmtMono: @@ -752,38 +751,14 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con StereoMap[0].angle = WrapRadians(-props->StereoPan[0]); StereoMap[1].angle = WrapRadians(-props->StereoPan[1]); } - chans = StereoMap; - downmix_gain = 1.0f / 2.0f; - break; - - case FmtRear: - chans = RearMap; - downmix_gain = 1.0f / 2.0f; break; - case FmtQuad: - chans = QuadMap; - downmix_gain = 1.0f / 4.0f; - break; - - case FmtX51: - chans = X51Map; - /* NOTE: Excludes LFE. */ - downmix_gain = 1.0f / 5.0f; - break; - - case FmtX61: - chans = X61Map; - /* NOTE: Excludes LFE. */ - downmix_gain = 1.0f / 6.0f; - break; - - case FmtX71: - chans = X71Map; - /* NOTE: Excludes LFE. */ - downmix_gain = 1.0f / 7.0f; - break; + case FmtRear: chans = RearMap; break; + case FmtQuad: chans = QuadMap; break; + case FmtX51: chans = X51Map; break; + case FmtX61: chans = X61Map; break; + case FmtX71: chans = X71Map; break; case FmtBFormat2D: case FmtBFormat3D: @@ -995,7 +970,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con GetHrtfCoeffs(Device->mHrtf.get(), ev, az, Distance, Spread, voice->mChans[0].mDryParams.Hrtf.Target.Coeffs, voice->mChans[0].mDryParams.Hrtf.Target.Delay); - voice->mChans[0].mDryParams.Hrtf.Target.Gain = DryGain.Base * downmix_gain; + voice->mChans[0].mDryParams.Hrtf.Target.Gain = DryGain.Base; /* Remaining channels use the same results as the first. */ for(size_t c{1};c < num_channels;c++) @@ -1018,7 +993,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con for(uint i{0};i < NumSends;i++) { if(const EffectSlot *Slot{SendSlots[i]}) - ComputePanGains(&Slot->Wet, coeffs.data(), WetGain[i].Base * downmix_gain, + ComputePanGains(&Slot->Wet, coeffs.data(), WetGain[i].Base, voice->mChans[c].mWetParams[i].Gains.Target); } } @@ -1107,12 +1082,12 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con continue; } - ComputePanGains(&Device->Dry, coeffs.data(), DryGain.Base * downmix_gain, + ComputePanGains(&Device->Dry, coeffs.data(), DryGain.Base, voice->mChans[c].mDryParams.Gains.Target); for(uint i{0};i < NumSends;i++) { if(const EffectSlot *Slot{SendSlots[i]}) - ComputePanGains(&Slot->Wet, coeffs.data(), WetGain[i].Base * downmix_gain, + ComputePanGains(&Slot->Wet, coeffs.data(), WetGain[i].Base, voice->mChans[c].mWetParams[i].Gains.Target); } } |