aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-03 17:05:08 -0800
committerChris Robinson <[email protected]>2014-03-03 17:05:08 -0800
commitc442c93a934a7c29c2d5450e0d2ca96ea766ea65 (patch)
treebbe4034ec7885e14be47bd92b160c07c7fbf4144 /OpenAL32/alSource.c
parentea8a85b19ce3c9786defaf22eab4dc4fd5011486 (diff)
Store the original frame size alignment in the buffer
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);