summaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-06-29 23:32:48 -0700
committerChris Robinson <[email protected]>2011-06-29 23:32:48 -0700
commit032d0836a74f0e17c99d68e3163f070397123abf (patch)
treeca20e6ee4d0840a2da67f1f368dee108fbd62ae0 /Alc/ALu.c
parent5736bbc3e43145aa59d3e611ad95e4e73fb836df (diff)
Declare some variables closer to where they're used
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 845436a5..0f88d2e3 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -373,14 +373,11 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
ALfloat DryGainHF;
ALfloat WetGain[MAX_SENDS];
ALfloat WetGainHF[MAX_SENDS];
- ALfloat DirGain, AmbientGain;
- const ALfloat *SpeakerGain;
ALfloat Pitch;
- ALfloat length;
ALuint Frequency;
ALint NumSends;
- ALint pos, s, i;
ALfloat cw;
+ ALint i;
DryGainHF = 1.0f;
for(i = 0;i < MAX_SENDS;i++)
@@ -726,6 +723,11 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
else
{
+ ALfloat DirGain, AmbientGain;
+ const ALfloat *SpeakerGain;
+ ALfloat length;
+ ALint pos;
+
length = __max(Distance, MinDist);
if(length > 0.0f)
{
@@ -742,15 +744,15 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
// elevation adjustment for directional gain. this sucks, but
// has low complexity
AmbientGain = aluSqrt(1.0/Device->NumChan);
- for(s = 0;s < MAXCHANNELS;s++)
+ for(i = 0;i < MAXCHANNELS;i++)
{
- ALuint s2;
- for(s2 = 0;s2 < MAXCHANNELS;s2++)
- ALSource->Params.DryGains[s][s2] = 0.0f;
+ ALuint i2;
+ for(i2 = 0;i2 < MAXCHANNELS;i2++)
+ ALSource->Params.DryGains[i][i2] = 0.0f;
}
- for(s = 0;s < (ALsizei)Device->NumChan;s++)
+ for(i = 0;i < (ALint)Device->NumChan;i++)
{
- Channel chan = Device->Speaker2Chan[s];
+ Channel chan = Device->Speaker2Chan[i];
ALfloat gain = lerp(AmbientGain, SpeakerGain[chan], DirGain);
ALSource->Params.DryGains[0][chan] = DryGain * gain;
}