From cf03bfa1565db202c72e2c09ba9d32fd89c0f3b5 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 18 Dec 2007 14:22:59 -0800 Subject: [PATCH] Implement AL_EFFECTSLOT_EFFECT property --- OpenAL32/Include/alAuxEffectSlot.h | 3 +++ OpenAL32/alAuxEffectSlot.c | 40 ++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index e194ab69..26e9822d 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -1,6 +1,7 @@ #ifndef _AL_AUXEFFECTSLOT_H_ #define _AL_AUXEFFECTSLOT_H_ +#include "alEffect.h" #include "AL/al.h" #ifdef __cplusplus @@ -18,6 +19,8 @@ typedef struct ALeffectslot_struct // AuxiliaryEffectSlot type (AL_EFFECT_NULL, ...) ALenum type; + ALeffect effect; + // Index to itself ALuint effectslot; diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 697589ee..8e76984f 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -156,15 +156,31 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param { ALCcontext *Context; - (void)iValue; - Context = alcGetCurrentContext(); SuspendContext(Context); if (alIsAuxiliaryEffectSlot(effectslot)) { + ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslot); + switch(param) { + case AL_EFFECTSLOT_EFFECT: + if(alIsEffect(iValue)) + { + ALeffect *effect = (ALeffect*)ALTHUNK_LOOKUPENTRY(iValue); + if(!effect) + { + ALEffectSlot->effect.type = AL_EFFECT_NULL; + ALEffectSlot->effect.effect = 0; + } + else + memcpy(&ALEffectSlot->effect, effect, sizeof(*effect)); + } + else + alSetError(AL_INVALID_VALUE); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -180,8 +196,6 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum para { ALCcontext *Context; - (void)piValues; - Context = alcGetCurrentContext(); SuspendContext(Context); @@ -189,6 +203,10 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum para { switch(param) { + case AL_EFFECTSLOT_EFFECT: + alAuxiliaryEffectSloti(effectslot, param, piValues[0]); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -252,15 +270,19 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa { ALCcontext *Context; - (void)piValue; - Context = alcGetCurrentContext(); SuspendContext(Context); if (alIsAuxiliaryEffectSlot(effectslot)) { + ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslot); + switch(param) { + case AL_EFFECTSLOT_EFFECT: + *piValue = ALEffectSlot->effect.effect; + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -276,8 +298,6 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p { ALCcontext *Context; - (void)piValues; - Context = alcGetCurrentContext(); SuspendContext(Context); @@ -285,6 +305,10 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p { switch(param) { + case AL_EFFECTSLOT_EFFECT: + alGetAuxiliaryEffectSloti(effectslot, param, piValues); + break; + default: alSetError(AL_INVALID_ENUM); break; -- 2.11.4.GIT