aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/autowah.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-05-17 03:08:04 -0700
committerChris Robinson <[email protected]>2014-05-17 03:08:04 -0700
commit70f1e54068f2ccfce30f9e5db8ea61b01283f59b (patch)
tree579577f1a18fe3576aed3e07d611879e4c12c936 /Alc/effects/autowah.c
parent1efddac3dbdf6bb2192172c6d09be374205d1221 (diff)
Use logarithmic adjustment for the gain in the autowah effect
Diffstat (limited to 'Alc/effects/autowah.c')
-rw-r--r--Alc/effects/autowah.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c
index 9857c722..c8317c8b 100644
--- a/Alc/effects/autowah.c
+++ b/Alc/effects/autowah.c
@@ -71,8 +71,8 @@ static ALvoid ALautowahState_update(ALautowahState *state, ALCdevice *device, co
attackTime = slot->EffectProps.Autowah.AttackTime * state->Frequency;
releaseTime = slot->EffectProps.Autowah.ReleaseTime * state->Frequency;
- state->AttackRate = 1.0f / attackTime;
- state->ReleaseRate = 1.0f / releaseTime;
+ state->AttackRate = powf(1.0f/GAIN_SILENCE_THRESHOLD, 1.0f/attackTime);
+ state->ReleaseRate = powf(GAIN_SILENCE_THRESHOLD/1.0f, 1.0f/releaseTime);
state->PeakGain = slot->EffectProps.Autowah.PeakGain;
state->Resonance = slot->EffectProps.Autowah.Resonance;
@@ -102,9 +102,9 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo,
* incoming signal, and attack or release to reach it. */
amplitude = fabsf(smp);
if(amplitude > gain)
- gain = minf(gain+state->AttackRate, amplitude);
+ gain = minf(gain*state->AttackRate, amplitude);
else if(amplitude < gain)
- gain = maxf(gain-state->ReleaseRate, amplitude);
+ gain = maxf(gain*state->ReleaseRate, amplitude);
gain = maxf(gain, GAIN_SILENCE_THRESHOLD);
/* FIXME: What range does the filter cover? */
@@ -168,9 +168,9 @@ static ALeffectState *ALautowahStateFactory_create(ALautowahStateFactory *UNUSED
if(!state) return NULL;
SET_VTABLE2(ALautowahState, ALeffectState, state);
- state->AttackRate = 0.0f;
- state->ReleaseRate = 0.0f;
- state->Resonance = 0.0f;
+ state->AttackRate = 1.0f;
+ state->ReleaseRate = 1.0f;
+ state->Resonance = 2.0f;
state->PeakGain = 1.0f;
state->GainCtrl = 1.0f;