From b734cab6fcbd7d3338c04fd9a90f6dca39ef2827 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 10 Mar 2010 07:33:30 -0800 Subject: Fix the retrieval of the RW offsets using the correct functions --- OpenAL32/alSource.c | 61 +++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'OpenAL32/alSource.c') diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 2fd1ad15..a2375d49 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -901,20 +901,6 @@ ALAPI ALvoid ALAPIENTRY alGetSourcef(ALuint source, ALenum eParam, ALfloat *pflV alSetError(AL_INVALID_OPERATION); break; - case AL_SEC_RW_OFFSETS_EXT: - case AL_SAMPLE_RW_OFFSETS_EXT: - case AL_BYTE_RW_OFFSETS_EXT: - updateLen = (ALfloat)pContext->Device->UpdateSize / - pContext->Device->Frequency; - if(GetSourceOffset(pSource, eParam, flOffset, updateLen)) - { - pflValue[0] = flOffset[0]; - pflValue[1] = flOffset[1]; - } - else - alSetError(AL_INVALID_OPERATION); - break; - case AL_CONE_INNER_ANGLE: *pflValue = pSource->flInnerAngle; break; @@ -1005,8 +991,10 @@ ALAPI ALvoid ALAPIENTRY alGetSource3f(ALuint source, ALenum eParam, ALfloat* pfl ALAPI ALvoid ALAPIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *pflValues) { - ALCcontext *pContext; + ALCcontext *pContext; ALsource *pSource; + ALfloat flOffset[2]; + ALfloat updateLen; pContext = GetContextSuspended(); if(!pContext) return; @@ -1039,6 +1027,19 @@ ALAPI ALvoid ALAPIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *pfl alGetSourcef(source, eParam, pflValues); break; + case AL_SAMPLE_RW_OFFSETS_EXT: + case AL_BYTE_RW_OFFSETS_EXT: + updateLen = (ALfloat)pContext->Device->UpdateSize / + pContext->Device->Frequency; + if(GetSourceOffset(pSource, eParam, flOffset, updateLen)) + { + pflValues[0] = flOffset[0]; + pflValues[1] = flOffset[1]; + } + else + alSetError(AL_INVALID_OPERATION); + break; + case AL_POSITION: pflValues[0] = pSource->vPosition[0]; pflValues[1] = pSource->vPosition[1]; @@ -1156,20 +1157,6 @@ ALAPI ALvoid ALAPIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plValu alSetError(AL_INVALID_OPERATION); break; - case AL_SEC_RW_OFFSETS_EXT: - case AL_SAMPLE_RW_OFFSETS_EXT: - case AL_BYTE_RW_OFFSETS_EXT: - updateLen = (ALfloat)pContext->Device->UpdateSize / - pContext->Device->Frequency; - if(GetSourceOffset(pSource, eParam, flOffset, updateLen)) - { - plValue[0] = (ALint)flOffset[0]; - plValue[1] = (ALint)flOffset[1]; - } - else - alSetError(AL_INVALID_OPERATION); - break; - case AL_DIRECT_FILTER: *plValue = pSource->DirectFilter.filter; break; @@ -1262,6 +1249,8 @@ ALAPI void ALAPIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plValue { ALCcontext *pContext; ALsource *pSource; + ALfloat flOffset[2]; + ALfloat updateLen; pContext = GetContextSuspended(); if(!pContext) return; @@ -1298,6 +1287,19 @@ ALAPI void ALAPIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plValue alGetSourcei(source, eParam, plValues); break; + case AL_SAMPLE_RW_OFFSETS_EXT: + case AL_BYTE_RW_OFFSETS_EXT: + updateLen = (ALfloat)pContext->Device->UpdateSize / + pContext->Device->Frequency; + if(GetSourceOffset(pSource, eParam, flOffset, updateLen)) + { + plValues[0] = (ALint)flOffset[0]; + plValues[1] = (ALint)flOffset[1]; + } + else + alSetError(AL_INVALID_OPERATION); + break; + case AL_POSITION: plValues[0] = (ALint)pSource->vPosition[0]; plValues[1] = (ALint)pSource->vPosition[1]; @@ -1923,7 +1925,6 @@ static ALboolean GetSourceOffset(ALsource *pSource, ALenum eName, ALfloat *pflOf switch (eName) { case AL_SEC_OFFSET: - case AL_SEC_RW_OFFSETS_EXT: pflOffset[0] = (ALfloat)readPos / (lChannels * lBytes * flBufferFreq); pflOffset[1] = (ALfloat)writePos / (lChannels * lBytes * flBufferFreq); break; -- cgit v1.2.3