Implement AL_EFFECTSLOT_EFFECT property

This commit is contained in:
Chris Robinson
2007-12-18 14:22:59 -08:00
parent d4f556836a
commit cf03bfa156
2 changed files with 35 additions and 8 deletions
+3
View File
@@ -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;
+32 -8
View File
@@ -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;