diff options
author | Chris Robinson <[email protected]> | 2009-05-26 09:23:49 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-05-26 09:23:49 -0700 |
commit | 923af8c3a6626a43f7564afe0de61fcd55f2fce1 (patch) | |
tree | b6c974ed073a0b165af08c030930fd62c3d6fa4f /Alc | |
parent | ac04cf57fa99838d0914b3699d2faaf28485cacd (diff) |
Don't update the source's gains in the sample mixing loop
Update copies stored on the stack instead, then update the source after mixing
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -852,12 +852,10 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma static float DummyBuffer[BUFFERSIZE]; ALfloat *WetBuffer[MAX_SENDS]; ALfloat (*Matrix)[OUTPUTCHANNELS] = ALContext->ChannelMatrix; - ALfloat newDrySend[OUTPUTCHANNELS] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; - ALfloat newWetSend[MAX_SENDS]; + ALfloat DrySend[OUTPUTCHANNELS] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; + ALfloat WetSend[MAX_SENDS]; ALfloat DryGainHF = 0.0f; ALfloat WetGainHF[MAX_SENDS]; - ALfloat *DrySend; - ALfloat *WetSend; ALuint rampLength; ALfloat dryGainStep[OUTPUTCHANNELS]; ALfloat wetGainStep[MAX_SENDS]; @@ -958,12 +956,10 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma ALSource->Send[i].Slot->WetBuffer : DummyBuffer); } - DrySend = ALSource->DryGains; - WetSend = ALSource->WetGains; CalcSourceParams(ALContext, ALSource, (Channels==1) ? AL_TRUE : AL_FALSE, - newDrySend, newWetSend, &Pitch, + DrySend, WetSend, &Pitch, &DryGainHF, WetGainHF); Pitch = (Pitch*Frequency) / ALContext->Frequency; @@ -1029,22 +1025,22 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma if(ALSource->FirstStart && DataPosInt == 0 && DataPosFrac == 0) { for(i = 0;i < OUTPUTCHANNELS;i++) - { - DrySend[i] = newDrySend[i]; dryGainStep[i] = 0; - } for(i = 0;i < MAX_SENDS;i++) - { - WetSend[i] = newWetSend[i]; wetGainStep[i] = 0; - } } else { for(i = 0;i < OUTPUTCHANNELS;i++) - dryGainStep[i] = (newDrySend[i]-DrySend[i]) / rampLength; + { + dryGainStep[i] = (DrySend[i]-ALSource->DryGains[i]) / rampLength; + DrySend[i] = ALSource->DryGains[i]; + } for(i = 0;i < MAX_SENDS;i++) - wetGainStep[i] = (newWetSend[i]-WetSend[i]) / rampLength; + { + wetGainStep[i] = (WetSend[i]-ALSource->WetGains[i]) / rampLength; + WetSend[i] = ALSource->WetGains[i]; + } } ALSource->FirstStart = AL_FALSE; @@ -1233,6 +1229,10 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma //Update source info ALSource->position = DataPosInt; ALSource->position_fraction = DataPosFrac; + for(i = 0;i < OUTPUTCHANNELS;i++) + ALSource->DryGains[i] = DrySend[i]; + for(i = 0;i < MAX_SENDS;i++) + ALSource->WetGains[i] = WetSend[i]; skipmix: ; } |