aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-01-16 12:43:25 -0800
committerChris Robinson <[email protected]>2008-01-16 12:43:25 -0800
commit10a9bc62bf859ad3b97be9bda36fb0a737175774 (patch)
tree1ca86f060ddd4dbc1ad747c4b7afce18fdd89aa6 /Alc
parent8cbbf17519193ddf8f49678a77e92088f5778d69 (diff)
Store a reference to the effect slot in a source's send, not a copy
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index dda46631..0c02b778 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -259,7 +259,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
ALfloat *pitch, ALfloat *drygainhf,
ALfloat *wetgainhf)
{
- ALfloat InnerAngle,OuterAngle,Angle,Distance,DryMix,WetMix;
+ ALfloat InnerAngle,OuterAngle,Angle,Distance,DryMix,WetMix=0.0f;
ALfloat Direction[3],Position[3],SourceToListener[3];
ALfloat MinVolume,MaxVolume,MinDist,MaxDist,Rolloff,OuterGainHF;
ALfloat ConeVolume,SourceVolume,PanningFB,PanningLR,ListenerGain;
@@ -368,9 +368,10 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
// Source Gain + Attenuation
DryMix = SourceVolume * flAttenuation;
- WetMix = SourceVolume * ((ALSource->WetGainAuto &&
- ALSource->Send[0].Slot.AuxSendAuto) ?
- RoomAttenuation : 1.0f);
+ if(ALSource->Send[0].Slot)
+ WetMix = SourceVolume * ((ALSource->WetGainAuto &&
+ ALSource->Send[0].Slot->AuxSendAuto) ?
+ RoomAttenuation : 1.0f);
// Clamp to Min/Max Gain
DryMix = __min(DryMix,MaxVolume);
@@ -470,7 +471,8 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
DryGainHF *= pow(ALSource->AirAbsorptionFactor * AIRABSORBGAINHF,
Distance * MetersPerUnit);
- WetMix *= ALSource->Send[0].Slot.Gain;
+ if(ALSource->Send[0].Slot)
+ WetMix *= ALSource->Send[0].Slot->Gain;
//7. Convert normalized position into pannings, then into channel volumes
aluNormalize(Position);
@@ -479,7 +481,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
case 1:
drysend[FRONT_LEFT] = ConeVolume * ListenerGain * DryMix * aluSqrt(1.0f); //Direct
drysend[FRONT_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(1.0f); //Direct
- if(ALSource->Send[0].Slot.effectslot)
+ if(ALSource->Send[0].Slot)
{
wetsend[FRONT_LEFT] = ListenerGain * WetMix * aluSqrt(1.0f); //Room
wetsend[FRONT_RIGHT] = ListenerGain * WetMix * aluSqrt(1.0f); //Room
@@ -495,7 +497,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
PanningLR = 0.5f + 0.5f*Position[0];
drysend[FRONT_LEFT] = ConeVolume * ListenerGain * DryMix * aluSqrt(1.0f-PanningLR); //L Direct
drysend[FRONT_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt( PanningLR); //R Direct
- if(ALSource->Send[0].Slot.effectslot)
+ if(ALSource->Send[0].Slot)
{
wetsend[FRONT_LEFT] = ListenerGain * WetMix * aluSqrt(1.0f-PanningLR); //L Room
wetsend[FRONT_RIGHT] = ListenerGain * WetMix * aluSqrt( PanningLR); //R Room
@@ -521,7 +523,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
drysend[FRONT_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*(1.0f-PanningFB));
drysend[BACK_LEFT] = ConeVolume * ListenerGain * DryMix * aluSqrt((1.0f-PanningLR)*( PanningFB));
drysend[BACK_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*( PanningFB));
- if(ALSource->Send[0].Slot.effectslot)
+ if(ALSource->Send[0].Slot)
{
wetsend[FRONT_LEFT] = ListenerGain * WetMix * aluSqrt((1.0f-PanningLR)*(1.0f-PanningFB));
wetsend[FRONT_RIGHT] = ListenerGain * WetMix * aluSqrt(( PanningLR)*(1.0f-PanningFB));
@@ -553,7 +555,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
drysend[SIDE_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*( PanningFB));
drysend[FRONT_LEFT] = 0.0f;
drysend[FRONT_RIGHT] = 0.0f;
- if(ALSource->Send[0].Slot.effectslot)
+ if(ALSource->Send[0].Slot)
{
wetsend[BACK_LEFT] = ListenerGain * WetMix * aluSqrt((1.0f-PanningLR)*(1.0f-PanningFB));
wetsend[BACK_RIGHT] = ListenerGain * WetMix * aluSqrt(( PanningLR)*(1.0f-PanningFB));
@@ -581,7 +583,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
drysend[SIDE_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*( PanningFB));
drysend[BACK_LEFT] = 0.0f;
drysend[BACK_RIGHT] = 0.0f;
- if(ALSource->Send[0].Slot.effectslot)
+ if(ALSource->Send[0].Slot)
{
wetsend[FRONT_LEFT] = ListenerGain * WetMix * aluSqrt((1.0f-PanningLR)*(1.0f-PanningFB));
wetsend[FRONT_RIGHT] = ListenerGain * WetMix * aluSqrt(( PanningLR)*(1.0f-PanningFB));
@@ -622,7 +624,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
drysend[BACK_RIGHT] = SourceVolume * 1.0f * ListenerGain;
drysend[CENTER] = SourceVolume * 1.0f * ListenerGain;
drysend[LFE] = SourceVolume * 1.0f * ListenerGain;
- if(ALSource->Send[0].Slot.effectslot)
+ if(ALSource->Send[0].Slot)
{
wetsend[FRONT_LEFT] = SourceVolume * 0.0f * ListenerGain;
wetsend[FRONT_RIGHT] = SourceVolume * 0.0f * ListenerGain;