diff options
author | Chris Robinson <[email protected]> | 2009-11-05 18:22:43 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-11-05 18:22:43 -0800 |
commit | aa84b2e3284f06f3e16de4ec12b8d2e3a11d64a0 (patch) | |
tree | 80a5e3300362b591f9563cc7d44514ecaa505093 | |
parent | ebc1602816b844b5fc7cab7e09e191b655763800 (diff) |
Handle setting AL_EFFECT_NULL effect types on a slot
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 7a9c6326..a0bea3a3 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -414,6 +414,47 @@ ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, A } +static ALvoid NoneDestroy(ALeffectState *State) +{ free(State); } +static ALboolean NoneDeviceUpdate(ALeffectState *State, ALCdevice *Device) +{ + return AL_TRUE; + (void)State; + (void)Device; +} +static ALvoid NoneUpdate(ALeffectState *State, ALCcontext *Context, const ALeffect *Effect) +{ + (void)State; + (void)Context; + (void)Effect; +} +static ALvoid NoneProcess(ALeffectState *State, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS]) +{ + (void)State; + (void)Slot; + (void)SamplesToDo; + (void)SamplesIn; + (void)SamplesOut; +} +static ALeffectState *NoneCreate(void) +{ + ALeffectState *state; + + state = calloc(1, sizeof(*state)); + if(!state) + { + alSetError(AL_OUT_OF_MEMORY); + return NULL; + } + + state->Destroy = NoneDestroy; + state->DeviceUpdate = NoneDeviceUpdate; + state->Update = NoneUpdate; + state->Process = NoneProcess; + + return state; +} + static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, ALeffect *effect) { if((!effect) || (effect->type != ALEffectSlot->effect.type)) @@ -427,6 +468,8 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, NewState = VerbCreate(); else if(effect->type == AL_EFFECT_ECHO) NewState = EchoCreate(); + else if(effect->type == AL_EFFECT_NULL) + NewState = NoneCreate(); /* No new state? An error occured.. */ if(NewState == NULL || ALEffect_DeviceUpdate(NewState, Context->Device) == AL_FALSE) |