aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-17 01:54:09 -0700
committerChris Robinson <[email protected]>2011-08-17 01:54:09 -0700
commit2f8510db31690d2d0facbad25921d780a97ae31f (patch)
treef08b2c45b4d5846811b69f7f91ae8f565425e319 /Alc
parent38a4d9a6c5f312fc37418c21b416cc3f8c379205 (diff)
Avoid reading some more source parameters multiple times when updating
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 00620f96..f9843944 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -118,6 +118,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
const ALfloat *SpeakerGain;
const ALfloat *angles = NULL;
const enum Channel *chans = NULL;
+ enum Resampler Resampler;
ALint num_channels = 0;
ALboolean VirtualChannels;
ALfloat Pitch;
@@ -138,6 +139,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
MinVolume = ALSource->flMinGain;
MaxVolume = ALSource->flMaxGain;
Pitch = ALSource->flPitch;
+ Resampler = ALSource->Resampler;
VirtualChannels = ALSource->VirtualChannels;
/* Calculate the stepping value */
@@ -150,8 +152,8 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
{
ALint maxstep = STACK_DATA_SIZE / ALSource->NumChannels /
ALSource->SampleSize;
- maxstep -= ResamplerPadding[ALSource->Resampler] +
- ResamplerPrePadding[ALSource->Resampler] + 1;
+ maxstep -= ResamplerPadding[Resampler] +
+ ResamplerPrePadding[Resampler] + 1;
maxstep = mini(maxstep, INT_MAX>>FRACTIONBITS);
Pitch = Pitch * ALBuffer->Frequency / Frequency;
@@ -169,11 +171,11 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
if(ALSource->VirtualChannels && (Device->Flags&DEVICE_USE_HRTF))
ALSource->Params.DoMix = SelectHrtfMixer(ALBuffer,
(ALSource->Params.Step==FRACTIONONE) ? POINT_RESAMPLER :
- ALSource->Resampler);
+ Resampler);
else
ALSource->Params.DoMix = SelectMixer(ALBuffer,
(ALSource->Params.Step==FRACTIONONE) ? POINT_RESAMPLER :
- ALSource->Resampler);
+ Resampler);
break;
}
BufferListItem = BufferListItem->next;
@@ -370,6 +372,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
ALfloat WetGainHF[MAX_SENDS];
ALboolean WetGainAuto;
ALboolean WetGainHFAuto;
+ enum Resampler Resampler;
ALfloat Pitch;
ALuint Frequency;
ALint NumSends;
@@ -396,6 +399,8 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
SourceVolume = ALSource->flGain;
MinVolume = ALSource->flMinGain;
MaxVolume = ALSource->flMaxGain;
+ Pitch = ALSource->flPitch;
+ Resampler = ALSource->Resampler;
memcpy(Position, ALSource->vPosition, sizeof(ALSource->vPosition));
memcpy(Direction, ALSource->vOrientation, sizeof(ALSource->vOrientation));
memcpy(Velocity, ALSource->vVelocity, sizeof(ALSource->vVelocity));
@@ -644,7 +649,6 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
// Calculate Velocity
- Pitch = ALSource->flPitch;
if(DopplerFactor != 0.0f)
{
ALfloat VSS, VLS;
@@ -675,8 +679,8 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
{
ALint maxstep = STACK_DATA_SIZE / ALSource->NumChannels /
ALSource->SampleSize;
- maxstep -= ResamplerPadding[ALSource->Resampler] +
- ResamplerPrePadding[ALSource->Resampler] + 1;
+ maxstep -= ResamplerPadding[Resampler] +
+ ResamplerPrePadding[Resampler] + 1;
maxstep = mini(maxstep, INT_MAX>>FRACTIONBITS);
Pitch = Pitch * ALBuffer->Frequency / Frequency;
@@ -689,11 +693,14 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
ALSource->Params.Step = 1;
}
- ALSource->Params.DoMix = ((Device->Flags&DEVICE_USE_HRTF) ?
- SelectHrtfMixer(ALBuffer, (ALSource->Params.Step==FRACTIONONE) ?
- POINT_RESAMPLER : ALSource->Resampler) :
- SelectMixer(ALBuffer, (ALSource->Params.Step==FRACTIONONE) ?
- POINT_RESAMPLER : ALSource->Resampler));
+ if((Device->Flags&DEVICE_USE_HRTF))
+ ALSource->Params.DoMix = SelectHrtfMixer(ALBuffer,
+ (ALSource->Params.Step==FRACTIONONE) ? POINT_RESAMPLER :
+ Resampler);
+ else
+ ALSource->Params.DoMix = SelectMixer(ALBuffer,
+ (ALSource->Params.Step==FRACTIONONE) ? POINT_RESAMPLER :
+ Resampler);
break;
}
BufferListItem = BufferListItem->next;