aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-08-06 07:55:00 -0700
committerChris Robinson <[email protected]>2010-08-06 07:55:00 -0700
commit044662e4b709e0c446e16a849088c418c91d205c (patch)
treee79f7844862e52cb008b1a32d73fdf656d32afb4 /Alc/mixer.c
parentd9d8319c22236ec8b3eebaa5bd68d51ca7677249 (diff)
Calculate gain steps once during a source mix
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r--Alc/mixer.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 4907c72e..54ec28be 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -119,9 +119,6 @@ static void MixSource(ALsource *ALSource, ALCcontext *ALContext,
DeviceFreq = ALContext->Device->Frequency;
- rampLength = DeviceFreq * MIN_RAMP_LENGTH / 1000;
- rampLength = max(rampLength, SamplesToDo);
-
/* Find buffer format */
Frequency = 0;
Channels = 0;
@@ -175,6 +172,17 @@ static void MixSource(ALsource *ALSource, ALCcontext *ALContext,
WetSend[i] = ALSource->WetGains[i];
}
+ /* Compute the gain steps for each output channel */
+ rampLength = DeviceFreq * MIN_RAMP_LENGTH / 1000;
+ rampLength = max(rampLength, SamplesToDo);
+
+ for(i = 0;i < OUTPUTCHANNELS;i++)
+ dryGainStep[i] = (ALSource->Params.DryGains[i]-DrySend[i]) /
+ rampLength;
+ for(i = 0;i < MAX_SENDS;i++)
+ wetGainStep[i] = (ALSource->Params.WetGains[i]-WetSend[i]) /
+ rampLength;
+
DryFilter = &ALSource->Params.iirFilter;
for(i = 0;i < MAX_SENDS;i++)
{
@@ -247,14 +255,6 @@ static void MixSource(ALsource *ALSource, ALCcontext *ALContext,
else
memset(&Data[DataSize*Channels], 0, (BUFFER_PADDING*Channels*Bytes));
- /* Compute the gain steps for each output channel */
- for(i = 0;i < OUTPUTCHANNELS;i++)
- dryGainStep[i] = (ALSource->Params.DryGains[i]-DrySend[i]) /
- rampLength;
- for(i = 0;i < MAX_SENDS;i++)
- wetGainStep[i] = (ALSource->Params.WetGains[i]-WetSend[i]) /
- rampLength;
-
/* Figure out how many samples we can mix. */
DataSize64 = LoopEnd;
DataSize64 <<= FRACTIONBITS;