aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-08-26 19:14:17 -0700
committerChris Robinson <[email protected]>2018-08-26 19:14:17 -0700
commit072ca731e2dffcbdbd8f7e8f2dad2ea699ef1b83 (patch)
tree1d3fcf1a6e5bd01d87613cbdf1f6de7e6a7dbaff /Alc
parenta3010f50be7396a96e6872600b4a3c2a3b79a107 (diff)
Avoid making extraneous calls
Diffstat (limited to 'Alc')
-rw-r--r--Alc/effects/autowah.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c
index 5a222bfd..28b366b1 100644
--- a/Alc/effects/autowah.c
+++ b/Alc/effects/autowah.c
@@ -122,7 +122,7 @@ static ALvoid ALautowahState_update(ALautowahState *state, const ALCcontext *con
state->AttackRate = expf(-1.0f / (props->Autowah.AttackTime*device->Frequency));
state->ReleaseRate = expf(-1.0f / (ReleaseTime*device->Frequency));
/* 0-20dB Resonance Peak gain */
- state->ResonanceGain = log10f(props->Autowah.Resonance)*10.0f / 3.0f;
+ state->ResonanceGain = sqrtf(log10f(props->Autowah.Resonance)*10.0f / 3.0f);
state->PeakGain = 1.0f - log10f(props->Autowah.PeakGain/AL_AUTOWAH_MAX_PEAK_GAIN);
state->FreqMinNorm = MIN_FREQ / device->Frequency;
state->BandwidthNorm = (MAX_FREQ-MIN_FREQ) / device->Frequency;
@@ -136,9 +136,10 @@ static ALvoid ALautowahState_update(ALautowahState *state, const ALCcontext *con
static ALvoid ALautowahState_process(ALautowahState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels)
{
- const ALfloat peak_gain = state->PeakGain;
const ALfloat attack_rate = state->AttackRate;
const ALfloat release_rate = state->ReleaseRate;
+ const ALfloat res_gain = state->ResonanceGain;
+ const ALfloat peak_gain = state->PeakGain;
const ALfloat freq_min = state->FreqMinNorm;
const ALfloat bandwidth = state->BandwidthNorm;
ALfloat env_delay;
@@ -171,7 +172,6 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALsizei SamplesToDo,
* envelope. Because the filter changes for each sample, the
* coefficients are transient and don't need to be held.
*/
- const ALfloat res_gain = sqrtf(state->ResonanceGain);
ALfloat z1 = state->Chans[c].Filter.z1;
ALfloat z2 = state->Chans[c].Filter.z2;