aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-12-18 08:42:03 -0800
committerChris Robinson <[email protected]>2014-12-18 08:42:03 -0800
commit13c2dd71155f50f1d9690d32e6d63092cc82a781 (patch)
treebf64bd44200bf01f150271ce44217a65c73db022 /Alc/mixer.c
parent94ad5b289fe68ecd7ceee3a99ff47da0d9ce0497 (diff)
Offset to the buffer's channel start first
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r--Alc/mixer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index bce9b14f..b6cb19c7 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -293,6 +293,9 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
ALuint DataSize;
ALuint pos;
+ /* Offset to current channel */
+ Data += chan*SampleSize;
+
/* If current pos is beyond the loop range, do not loop */
if(Looping == AL_FALSE || DataPosInt >= (ALuint)ALBuffer->LoopEnd)
{
@@ -315,7 +318,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
* rest of the temp buffer */
DataSize = minu(SrcBufferSize - SrcDataSize, ALBuffer->SampleLen - pos);
- LoadSamples(&SrcData[SrcDataSize], &Data[(pos*NumChannels + chan)*SampleSize],
+ LoadSamples(&SrcData[SrcDataSize], &Data[pos * NumChannels*SampleSize],
NumChannels, ALBuffer->FmtType, DataSize);
SrcDataSize += DataSize;
@@ -353,7 +356,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
DataSize = LoopEnd - pos;
DataSize = minu(SrcBufferSize - SrcDataSize, DataSize);
- LoadSamples(&SrcData[SrcDataSize], &Data[(pos*NumChannels + chan)*SampleSize],
+ LoadSamples(&SrcData[SrcDataSize], &Data[pos * NumChannels*SampleSize],
NumChannels, ALBuffer->FmtType, DataSize);
SrcDataSize += DataSize;
@@ -362,7 +365,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
{
DataSize = minu(SrcBufferSize - SrcDataSize, DataSize);
- LoadSamples(&SrcData[SrcDataSize], &Data[(LoopStart*NumChannels + chan)*SampleSize],
+ LoadSamples(&SrcData[SrcDataSize], &Data[LoopStart * NumChannels*SampleSize],
NumChannels, ALBuffer->FmtType, DataSize);
SrcDataSize += DataSize;
}