aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-09-12 00:10:33 -0700
committerChris Robinson <[email protected]>2010-09-12 00:10:33 -0700
commit8a0e15ff37b3eb8e010b9da32d85120e4ef2e8cc (patch)
tree46b4c9c636862c94154c2963323ebe375e7c934f /Alc
parent8953a73fb16e80d3309912f56c4ecd62045967ec (diff)
Store air absorption factor locally
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 5f104991..d54b9f09 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -264,6 +264,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
ALfloat MinVolume,MaxVolume,MinDist,MaxDist,Rolloff,OuterGainHF;
ALfloat ConeVolume,ConeHF,SourceVolume,ListenerGain;
ALfloat DopplerFactor, DopplerVelocity, flSpeedOfSound;
+ ALfloat AirAbsorptionFactor;
ALbufferlistitem *BufferListItem;
ALfloat Matrix[4][4];
ALfloat flAttenuation, effectiveDist;
@@ -310,6 +311,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
InnerAngle = ALSource->flInnerAngle;
OuterAngle = ALSource->flOuterAngle;
OuterGainHF = ALSource->OuterGainHF;
+ AirAbsorptionFactor = ALSource->AirAbsorptionFactor;
//1. Translate Listener to origin (convert to head relative)
if(ALSource->bHeadRelative==AL_FALSE)
@@ -432,12 +434,12 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
effectiveDist = (MinDist/flAttenuation - MinDist)*MetersPerUnit;
// Distance-based air absorption
- if(ALSource->AirAbsorptionFactor > 0.0f && effectiveDist > 0.0f)
+ if(AirAbsorptionFactor > 0.0f && effectiveDist > 0.0f)
{
ALfloat absorb;
// Absorption calculation is done in dB
- absorb = (ALSource->AirAbsorptionFactor*AIRABSORBGAINDBHF) *
+ absorb = (AirAbsorptionFactor*AIRABSORBGAINDBHF) *
effectiveDist;
// Convert dB to linear gain before applying
absorb = aluPow(10.0f, absorb/20.0f);
@@ -525,7 +527,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
WetGainHF[i] *= aluPow(10.0f,
log10(Slot->effect.Reverb.AirAbsorptionGainHF) *
- ALSource->AirAbsorptionFactor * effectiveDist);
+ AirAbsorptionFactor * effectiveDist);
}
}
else