From b5ed2a5351c065fb1de5ecc52e3d981458cd2f2c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 13 Mar 2012 14:49:58 -0700 Subject: [PATCH] Pass a device to the effect update functions --- Alc/ALc.c | 2 +- Alc/ALu.c | 4 ++-- Alc/alcDedicated.c | 3 +-- Alc/alcEcho.c | 3 +-- Alc/alcModulator.c | 3 +-- Alc/alcReverb.c | 7 +++---- OpenAL32/Include/alAuxEffectSlot.h | 2 +- OpenAL32/alAuxEffectSlot.c | 6 +++--- OpenAL32/alState.c | 2 +- 9 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index 328443d3..32bcf917 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1307,7 +1307,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) return ALC_INVALID_DEVICE; } slot->NeedsUpdate = AL_FALSE; - ALeffectState_Update(slot->EffectState, context, slot); + ALeffectState_Update(slot->EffectState, device, slot); } UnlockUIntMapRead(&context->EffectSlotMap); diff --git a/Alc/ALu.c b/Alc/ALu.c index f19a78ef..ac68a71c 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -975,7 +975,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) (*slot)->PendingClicks[0] = 0.0f; if(!DeferUpdates && ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) - ALeffectState_Update((*slot)->EffectState, ctx, *slot); + ALeffectState_Update((*slot)->EffectState, device, *slot); ALeffectState_Process((*slot)->EffectState, SamplesToDo, (*slot)->WetBuffer, device->DryBuffer); @@ -1001,7 +1001,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) (*slot)->PendingClicks[0] = 0.0f; if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) - ALeffectState_Update((*slot)->EffectState, ctx, *slot); + ALeffectState_Update((*slot)->EffectState, device, *slot); ALeffectState_Process((*slot)->EffectState, SamplesToDo, (*slot)->WetBuffer, device->DryBuffer); diff --git a/Alc/alcDedicated.c b/Alc/alcDedicated.c index 2f9e3dcc..5bd22a72 100644 --- a/Alc/alcDedicated.c +++ b/Alc/alcDedicated.c @@ -50,10 +50,9 @@ static ALboolean DedicatedDeviceUpdate(ALeffectState *effect, ALCdevice *Device) return AL_TRUE; } -static ALvoid DedicatedUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffectslot *Slot) +static ALvoid DedicatedUpdate(ALeffectState *effect, ALCdevice *device, const ALeffectslot *Slot) { ALdedicatedState *state = (ALdedicatedState*)effect; - ALCdevice *device = Context->Device; const ALfloat *ChannelGain; ALfloat Gain; ALint pos; diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c index 0a8980a0..150720a6 100644 --- a/Alc/alcEcho.c +++ b/Alc/alcEcho.c @@ -90,10 +90,9 @@ static ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device) return AL_TRUE; } -static ALvoid EchoUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffectslot *Slot) +static ALvoid EchoUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { ALechoState *state = (ALechoState*)effect; - ALCdevice *Device = Context->Device; ALuint frequency = Device->Frequency; ALfloat dirGain, ambientGain; const ALfloat *ChannelGain; diff --git a/Alc/alcModulator.c b/Alc/alcModulator.c index 328e1678..2cdbcd0b 100644 --- a/Alc/alcModulator.c +++ b/Alc/alcModulator.c @@ -127,10 +127,9 @@ static ALboolean ModulatorDeviceUpdate(ALeffectState *effect, ALCdevice *Device) (void)Device; } -static ALvoid ModulatorUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffectslot *Slot) +static ALvoid ModulatorUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { ALmodulatorState *state = (ALmodulatorState*)effect; - ALCdevice *Device = Context->Device; ALfloat gain, cw, a = 0.0f; ALuint index; diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c index f21819ef..f11b4ee4 100644 --- a/Alc/alcReverb.c +++ b/Alc/alcReverb.c @@ -1081,10 +1081,10 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection // This updates the EAX reverb state. This is called any time the EAX reverb // effect is loaded into a slot. -static ALvoid ReverbUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffectslot *Slot) +static ALvoid ReverbUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { ALverbState *State = (ALverbState*)effect; - ALuint frequency = Context->Device->Frequency; + ALuint frequency = Device->Frequency; ALboolean isEAX = AL_FALSE; ALfloat cw, x, y, hfRatio; @@ -1154,12 +1154,11 @@ static ALvoid ReverbUpdate(ALeffectState *effect, ALCcontext *Context, const ALe hfRatio, cw, frequency, State); // Update early and late 3D panning. - Update3DPanning(Context->Device, Slot->effect.Reverb.ReflectionsPan, + Update3DPanning(Device, Slot->effect.Reverb.ReflectionsPan, Slot->effect.Reverb.LateReverbPan, Slot->Gain, State); } else { - ALCdevice *Device = Context->Device; ALfloat gain = Slot->Gain; ALuint index; diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 6323f6f5..2d5df671 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -41,7 +41,7 @@ ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context); struct ALeffectState { ALvoid (*Destroy)(ALeffectState *State); ALboolean (*DeviceUpdate)(ALeffectState *State, ALCdevice *Device); - ALvoid (*Update)(ALeffectState *State, ALCcontext *Context, const ALeffectslot *Slot); + ALvoid (*Update)(ALeffectState *State, ALCdevice *Device, const ALeffectslot *Slot); ALvoid (*Process)(ALeffectState *State, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS]); }; diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 38b182df..9668eafe 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -427,10 +427,10 @@ static ALboolean NoneDeviceUpdate(ALeffectState *State, ALCdevice *Device) (void)State; (void)Device; } -static ALvoid NoneUpdate(ALeffectState *State, ALCcontext *Context, const ALeffectslot *Slot) +static ALvoid NoneUpdate(ALeffectState *State, ALCdevice *Device, const ALeffectslot *Slot) { (void)State; - (void)Context; + (void)Device; (void)Slot; } static ALvoid NoneProcess(ALeffectState *State, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS]) @@ -566,7 +566,7 @@ ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect * object was changed, it needs an update before its Process method can * be called. */ EffectSlot->NeedsUpdate = AL_FALSE; - ALeffectState_Update(EffectSlot->EffectState, Context, EffectSlot); + ALeffectState_Update(EffectSlot->EffectState, Context->Device, EffectSlot); UnlockContext(Context); RestoreFPUMode(oldMode); diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index c50df9e6..ec6ee827 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -617,7 +617,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) while(slot != slot_end) { if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) - ALeffectState_Update((*slot)->EffectState, Context, *slot); + ALeffectState_Update((*slot)->EffectState, Context->Device, *slot); slot++; } -- 2.11.4.GIT