Pass a device to the effect update functions

master
Chris Robinson 2012-03-13 14:49:58 -07:00
parent 55c5e4fe92
commit b5ed2a5351
9 changed files with 14 additions and 18 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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]);
};

View File

@ -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);

View File

@ -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++;
}