diff options
author | Chris Robinson <[email protected]> | 2014-03-23 16:11:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-03-23 16:11:21 -0700 |
commit | 52deb557d5466e7dd0b78dceb16f2ad5296bbcd4 (patch) | |
tree | 14bf48e2d74ce459fe37bb5feb0b556aa09d174e /Alc/mixer_c.c | |
parent | 83038c0dab0727b76765a8feed5a2c3c23c9915b (diff) |
Add gain stepping to the send mixers
Diffstat (limited to 'Alc/mixer_c.c')
-rw-r--r-- | Alc/mixer_c.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index a4028beb..c5091322 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -115,22 +115,30 @@ void MixDirect_C(DirectParams *params, const ALfloat *restrict data, ALuint srcc void MixSend_C(SendParams *params, const ALfloat *restrict data, - ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) + ALuint OutPos, ALuint UNUSED(SamplesToDo), ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; - ALfloat *restrict ClickRemoval = params->ClickRemoval; - ALfloat *restrict PendingClicks = params->PendingClicks; - ALfloat WetSend; - ALuint pos; - - WetSend = params->Gain; - if(!(WetSend > GAIN_SILENCE_THRESHOLD)) - return; - - if(OutPos == 0) - ClickRemoval[0] -= data[0] * WetSend; - for(pos = 0;pos < BufferSize;pos++) - OutBuffer[0][OutPos+pos] += data[pos] * WetSend; - if(OutPos+pos == SamplesToDo) - PendingClicks[0] += data[pos] * WetSend; + ALuint Counter = maxu(params->Counter, OutPos) - OutPos; + ALfloat WetSend, Step; + + { + ALuint pos = 0; + Step = params->Gain.Step; + if(Step != 1.0f && Counter > 0) + { + WetSend = params->Gain.Current; + for(;pos < BufferSize && pos < Counter;pos++) + { + OutBuffer[0][OutPos+pos] += data[pos]*WetSend; + WetSend *= Step; + } + params->Gain.Current = WetSend; + } + + WetSend = params->Gain.Target; + if(!(WetSend > GAIN_SILENCE_THRESHOLD)) + return; + for(;pos < BufferSize;pos++) + OutBuffer[0][OutPos+pos] += data[pos] * WetSend; + } } |