From 35a82970a3c1d175b3d77c5f42d0f720ff2884cb Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 17 Dec 2007 16:28:16 -0800 Subject: Implement AL_DIRECT_FILTER source property Only AL_FILTER_NULL filter types are currently supported, however --- OpenAL32/Include/alSource.h | 3 +++ OpenAL32/alSource.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 54262779..1107bfd9 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -3,6 +3,7 @@ #define AL_NUM_SOURCE_PARAMS 128 +#include "alFilter.h" #include "AL/al.h" #define AL_DIRECT_FILTER 0x20005 @@ -59,6 +60,8 @@ typedef struct ALsource_struct ALuint BuffersPlayed; // Number of buffers played on this loop ALuint BufferPosition; // Read position in audio data of current buffer + ALfilter DirectFilter; + // Index to itself ALuint source; diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index ec8783c3..dd1e482c 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -636,6 +636,22 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) alSetError(AL_INVALID_VALUE); break; + case AL_DIRECT_FILTER: + if(alIsFilter(lValue)) + { + ALfilter *filter = (ALfilter*)ALTHUNK_LOOKUPENTRY(lValue); + if(!filter) + { + pSource->DirectFilter.type = AL_FILTER_NULL; + pSource->DirectFilter.filter = 0; + } + else + memcpy(&pSource->DirectFilter, filter, sizeof(*filter)); + } + else + alSetError(AL_INVALID_VALUE); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -716,6 +732,7 @@ ALAPI void ALAPIENTRY alSourceiv(ALuint source, ALenum eParam, const ALint* plVa case AL_MAX_DISTANCE: case AL_ROLLOFF_FACTOR: case AL_REFERENCE_DISTANCE: + case AL_DIRECT_FILTER: alSourcei(source, eParam, plValues[0]); break; @@ -1044,6 +1061,10 @@ ALAPI ALvoid ALAPIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plValu alSetError(AL_INVALID_OPERATION); break; + case AL_DIRECT_FILTER: + *plValue = pSource->DirectFilter.filter; + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -1153,6 +1174,7 @@ ALAPI void ALAPIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plValue case AL_ROLLOFF_FACTOR: case AL_REFERENCE_DISTANCE: case AL_SOURCE_TYPE: + case AL_DIRECT_FILTER: alGetSourcei(source, eParam, plValues); break; -- cgit v1.2.3