diff options
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 7fad9b90..746ec821 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -343,6 +343,27 @@ ALAPI ALvoid ALAPIENTRY alSourcef(ALuint source, ALenum eParam, ALfloat flValue) alSetError(AL_INVALID_VALUE); break; + case AL_CONE_OUTER_GAINHF: + if ((flValue >= 0.0f) && (flValue <= 1.0f)) + pSource->OuterGainHF = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_AIR_ABSORPTION_FACTOR: + if (flValue >= 0.0f && flValue <= 10.0f) + pSource->AirAbsorptionFactor = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_ROOM_ROLLOFF_FACTOR: + if (flValue >= 0.0f && flValue <= 1.0f) + pSource->RoomRolloffFactor = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + case AL_SEC_OFFSET: case AL_SAMPLE_OFFSET: case AL_BYTE_OFFSET: @@ -463,9 +484,12 @@ ALAPI ALvoid ALAPIENTRY alSourcefv(ALuint source, ALenum eParam, const ALfloat * case AL_MIN_GAIN: case AL_MAX_GAIN: case AL_CONE_OUTER_GAIN: + case AL_CONE_OUTER_GAINHF: case AL_SEC_OFFSET: case AL_SAMPLE_OFFSET: case AL_BYTE_OFFSET: + case AL_AIR_ABSORPTION_FACTOR: + case AL_ROOM_ROLLOFF_FACTOR: alSourcef(source, eParam, pflValues[0]); break; @@ -638,6 +662,43 @@ 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; + + case AL_DIRECT_FILTER_GAINHF_AUTO: + if(lValue == AL_TRUE || lValue == AL_FALSE) + pSource->DryGainHFAuto = lValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: + if(lValue == AL_TRUE || lValue == AL_FALSE) + pSource->WetGainAuto = lValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: + if(lValue == AL_TRUE || lValue == AL_FALSE) + pSource->WetGainHFAuto = lValue; + else + alSetError(AL_INVALID_VALUE); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -666,6 +727,8 @@ ALAPI void ALAPIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, AL if (alIsSource(source)) { + ALsource *pSource = ((ALsource *)ALTHUNK_LOOKUPENTRY(source)); + switch (eParam) { case AL_POSITION: @@ -674,6 +737,35 @@ ALAPI void ALAPIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, AL alSource3f(source, eParam, (ALfloat)lValue1, (ALfloat)lValue2, (ALfloat)lValue3); break; + case AL_AUXILIARY_SEND_FILTER: + if(lValue2 >= 0 && lValue2 < MAX_SENDS && + (alIsAuxiliaryEffectSlot(lValue1) || lValue1 == 0) && + alIsFilter(lValue3)) + { + ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(lValue1); + ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(lValue3); + + if(!ALEffectSlot) + { + /* Disable slot */ + pSource->Send[lValue2].Slot.effectslot = 0; + } + else + memcpy(&pSource->Send[lValue2].Slot, ALEffectSlot, sizeof(*ALEffectSlot)); + + if(!ALFilter) + { + /* Disable filter */ + pSource->Send[lValue2].WetFilter.type = 0; + pSource->Send[lValue2].WetFilter.filter = 0; + } + else + memcpy(&pSource->Send[lValue2].WetFilter, ALFilter, sizeof(*ALFilter)); + } + else + alSetError(AL_INVALID_VALUE); + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -718,12 +810,17 @@ 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: + case AL_DIRECT_FILTER_GAINHF_AUTO: + case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: + case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: alSourcei(source, eParam, plValues[0]); break; case AL_POSITION: case AL_VELOCITY: case AL_DIRECTION: + case AL_AUXILIARY_SEND_FILTER: alSource3i(source, eParam, plValues[0], plValues[1], plValues[2]); break; @@ -794,6 +891,10 @@ ALAPI ALvoid ALAPIENTRY alGetSourcef(ALuint source, ALenum eParam, ALfloat *pflV *pflValue = pSource->flOuterGain; break; + case AL_CONE_OUTER_GAINHF: + *pflValue = pSource->OuterGainHF; + break; + case AL_SEC_OFFSET: case AL_SAMPLE_OFFSET: case AL_BYTE_OFFSET: @@ -815,6 +916,14 @@ ALAPI ALvoid ALAPIENTRY alGetSourcef(ALuint source, ALenum eParam, ALfloat *pflV *pflValue = pSource->flRefDistance; break; + case AL_AIR_ABSORPTION_FACTOR: + *pflValue = pSource->AirAbsorptionFactor; + break; + + case AL_ROOM_ROLLOFF_FACTOR: + *pflValue = pSource->RoomRolloffFactor; + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -922,6 +1031,9 @@ ALAPI ALvoid ALAPIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *pfl case AL_CONE_INNER_ANGLE: case AL_CONE_OUTER_ANGLE: case AL_REFERENCE_DISTANCE: + case AL_CONE_OUTER_GAINHF: + case AL_AIR_ABSORPTION_FACTOR: + case AL_ROOM_ROLLOFF_FACTOR: alGetSourcef(source, eParam, pflValues); break; @@ -1046,6 +1158,22 @@ ALAPI ALvoid ALAPIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plValu alSetError(AL_INVALID_OPERATION); break; + case AL_DIRECT_FILTER: + *plValue = pSource->DirectFilter.filter; + break; + + case AL_DIRECT_FILTER_GAINHF_AUTO: + *plValue = pSource->DryGainHFAuto; + break; + + case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: + *plValue = pSource->WetGainAuto; + break; + + case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: + *plValue = pSource->WetGainHFAuto; + break; + default: alSetError(AL_INVALID_ENUM); break; @@ -1155,6 +1283,10 @@ 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: + case AL_DIRECT_FILTER_GAINHF_AUTO: + case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: + case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: alGetSourcei(source, eParam, plValues); break; @@ -1832,6 +1964,11 @@ static ALvoid InitSourceParams(ALsource *pSource) pSource->flMaxGain = 1.0f; pSource->flOuterGain = 0.0f; + pSource->DryGainHFAuto = AL_TRUE; + pSource->WetGainAuto = AL_TRUE; + pSource->WetGainHFAuto = AL_TRUE; + pSource->AirAbsorptionFactor = 0.0f; + pSource->state = AL_INITIAL; pSource->lSourceType = AL_UNDETERMINED; |