aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-04-11 20:27:55 -0700
committerChris Robinson <[email protected]>2009-04-11 20:27:55 -0700
commit65b69f33085ac9381f683e92655acba0e4622675 (patch)
treed60a8ed6615acb91f851b52dc441dd21963b893f /Alc
parentc67fbd72dd9cb2dcc21b690c94ff8dc39bc0d34a (diff)
Fix air absorption
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index b3f99ef7..ea2f6526 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -710,8 +710,21 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext,
break;
}
+ // Source Gain + Attenuation and clamp to Min/Max Gain
+ DryMix = SourceVolume * flAttenuation;
+ DryMix = __min(DryMix,MaxVolume);
+ DryMix = __max(DryMix,MinVolume);
+
+ for(i = 0;i < MAX_SENDS;i++)
+ {
+ ALfloat WetMix = SourceVolume * RoomAttenuation[i];
+ WetMix = __min(WetMix,MaxVolume);
+ wetsend[i] = __max(WetMix,MinVolume);
+ wetgainhf[i] = 1.0f;
+ }
+
// Distance-based air absorption
- if(ALSource->AirAbsorptionFactor > 0.0f && ALContext->DistanceModel != AL_NONE)
+ if(ALSource->AirAbsorptionFactor > 0.0f && ALSource->DistanceModel != AL_NONE)
{
ALfloat dist = Distance-MinDist;
ALfloat absorb;
@@ -727,19 +740,6 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext,
wetgainhf[i] *= absorb;
}
- // Source Gain + Attenuation and clamp to Min/Max Gain
- DryMix = SourceVolume * flAttenuation;
- DryMix = __min(DryMix,MaxVolume);
- DryMix = __max(DryMix,MinVolume);
-
- for(i = 0;i < MAX_SENDS;i++)
- {
- ALfloat WetMix = SourceVolume * RoomAttenuation[i];
- WetMix = __min(WetMix,MaxVolume);
- wetsend[i] = __max(WetMix,MinVolume);
- wetgainhf[i] = 1.0f;
- }
-
//3. Apply directional soundcones
Angle = aluAcos(aluDotproduct(Direction,SourceToListener)) * 180.0f/M_PI;
if(Angle >= InnerAngle && Angle <= OuterAngle)