aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenAL32/alSource.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 44cd8b41..9b4909c5 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1908,7 +1908,15 @@ static ALboolean GetSourceOffset(ALsource *pSource, ALenum eName, ALfloat *pflOf
break;
case AL_BYTE_OFFSET:
// Take into account the original format of the Buffer
- if (aluBytesFromFormat(eOriginalFormat) == 1)
+ if ((eOriginalFormat == AL_FORMAT_MONO_IMA4) ||
+ (eOriginalFormat == AL_FORMAT_STEREO_IMA4))
+ {
+ // Compression rate of the ADPCM supported is 3.6111 to 1
+ lBytesPlayed = (ALint)((ALfloat)lBytesPlayed / 3.6111f);
+ // Round down to nearest ADPCM block
+ *pflOffset = (ALfloat)((lBytesPlayed / (36 * lChannels)) * 36 * lChannels);
+ }
+ else if (aluBytesFromFormat(eOriginalFormat) == 1)
{
*pflOffset = (ALfloat)(lBytesPlayed >> 1);
}
@@ -1916,14 +1924,6 @@ static ALboolean GetSourceOffset(ALsource *pSource, ALenum eName, ALfloat *pflOf
{
*pflOffset = (ALfloat)(lBytesPlayed << 1);
}
- else if ((eOriginalFormat == AL_FORMAT_MONO_IMA4) ||
- (eOriginalFormat == AL_FORMAT_STEREO_IMA4))
- {
- // Compression rate of the ADPCM supported is 3.6111 to 1
- lBytesPlayed = (ALint)((ALfloat)lBytesPlayed / 3.6111f);
- // Round down to nearest ADPCM block
- *pflOffset = (ALfloat)((lBytesPlayed / (36 * lChannels)) * 36 * lChannels);
- }
else
{
*pflOffset = (ALfloat)lBytesPlayed;
@@ -2062,23 +2062,23 @@ static ALint GetByteOffset(ALsource *pSource)
{
case AL_BYTE_OFFSET:
// Take into consideration the original format
- if (aluBytesFromFormat(pBuffer->eOriginalFormat) == 1)
+ if ((pBuffer->eOriginalFormat == AL_FORMAT_MONO_IMA4) ||
+ (pBuffer->eOriginalFormat == AL_FORMAT_STEREO_IMA4))
{
- lByteOffset = pSource->lOffset * 2;
+ // Round down to nearest ADPCM block
+ lByteOffset = (pSource->lOffset / (36 * lChannels)) * 36 * lChannels;
+ // Multiply by compression rate
+ lByteOffset = (ALint)(3.6111f * (ALfloat)lByteOffset);
lByteOffset -= (lByteOffset % (lChannels * 2));
}
- else if (aluBytesFromFormat(pBuffer->eOriginalFormat) == 4)
+ else if (aluBytesFromFormat(pBuffer->eOriginalFormat) == 1)
{
- lByteOffset = pSource->lOffset / 2;
+ lByteOffset = pSource->lOffset * 2;
lByteOffset -= (lByteOffset % (lChannels * 2));
}
- else if ((pBuffer->eOriginalFormat == AL_FORMAT_MONO_IMA4) ||
- (pBuffer->eOriginalFormat == AL_FORMAT_STEREO_IMA4))
+ else if (aluBytesFromFormat(pBuffer->eOriginalFormat) == 4)
{
- // Round down to nearest ADPCM block
- lByteOffset = (pSource->lOffset / (36 * lChannels)) * 36 * lChannels;
- // Multiply by compression rate
- lByteOffset = (ALint)(3.6111f * (ALfloat)lByteOffset);
+ lByteOffset = pSource->lOffset / 2;
lByteOffset -= (lByteOffset % (lChannels * 2));
}
else