diff options
-rw-r--r-- | Alc/ALu.c | 27 | ||||
-rw-r--r-- | Alc/mixer.c | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 2 |
3 files changed, 18 insertions, 13 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); } } diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 20eefa93..f4dfae64 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -139,7 +139,7 @@ typedef struct SendParams { /* Gain control, which applies to all input channels to a single (mono) * output buffer. */ - MixGains Gain; + MixGains Gains[MAX_INPUT_CHANNELS]; } SendParams; |