aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alu.h4
-rw-r--r--OpenAL32/alBuffer.c3
-rw-r--r--OpenAL32/alSource.c3
3 files changed, 6 insertions, 4 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 57afe6c4..55ddbaf6 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -158,6 +158,10 @@ static __inline ALuint aluChannelsFromFormat(ALenum format)
return 0;
}
}
+static __inline ALuint aluFrameSizeFromFormat(ALenum format)
+{
+ return aluBytesFromFormat(format) * aluChannelsFromFormat(format);
+}
static __inline ALint aluCart2LUTpos(ALfloat re, ALfloat im)
{
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 72af95f0..81e17c52 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -838,8 +838,7 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum eParam, const ALint* pl
alSetError(pContext, AL_INVALID_VALUE);
else
{
- ALint maxlen = ALBuf->size / aluBytesFromFormat(ALBuf->format) /
- aluChannelsFromFormat(ALBuf->format);
+ ALint maxlen = ALBuf->size / aluFrameSizeFromFormat(ALBuf->format);
if(plValues[0] > maxlen || plValues[1] > maxlen)
alSetError(pContext, AL_INVALID_VALUE);
else
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 066e7f72..d470f027 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1937,8 +1937,7 @@ static ALboolean ApplyOffset(ALsource *Source)
// SW Mixer Positions are in Samples
Source->position = (lByteOffset - lTotalBufferSize) /
- aluBytesFromFormat(Buffer->format) /
- aluChannelsFromFormat(Buffer->format);
+ aluFrameSizeFromFormat(Buffer->format);
return AL_TRUE;
}