aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-10-21 13:50:53 -0700
committerChris Robinson <[email protected]>2009-10-21 13:50:53 -0700
commit47b8510b0cdb8a79a66606459e3fd4cbe7a673b6 (patch)
tree8df6d9a6c150c73d9aaa1f36d34ca409481e4a4a
parent4e399b41cdae165c35d924ef27b6683ae7361ebc (diff)
Don't assume 16-bit samples
-rw-r--r--Alc/ALu.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index a8dc9fef..490a092e 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -857,7 +857,7 @@ another_source:
ALuint DataPosFrac = 0;
ALuint Buffer;
ALbuffer *ALBuffer;
- ALuint Channels;
+ ALuint Channels, Bytes;
ALuint BufferSize;
ALfloat Pitch;
@@ -868,8 +868,9 @@ another_source:
Data = ALBuffer->data;
Channels = aluChannelsFromFormat(ALBuffer->format);
+ Bytes = aluBytesFromFormat(ALBuffer->format);
DataSize = ALBuffer->size;
- DataSize /= Channels * aluBytesFromFormat(ALBuffer->format);
+ DataSize /= Channels * Bytes;
DataPosInt = ALSource->position;
DataPosFrac = ALSource->position_fraction;
@@ -957,7 +958,7 @@ another_source:
NextBuf = (ALbuffer*)ALTHUNK_LOOKUPENTRY(BufferListItem->next->buffer);
if(NextBuf && NextBuf->data)
{
- ulExtraSamples = min(NextBuf->size, (ALint)(ALBuffer->padding*Channels*2));
+ ulExtraSamples = min(NextBuf->size, (ALint)(ALBuffer->padding*Channels*Bytes));
memcpy(&Data[DataSize*Channels], NextBuf->data, ulExtraSamples);
}
}
@@ -966,12 +967,12 @@ another_source:
NextBuf = (ALbuffer*)ALTHUNK_LOOKUPENTRY(ALSource->queue->buffer);
if(NextBuf && NextBuf->data)
{
- ulExtraSamples = min(NextBuf->size, (ALint)(ALBuffer->padding*Channels*2));
+ ulExtraSamples = min(NextBuf->size, (ALint)(ALBuffer->padding*Channels*Bytes));
memcpy(&Data[DataSize*Channels], NextBuf->data, ulExtraSamples);
}
}
else
- memset(&Data[DataSize*Channels], 0, (ALBuffer->padding*Channels*2));
+ memset(&Data[DataSize*Channels], 0, (ALBuffer->padding*Channels*Bytes));
}
BufferSize = min(BufferSize, (SamplesToDo-j));