diff options
author | Chris Robinson <[email protected]> | 2008-11-13 05:48:38 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-11-13 05:48:38 -0800 |
commit | 010f7d12f48f8e046dcda4a5e39221265554e2ff (patch) | |
tree | 8a32e64f4bebf6e9f0fc73eed7ed6b7b85d0776b /Alc/ALu.c | |
parent | da684564eae03317a1b38184159f650fc963aa23 (diff) |
Don't ramp gains when starting a sound from the beginning
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -732,9 +732,23 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma WetSend = &ALSource->WetGain; //Compute the gain steps for each output channel - for(i = 0;i < OUTPUTCHANNELS;i++) - dryGainStep[i] = (newDrySend[i]-DrySend[i]) / rampLength; - wetGainStep = (newWetSend-(*WetSend)) / rampLength; + if(ALSource->FirstStart && DataPosInt == 0 && DataPosFrac == 0) + { + for(i = 0;i < OUTPUTCHANNELS;i++) + { + DrySend[i] = newDrySend[i]; + dryGainStep[i] = 0; + } + *WetSend = newWetSend; + wetGainStep = 0; + } + else + { + for(i = 0;i < OUTPUTCHANNELS;i++) + dryGainStep[i] = (newDrySend[i]-DrySend[i]) / rampLength; + wetGainStep = (newWetSend-(*WetSend)) / rampLength; + } + ALSource->FirstStart = AL_FALSE; //Compute 18.14 fixed point step if(Pitch > (float)MAX_PITCH) |