From 79edd2cf3b46b22d3e6c57aec11b942809f24ff3 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 6 Oct 2013 17:25:47 -0700 Subject: Use a macro for the silence threshold --- Alc/effects/autowah.c | 2 +- Alc/effects/chorus.c | 4 ++-- Alc/effects/compressor.c | 2 +- Alc/effects/dedicated.c | 2 +- Alc/effects/distortion.c | 2 +- Alc/effects/echo.c | 4 ++-- Alc/effects/equalizer.c | 2 +- Alc/effects/flanger.c | 4 ++-- Alc/effects/modulator.c | 2 +- Alc/effects/reverb.c | 19 ++++++++++--------- 10 files changed, 22 insertions(+), 21 deletions(-) (limited to 'Alc/effects') diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c index 298eb7f0..ffec3c9c 100644 --- a/Alc/effects/autowah.c +++ b/Alc/effects/autowah.c @@ -155,7 +155,7 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, for(kt = 0;kt < MaxChannels;kt++) { ALfloat gain = state->Gain[kt]; - if(!(gain > 0.00001f)) + if(!(gain > GAIN_SILENCE_THRESHOLD)) continue; for(it = 0;it < td;it++) diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index ba664268..8fc82a7f 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -203,14 +203,14 @@ static void Process##func(ALchorusState *state, ALuint SamplesToDo, \ for(kt = 0;kt < MaxChannels;kt++) \ { \ ALfloat gain = state->Gain[0][kt]; \ - if(gain > 0.00001f) \ + if(gain > GAIN_SILENCE_THRESHOLD) \ { \ for(it = 0;it < td;it++) \ SamplesOut[kt][it+base] += temps[it][0] * gain; \ } \ \ gain = state->Gain[1][kt]; \ - if(gain > 0.00001f) \ + if(gain > GAIN_SILENCE_THRESHOLD) \ { \ for(it = 0;it < td;it++) \ SamplesOut[kt][it+base] += temps[it][1] * gain; \ diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c index 6c3ab425..46673f45 100644 --- a/Alc/effects/compressor.c +++ b/Alc/effects/compressor.c @@ -117,7 +117,7 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples for(kt = 0;kt < MaxChannels;kt++) { ALfloat gain = state->Gain[kt] * envgain * 2.0f; - if(!(gain > 0.00001f)) + if(!(gain > GAIN_SILENCE_THRESHOLD)) continue; for(it = 0;it < td;it++) diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 2aa08953..5a9842fa 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -78,7 +78,7 @@ static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesTo for(c = 0;c < MaxChannels;c++) { - if(!(gains[c] > 0.00001f)) + if(!(gains[c] > GAIN_SILENCE_THRESHOLD)) continue; for(i = 0;i < SamplesToDo;i++) diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 768d1ee2..9a18ad46 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -169,7 +169,7 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint Samples for(kt = 0;kt < MaxChannels;kt++) { ALfloat gain = state->Gain[kt]; - if(!(gain > 0.00001f)) + if(!(gain > GAIN_SILENCE_THRESHOLD)) continue; for(it = 0;it < td;it++) diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c index 8a457162..a9110e35 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -148,14 +148,14 @@ static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const for(k = 0;k < MaxChannels;k++) { ALfloat gain = state->Gain[0][k]; - if(gain > 0.00001f) + if(gain > GAIN_SILENCE_THRESHOLD) { for(i = 0;i < td;i++) SamplesOut[k][i+base] += temps[i][0] * gain; } gain = state->Gain[1][k]; - if(gain > 0.00001f) + if(gain > GAIN_SILENCE_THRESHOLD) { for(i = 0;i < td;i++) SamplesOut[k][i+base] += temps[i][1] * gain; diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index 3fd0b0f7..b7bfa0a2 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -154,7 +154,7 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesTo for(kt = 0;kt < MaxChannels;kt++) { ALfloat gain = state->Gain[kt]; - if(!(gain > 0.00001f)) + if(!(gain > GAIN_SILENCE_THRESHOLD)) continue; for(it = 0;it < td;it++) diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index 6b1a84ad..0107afed 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -203,14 +203,14 @@ static void Process##func(ALflangerState *state, ALuint SamplesToDo, \ for(kt = 0;kt < MaxChannels;kt++) \ { \ ALfloat gain = state->Gain[0][kt]; \ - if(gain > 0.00001f) \ + if(gain > GAIN_SILENCE_THRESHOLD) \ { \ for(it = 0;it < td;it++) \ SamplesOut[kt][it+base] += temps[it][0] * gain; \ } \ \ gain = state->Gain[1][kt]; \ - if(gain > 0.00001f) \ + if(gain > GAIN_SILENCE_THRESHOLD) \ { \ for(it = 0;it < td;it++) \ SamplesOut[kt][it+base] += temps[it][1] * gain; \ diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index a77a42df..b71070f5 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -102,7 +102,7 @@ static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \ for(k = 0;k < MaxChannels;k++) \ { \ ALfloat gain = state->Gain[k]; \ - if(!(gain > 0.00001f)) \ + if(!(gain > GAIN_SILENCE_THRESHOLD)) \ continue; \ \ for(i = 0;i < td;i++) \ diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 261a1f7f..4c65e0a6 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -575,11 +575,11 @@ static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint Samples for(c = 0;c < MaxChannels;c++) { ALfloat gain = State->Gain[c]; - if(gain > 0.00001f) - { - for(index = 0;index < SamplesToDo;index++) - SamplesOut[c][index] += gain * out[index][c&3]; - } + if(!(gain > GAIN_SILENCE_THRESHOLD)) + continue; + + for(index = 0;index < SamplesToDo;index++) + SamplesOut[c][index] += gain * out[index][c&3]; } } @@ -595,15 +595,16 @@ static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo, for(c = 0;c < MaxChannels;c++) { - ALfloat earlyGain = State->Early.PanGain[c]; - ALfloat lateGain = State->Late.PanGain[c]; + ALfloat earlyGain, lateGain; - if(earlyGain > 0.00001f) + earlyGain = State->Early.PanGain[c]; + if(earlyGain > GAIN_SILENCE_THRESHOLD) { for(index = 0;index < SamplesToDo;index++) SamplesOut[c][index] += earlyGain*early[index][c&3]; } - if(lateGain > 0.00001f) + lateGain = State->Late.PanGain[c]; + if(lateGain > GAIN_SILENCE_THRESHOLD) { for(index = 0;index < SamplesToDo;index++) SamplesOut[c][index] += lateGain*late[index][c&3]; -- cgit v1.2.3