From 6556626055e9985251ebd782c8551839e6d67ac5 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 27 May 2013 21:57:22 -0700 Subject: Simplify and fix some filter gain calculations --- Alc/effects/equalizer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Alc/effects') diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index 9a1543e4..0a26cda7 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -123,27 +123,27 @@ static ALvoid ALequalizerState_Update(ALequalizerState *state, ALCdevice *device ALfloat gain; /* convert linear gains to filter gains */ - switch (it) + switch(it) { case 0: /* Low Shelf */ - gain = powf(10.0f, (20.0f * log10f(slot->EffectProps.Equalizer.LowGain)) / 40.0f); + gain = sqrtf(slot->EffectProps.Equalizer.LowGain); filter_frequency = slot->EffectProps.Equalizer.LowCutoff; type = ALfilterType_LowShelf; break; case 1: /* Peaking */ - gain = powf(10.0f, (20.0f * log10f(slot->EffectProps.Equalizer.Mid1Gain)) / 40.0f); + gain = sqrtf(slot->EffectProps.Equalizer.Mid1Gain); filter_frequency = slot->EffectProps.Equalizer.Mid1Center; bandwidth = slot->EffectProps.Equalizer.Mid1Width; type = ALfilterType_Peaking; break; case 2: /* Peaking */ - gain = powf(10.0f, (20.0f * log10f(slot->EffectProps.Equalizer.Mid2Gain)) / 40.0f); + gain = sqrtf(slot->EffectProps.Equalizer.Mid2Gain); filter_frequency = slot->EffectProps.Equalizer.Mid2Center; bandwidth = slot->EffectProps.Equalizer.Mid2Width; type = ALfilterType_Peaking; break; case 3: /* High Shelf */ - gain = powf(10.0f, (20.0f * log10f(slot->EffectProps.Equalizer.HighGain)) / 40.0f); + gain = sqrtf(slot->EffectProps.Equalizer.HighGain); filter_frequency = slot->EffectProps.Equalizer.HighCutoff; type = ALfilterType_HighShelf; break; -- cgit v1.2.3