diff options
author | Chris Robinson <[email protected]> | 2015-10-23 15:11:34 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-10-23 15:11:34 -0700 |
commit | bca854baacf0c92038f0e2633fb92e9255b05603 (patch) | |
tree | 32055b17fe38b82f177704f192038dd2df4433fa /Alc | |
parent | 4813125d310292fc9c97a1892f102dadf1f3e836 (diff) |
Use one send gain per buffer channel
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 27 | ||||
-rw-r--r-- | Alc/mixer.c | 2 |
2 files changed, 17 insertions, 12 deletions
@@ -245,26 +245,30 @@ static void UpdateDryStepping(DirectParams *params, ALuint num_chans, ALuint ste params->Counter = steps; } -static void UpdateWetStepping(SendParams *params, ALuint steps) +static void UpdateWetStepping(SendParams *params, ALuint num_chans, ALuint steps) { ALfloat delta; + ALuint i; if(steps < 2) { - params->Gain.Current = params->Gain.Target; - params->Gain.Step = 0.0f; - + for(i = 0;i < num_chans;i++) + { + params->Gains[i].Current = params->Gains[i].Target; + params->Gains[i].Step = 0.0f; + } params->Counter = 0; return; } delta = 1.0f / (ALfloat)steps; + for(i = 0;i < num_chans;i++) { - ALfloat diff = params->Gain.Target - params->Gain.Current; + ALfloat diff = params->Gains[i].Target - params->Gains[i].Current; if(fabs(diff) >= GAIN_SILENCE_THRESHOLD) - params->Gain.Step = diff * delta; + params->Gains[i].Step = diff * delta; else - params->Gain.Step = 0.0f; + params->Gains[i].Step = 0.0f; } params->Counter = steps; } @@ -625,8 +629,9 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A } for(i = 0;i < NumSends;i++) { - voice->Send[i].Gain.Target = WetGain[i]; - UpdateWetStepping(&voice->Send[i], (voice->Send[i].Moving ? 64 : 0)); + for(c = 0;c < num_channels;c++) + voice->Send[i].Gains[c].Target = WetGain[i]; + UpdateWetStepping(&voice->Send[i], num_channels, (voice->Send[i].Moving ? 64 : 0)); voice->Send[i].Moving = AL_TRUE; } @@ -1093,8 +1098,8 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte } for(i = 0;i < NumSends;i++) { - voice->Send[i].Gain.Target = WetGain[i]; - UpdateWetStepping(&voice->Send[i], (voice->Send[i].Moving ? 64 : 0)); + voice->Send[i].Gains[0].Target = WetGain[i]; + UpdateWetStepping(&voice->Send[i], 1, (voice->Send[i].Moving ? 64 : 0)); voice->Send[i].Moving = AL_TRUE; } diff --git a/Alc/mixer.c b/Alc/mixer.c index 74208c9b..35c38431 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -505,7 +505,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam Device->FilteredData, ResampledData, DstBufferSize, parms->Filters[chan].ActiveType ); - MixSamples(samples, 1, parms->OutBuffer, &parms->Gain, + MixSamples(samples, 1, parms->OutBuffer, &parms->Gains[chan], parms->Counter, OutPos, DstBufferSize); } } |