Skip to content

Commit

Permalink
Don't apply distance attenuation when the slot's AuxSendAuto is off
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Sep 16, 2024
1 parent 8dd5ad8 commit 7c1aca7
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions alc/alu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,15 @@ bool CalcEffectSlotParams(EffectSlot *slot, EffectSlot **sorted_slots, ContextBa
slot->Target = props->Target;
slot->EffectType = props->Type;
slot->mEffectProps = props->Props;
if(auto *reverbprops = std::get_if<ReverbProps>(&props->Props))
/* If this effect slot's Auxiliary Send Auto is off, don't apply the
* automatic send adjustments based on source distance.
*
* NOTE: Generic Software applies the adjustments regardless of this
* setting. It doesn't seem to use the flag for anything, only the source's
* send filter gain auto flag affects this.
*/
if(auto *reverbprops = std::get_if<ReverbProps>(&props->Props);
reverbprops && slot->AuxSendAuto)
{
slot->RoomRolloff = reverbprops->RoomRolloffFactor;
slot->DecayTime = reverbprops->DecayTime;
Expand Down Expand Up @@ -1725,16 +1733,6 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ContextBa
if(absorb > std::numeric_limits<float>::epsilon())
WetGain[i].HF *= std::pow(SendSlots[i]->AirAbsorptionGainHF, absorb);

/* If this effect slot's Auxiliary Send Auto is off, don't apply
* the automatic initial reverb decay.
*
* NOTE: Generic Software applies the initial decay regardless of
* this setting. It doesn't seem to use it for anything, only the
* source's send filter gain auto flag affects this.
*/
if(!SendSlots[i]->AuxSendAuto)
continue;

const float DecayDistance{SendSlots[i]->DecayTime * SpeedOfSoundMetersPerSec};

/* Apply a decay-time transformation to the wet path, based on the
Expand Down

0 comments on commit 7c1aca7

Please sign in to comment.