aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-10-03 10:07:50 -0700
committerChris Robinson <[email protected]>2011-10-04 02:08:45 -0700
commit11caba9807550a01ec5b81f50a6c744b3506115d (patch)
tree46f060fbea6f49ac1e8c269ee55ce61f6aa8cc52 /Alc/mixer.c
parent35b4b31d57205f0f358202d9e41b594b9465b22b (diff)
Use sample frames when handling the buffer length
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r--Alc/mixer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 2ce78206..61dcfbe7 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -622,7 +622,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
/* Copy what's left to play in the source buffer, and clear the
* rest of the temp buffer */
- DataSize = ALBuffer->size/FrameSize - pos;
+ DataSize = ALBuffer->SampleLen - pos;
DataSize = minu(BufferSize, DataSize);
memcpy(&SrcData[SrcDataSize*FrameSize], &Data[pos*FrameSize], DataSize*FrameSize);
@@ -715,12 +715,12 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
if(BufferListIter->buffer)
{
- if((ALuint)BufferListIter->buffer->size/FrameSize > pos)
+ if((ALuint)BufferListIter->buffer->SampleLen > pos)
{
- pos = BufferListIter->buffer->size/FrameSize - pos;
+ pos = BufferListIter->buffer->SampleLen - pos;
break;
}
- pos -= BufferListIter->buffer->size/FrameSize;
+ pos -= BufferListIter->buffer->SampleLen;
}
}
}
@@ -731,7 +731,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
if((ALBuffer=BufferListIter->buffer) != NULL)
{
const ALubyte *Data = ALBuffer->data;
- ALuint DataSize = ALBuffer->size/FrameSize;
+ ALuint DataSize = ALBuffer->SampleLen;
/* Skip the data already played */
if(DataSize <= pos)
@@ -785,7 +785,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
if((ALBuffer=BufferListItem->buffer) != NULL)
{
- DataSize = ALBuffer->size / FrameSize;
+ DataSize = ALBuffer->SampleLen;
LoopStart = ALBuffer->LoopStart;
LoopEnd = ALBuffer->LoopEnd;
if(LoopEnd > DataPosInt)