From 4a8d38c19ab12a0ae5ea5efcd81c907d81658eb6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 21 May 2014 14:47:25 -0700 Subject: Update the active source's direct and send properties after each mix --- Alc/mixer.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'Alc') diff --git a/Alc/mixer.c b/Alc/mixer.c index 6ee76d1f..aa7aea2a 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -356,14 +356,12 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) ); if(!src->IsHrtf) src->Dry.Mix(parms->OutBuffer, samples, &parms->Mix.Gains[chan], - maxu(parms->Counter, OutPos) - OutPos, OutPos, - DstBufferSize); + parms->Counter, OutPos, DstBufferSize); else src->Dry.HrtfMix( - parms->OutBuffer, SrcData, maxu(parms->Counter, OutPos) - OutPos, - parms->Offset + OutPos, OutPos, parms->Mix.Hrtf.IrSize, - &parms->Mix.Hrtf.Params[chan], &parms->Mix.Hrtf.State[chan], - DstBufferSize + parms->OutBuffer, SrcData, parms->Counter, parms->Offset, + OutPos, parms->Mix.Hrtf.IrSize, &parms->Mix.Hrtf.Params[chan], + &parms->Mix.Hrtf.State[chan], DstBufferSize ); } @@ -381,8 +379,7 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) parms->Filters[chan].ActiveType ); src->WetMix(parms->OutBuffer, samples, &parms->Gain, - maxu(parms->Counter, OutPos) - OutPos, - OutPos, DstBufferSize); + parms->Counter, OutPos, DstBufferSize); } } /* Update positions */ @@ -393,6 +390,10 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) DataPosFrac &= FRACTIONMASK; } OutPos += DstBufferSize; + src->Direct.Offset += DstBufferSize; + src->Direct.Counter = maxu(src->Direct.Counter, DstBufferSize) - DstBufferSize; + for(j = 0;j < Device->NumAuxSends;j++) + src->Send[j].Counter = maxu(src->Send[j].Counter, DstBufferSize) - DstBufferSize; /* Handle looping sources */ while(1) @@ -443,6 +444,4 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) Source->current_buffer = BufferListItem; Source->position = DataPosInt; Source->position_fraction = DataPosFrac; - src->Direct.Offset += OutPos; - src->Direct.Counter = maxu(src->Direct.Counter, OutPos) - OutPos; } -- cgit v1.2.3