summaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 543910db..4a46b77e 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -2536,8 +2536,9 @@ static ALvoid GetSourceOffsets(const ALsource *Source, ALenum name, ALdouble *of
case AL_BYTE_RW_OFFSETS_SOFT:
if(Buffer->OriginalType == UserFmtIMA4)
{
- ALuint BlockSize = 36 * ChannelsFromFmt(Buffer->FmtChannels);
- ALuint FrameBlockSize = 65;
+ ALsizei align = (Buffer->OriginalAlign-1)/2 + 4;
+ ALuint BlockSize = align * ChannelsFromFmt(Buffer->FmtChannels);
+ ALuint FrameBlockSize = Buffer->OriginalAlign;
/* Round down to nearest ADPCM block */
offset[0] = (ALdouble)(readPos / FrameBlockSize * BlockSize);
@@ -2650,8 +2651,9 @@ static ALint GetSampleOffset(ALsource *Source)
Offset = (ALint)Source->Offset;
if(Buffer->OriginalType == UserFmtIMA4)
{
- Offset /= 36 * ChannelsFromUserFmt(Buffer->OriginalChannels);
- Offset *= 65;
+ ALsizei align = (Buffer->OriginalAlign-1)/2 + 4;
+ Offset /= align * ChannelsFromUserFmt(Buffer->OriginalChannels);
+ Offset *= Buffer->OriginalAlign;
}
else
Offset /= FrameSizeFromUserFmt(Buffer->OriginalChannels, Buffer->OriginalType);