From 75fa891e0a4d00739a8a0ddd037782f99f22a578 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 5 Jul 2011 14:14:20 -0700 Subject: Store and use the send slot in the source params --- Alc/ALu.c | 5 +++++ Alc/mixer.c | 20 ++++++++++---------- OpenAL32/Include/alSource.h | 1 + 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index 83017cbc..ffaace7d 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -323,8 +323,11 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) } } for(i = 0;i < NumSends;i++) + { + ALSource->Params.Send[i].Slot = ALSource->Send[i].Slot; ALSource->Params.Send[i].WetGain = WetGain[i] * ListenerGain / ALSource->NumChannels; + } /* Update filter coefficients. Calculations based on the I3DL2 * spec. */ @@ -444,6 +447,8 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) WetGainAuto = AL_TRUE; WetGainHFAuto = DryGainHFAuto; } + + ALSource->Params.Send[i].Slot = Slot; } //1. Translate Listener to origin (convert to head relative) diff --git a/Alc/mixer.c b/Alc/mixer.c index 4caca6e2..df0480aa 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -168,19 +168,19 @@ static void Mix_Hrtf_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ \ for(out = 0;out < Device->NumAuxSends;out++) \ { \ + ALeffectslot *Slot = Source->Params.Send[i].Slot; \ ALfloat WetSend; \ ALfloat *RESTRICT WetBuffer; \ ALfloat *RESTRICT WetClickRemoval; \ ALfloat *RESTRICT WetPendingClicks; \ FILTER *WetFilter; \ \ - if(!Source->Send[out].Slot || \ - Source->Send[out].Slot->effect.type == AL_EFFECT_NULL) \ + if(!Slot || Slot->effect.type == AL_EFFECT_NULL) \ continue; \ \ - WetBuffer = Source->Send[out].Slot->WetBuffer; \ - WetClickRemoval = Source->Send[out].Slot->ClickRemoval; \ - WetPendingClicks = Source->Send[out].Slot->PendingClicks; \ + WetBuffer = Slot->WetBuffer; \ + WetClickRemoval = Slot->ClickRemoval; \ + WetPendingClicks = Slot->PendingClicks; \ WetFilter = &Source->Params.Send[out].iirFilter; \ WetSend = Source->Params.Send[out].WetGain; \ \ @@ -308,19 +308,19 @@ static void Mix_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ \ for(out = 0;out < Device->NumAuxSends;out++) \ { \ + ALeffectslot *Slot = Source->Params.Send[i].Slot; \ ALfloat WetSend; \ ALfloat *WetBuffer; \ ALfloat *WetClickRemoval; \ ALfloat *WetPendingClicks; \ FILTER *WetFilter; \ \ - if(!Source->Send[out].Slot || \ - Source->Send[out].Slot->effect.type == AL_EFFECT_NULL) \ + if(!Slot || Slot->effect.type == AL_EFFECT_NULL) \ continue; \ \ - WetBuffer = Source->Send[out].Slot->WetBuffer; \ - WetClickRemoval = Source->Send[out].Slot->ClickRemoval; \ - WetPendingClicks = Source->Send[out].Slot->PendingClicks; \ + WetBuffer = Slot->WetBuffer; \ + WetClickRemoval = Slot->ClickRemoval; \ + WetPendingClicks = Slot->PendingClicks; \ WetFilter = &Source->Params.Send[out].iirFilter; \ WetSend = Source->Params.Send[out].WetGain; \ \ diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index d6c3793f..df2b7cd4 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -108,6 +108,7 @@ typedef struct ALsource ALfloat history[MAXCHANNELS*2]; struct { + struct ALeffectslot *Slot; ALfloat WetGain; FILTER iirFilter; ALfloat history[MAXCHANNELS]; -- cgit v1.2.3