diff options
author | Chris Robinson <[email protected]> | 2009-10-21 13:50:53 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-10-21 13:50:53 -0700 |
commit | 47b8510b0cdb8a79a66606459e3fd4cbe7a673b6 (patch) | |
tree | 8df6d9a6c150c73d9aaa1f36d34ca409481e4a4a /Alc/ALu.c | |
parent | 4e399b41cdae165c35d924ef27b6683ae7361ebc (diff) |
Don't assume 16-bit samples
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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)); |