aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-31 02:18:16 -0700
committerChris Robinson <[email protected]>2011-08-31 02:18:16 -0700
commitb28f48c1bdf343ecc0a3e1dbed958b13fbba32e7 (patch)
tree36949865561b5f06b0d39569e47b807d94e9931d /Alc/ALu.c
parent49e2fa428fced4d2ab1e390ad3397dd9e11df960 (diff)
Store the filter gains directly in the source instead of duplicate filter objects
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c44
1 files changed, 10 insertions, 34 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index f2658da7..1819c80e 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -182,26 +182,14 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
/* Calculate gains */
- DryGain = clampf(SourceVolume, MinVolume, MaxVolume);
- DryGainHF = 1.0f;
- switch(ALSource->DirectFilter.type)
- {
- case AL_FILTER_LOWPASS:
- DryGain *= ALSource->DirectFilter.Gain;
- DryGainHF *= ALSource->DirectFilter.GainHF;
- break;
- }
+ DryGain = clampf(SourceVolume, MinVolume, MaxVolume);
+ DryGain *= ALSource->DirectGain;
+ DryGainHF = ALSource->DirectGainHF;
for(i = 0;i < NumSends;i++)
{
- WetGain[i] = clampf(SourceVolume, MinVolume, MaxVolume);
- WetGainHF[i] = 1.0f;
- switch(ALSource->Send[i].WetFilter.type)
- {
- case AL_FILTER_LOWPASS:
- WetGain[i] *= ALSource->Send[i].WetFilter.Gain;
- WetGainHF[i] *= ALSource->Send[i].WetFilter.GainHF;
- break;
- }
+ WetGain[i] = clampf(SourceVolume, MinVolume, MaxVolume);
+ WetGain[i] *= ALSource->Send[i].WetGain;
+ WetGainHF[i] = WetGainHF[i] *= ALSource->Send[i].WetGainHF;
}
SrcMatrix = ALSource->Params.DryGains;
@@ -610,24 +598,12 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
WetGain[i] = clampf(WetGain[i], MinVolume, MaxVolume);
// Apply filter gains and filters
- switch(ALSource->DirectFilter.type)
- {
- case AL_FILTER_LOWPASS:
- DryGain *= ALSource->DirectFilter.Gain;
- DryGainHF *= ALSource->DirectFilter.GainHF;
- break;
- }
- DryGain *= ListenerGain;
+ DryGain *= ALSource->DirectGain * ListenerGain;
+ DryGainHF *= ALSource->DirectGainHF;
for(i = 0;i < NumSends;i++)
{
- switch(ALSource->Send[i].WetFilter.type)
- {
- case AL_FILTER_LOWPASS:
- WetGain[i] *= ALSource->Send[i].WetFilter.Gain;
- WetGainHF[i] *= ALSource->Send[i].WetFilter.GainHF;
- break;
- }
- WetGain[i] *= ListenerGain;
+ WetGain[i] *= ALSource->Send[i].WetGain * ListenerGain;
+ WetGainHF[i] *= ALSource->Send[i].WetGainHF;
}
if(WetGainAuto)