diff options
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/autowah.c | 4 | ||||
-rw-r--r-- | Alc/effects/compressor.c | 9 | ||||
-rw-r--r-- | Alc/effects/distortion.c | 4 | ||||
-rw-r--r-- | Alc/effects/equalizer.c | 3 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 5 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 3 |
6 files changed, 9 insertions, 19 deletions
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c index f4aaf49f..e4edb2d4 100644 --- a/Alc/effects/autowah.c +++ b/Alc/effects/autowah.c @@ -66,7 +66,6 @@ static ALboolean ALautowahState_deviceUpdate(ALautowahState *state, ALCdevice *d static ALvoid ALautowahState_update(ALautowahState *state, ALCdevice *device, const ALeffectslot *slot) { ALfloat attackTime, releaseTime; - ALfloat gain; attackTime = slot->EffectProps.Autowah.AttackTime * state->Frequency; releaseTime = slot->EffectProps.Autowah.ReleaseTime * state->Frequency; @@ -76,8 +75,7 @@ static ALvoid ALautowahState_update(ALautowahState *state, ALCdevice *device, co state->PeakGain = slot->EffectProps.Autowah.PeakGain; state->Resonance = slot->EffectProps.Autowah.Resonance; - gain = 1.0f/device->NumSpeakers * slot->Gain; - SetGains(device, gain, state->Gain); + ComputeAmbientGains(device, slot->Gain, state->Gain); } static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[BUFFERSIZE]) diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c index 9554a0f2..bc1cb81a 100644 --- a/Alc/effects/compressor.c +++ b/Alc/effects/compressor.c @@ -55,14 +55,11 @@ static ALboolean ALcompressorState_deviceUpdate(ALcompressorState *state, ALCdev return AL_TRUE; } -static ALvoid ALcompressorState_update(ALcompressorState *state, ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALcompressorState_update(ALcompressorState *state, ALCdevice *device, const ALeffectslot *slot) { - ALfloat gain; + state->Enabled = slot->EffectProps.Compressor.OnOff; - state->Enabled = Slot->EffectProps.Compressor.OnOff; - - gain = 1.0f/Device->NumSpeakers * Slot->Gain; - SetGains(Device, gain, state->Gain); + ComputeAmbientGains(device, slot->Gain, state->Gain); } static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[BUFFERSIZE]) diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 9e36ea20..95e76ac1 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -58,7 +58,6 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, ALCdevice *Devi ALfloat bandwidth; ALfloat cutoff; ALfloat edge; - ALfloat gain; /* Store distorted signal attenuation settings */ state->attenuation = Slot->EffectProps.Distortion.Gain; @@ -82,8 +81,7 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, ALCdevice *Devi ALfilterState_setParams(&state->bandpass, ALfilterType_BandPass, 1.0f, cutoff / (frequency*4.0f), bandwidth); - gain = 1.0f/Device->NumSpeakers * Slot->Gain; - SetGains(Device, gain, state->Gain); + ComputeAmbientGains(Device, Slot->Gain, state->Gain); } static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index d04f36ee..f555cbe5 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -93,9 +93,8 @@ static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *UNUSED(state), static ALvoid ALequalizerState_update(ALequalizerState *state, ALCdevice *device, const ALeffectslot *slot) { ALfloat frequency = (ALfloat)device->Frequency; - ALfloat gain = 1.0f/device->NumSpeakers * slot->Gain; - SetGains(device, gain, state->Gain); + ComputeAmbientGains(device, slot->Gain, state->Gain); /* Calculate coefficients for the each type of filter */ ALfilterState_setParams(&state->filter[0], ALfilterType_LowShelf, diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index e57040b3..01d19bcb 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -125,7 +125,7 @@ static ALboolean ALmodulatorState_deviceUpdate(ALmodulatorState *UNUSED(state), static ALvoid ALmodulatorState_update(ALmodulatorState *state, ALCdevice *Device, const ALeffectslot *Slot) { - ALfloat gain, cw, a; + ALfloat cw, a; if(Slot->EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SINUSOID) state->Waveform = SINUSOID; @@ -149,8 +149,7 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, ALCdevice *Device state->Filter.a[1] = -a; state->Filter.a[2] = 0.0f; - gain = 1.0f/Device->NumSpeakers * Slot->Gain; - SetGains(Device, gain, state->Gain); + ComputeAmbientGains(Device, Slot->Gain, state->Gain); } static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE]) diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 45d25da7..5b937d96 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -1148,8 +1148,7 @@ static ALvoid ALreverbState_update(ALreverbState *State, ALCdevice *Device, cons else { /* Update channel gains */ - ALfloat gain = 2.0f/Device->NumSpeakers * Slot->Gain * ReverbBoost; - SetGains(Device, gain, State->Gain); + ComputeAmbientGains(Device, Slot->Gain*2.0f, State->Gain); } } |