diff options
author | Chris Robinson <[email protected]> | 2007-12-17 22:42:38 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2007-12-17 22:42:38 -0800 |
commit | 168d8e3beee5f809f79f6d0067cd51e25ba65295 (patch) | |
tree | 6015887ebc558845f681206dc26d59931f19acf6 /OpenAL32/alFilter.c | |
parent | 654788f2cf0bc9bf4fe5ee7a1ef61fd3e7b2b650 (diff) |
Add AL_FILTER_LOWPASS support
Direct filters only, since auxiliary sends and slots aren't available yet
Diffstat (limited to 'OpenAL32/alFilter.c')
-rw-r--r-- | OpenAL32/alFilter.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 0167462f..719ccc0a 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -160,8 +160,18 @@ AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue) if (alIsFilter(filter)) { + ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter); + switch(param) { + case AL_FILTER_TYPE: + if(iValue == AL_FILTER_NULL || + iValue == AL_FILTER_LOWPASS) + InitFilterParams(ALFilter, iValue); + else + alSetError(AL_INVALID_VALUE); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -186,6 +196,10 @@ AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValue { switch(param) { + case AL_FILTER_TYPE: + alFilteri(filter, param, piValues[0]); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -208,8 +222,30 @@ AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue if (alIsFilter(filter)) { + ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter); + switch(param) { + case AL_LOWPASS_GAIN: + if(ALFilter->type == AL_FILTER_LOWPASS) + { + if(flValue >= 0.0f && flValue <= 1.0f) + ALFilter->Gain = flValue; + } + else + alSetError(AL_INVALID_ENUM); + break; + + case AL_LOWPASS_GAINHF: + if(ALFilter->type == AL_FILTER_LOWPASS) + { + if(flValue >= 0.0f && flValue <= 1.0f) + ALFilter->GainHF = flValue; + } + else + alSetError(AL_INVALID_ENUM); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -234,6 +270,11 @@ AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflVa { switch(param) { + case AL_LOWPASS_GAIN: + case AL_LOWPASS_GAINHF: + alFilterf(filter, param, pflValues[0]); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -304,8 +345,24 @@ AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pfl if (alIsFilter(filter)) { + ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter); + switch(param) { + case AL_LOWPASS_GAIN: + if(ALFilter->type == AL_FILTER_LOWPASS) + *pflValue = ALFilter->Gain; + else + alSetError(AL_INVALID_ENUM); + break; + + case AL_LOWPASS_GAINHF: + if(ALFilter->type == AL_FILTER_LOWPASS) + *pflValue = ALFilter->GainHF; + else + alSetError(AL_INVALID_ENUM); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -330,6 +387,11 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pf { switch(param) { + case AL_LOWPASS_GAIN: + case AL_LOWPASS_GAINHF: + alGetFilterf(filter, param, pflValues); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -365,4 +427,7 @@ ALvoid ReleaseALFilters(ALvoid) static void InitFilterParams(ALfilter *filter, ALenum type) { filter->type = type; + + filter->Gain = 1.0; + filter->GainHF = 1.0; } |