aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c58
-rw-r--r--Alc/effects/echo.c2
-rw-r--r--Alc/effects/equalizer.c8
-rw-r--r--Alc/effects/reverb.c4
4 files changed, 33 insertions, 39 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 503fde6c..d2c2ec19 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -374,6 +374,7 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
ALfloat WetGainHF[MAX_SENDS];
ALfloat WetGainLF[MAX_SENDS];
ALeffectslot *SendSlots[MAX_SENDS];
+ ALfloat HFScale, LFScale;
ALuint NumSends, Frequency;
ALboolean Relative;
const struct ChanMap *chans = NULL;
@@ -714,12 +715,10 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
}
{
- ALfloat hfscale = ATOMIC_LOAD(&props->Direct.HFReference, almemory_order_relaxed) /
- Frequency;
- ALfloat lfscale = ATOMIC_LOAD(&props->Direct.LFReference, almemory_order_relaxed) /
- Frequency;
- DryGainHF = maxf(DryGainHF, 0.0001f);
- DryGainLF = maxf(DryGainLF, 0.0001f);
+ HFScale = ATOMIC_LOAD(&props->Direct.HFReference, almemory_order_relaxed) / Frequency;
+ LFScale = ATOMIC_LOAD(&props->Direct.LFReference, almemory_order_relaxed) / Frequency;
+ DryGainHF = maxf(DryGainHF, 0.0625f); /* Limit -24dB */
+ DryGainLF = maxf(DryGainLF, 0.0625f);
for(c = 0;c < num_channels;c++)
{
voice->Direct.Params[c].FilterType = AF_None;
@@ -727,22 +726,20 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
if(DryGainLF != 1.0f) voice->Direct.Params[c].FilterType |= AF_HighPass;
ALfilterState_setParams(
&voice->Direct.Params[c].LowPass, ALfilterType_HighShelf,
- DryGainHF, hfscale, calc_rcpQ_from_slope(DryGainHF, 0.75f)
+ DryGainHF, HFScale, calc_rcpQ_from_slope(DryGainHF, 0.75f)
);
ALfilterState_setParams(
&voice->Direct.Params[c].HighPass, ALfilterType_LowShelf,
- DryGainLF, lfscale, calc_rcpQ_from_slope(DryGainLF, 0.75f)
+ DryGainLF, LFScale, calc_rcpQ_from_slope(DryGainLF, 0.75f)
);
}
}
for(i = 0;i < NumSends;i++)
{
- ALfloat hfscale = ATOMIC_LOAD(&props->Send[i].HFReference, almemory_order_relaxed) /
- Frequency;
- ALfloat lfscale = ATOMIC_LOAD(&props->Send[i].LFReference, almemory_order_relaxed) /
- Frequency;
- WetGainHF[i] = maxf(WetGainHF[i], 0.0001f);
- WetGainLF[i] = maxf(WetGainLF[i], 0.0001f);
+ HFScale = ATOMIC_LOAD(&props->Send[i].HFReference, almemory_order_relaxed) / Frequency;
+ LFScale = ATOMIC_LOAD(&props->Send[i].LFReference, almemory_order_relaxed) / Frequency;
+ WetGainHF[i] = maxf(WetGainHF[i], 0.0625f);
+ WetGainLF[i] = maxf(WetGainLF[i], 0.0625f);
for(c = 0;c < num_channels;c++)
{
voice->Send[i].Params[c].FilterType = AF_None;
@@ -750,11 +747,11 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
if(WetGainLF[i] != 1.0f) voice->Send[i].Params[c].FilterType |= AF_HighPass;
ALfilterState_setParams(
&voice->Send[i].Params[c].LowPass, ALfilterType_HighShelf,
- WetGainHF[i], hfscale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f)
+ WetGainHF[i], HFScale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f)
);
ALfilterState_setParams(
&voice->Send[i].Params[c].HighPass, ALfilterType_LowShelf,
- WetGainLF[i], lfscale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f)
+ WetGainLF[i], LFScale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f)
);
}
}
@@ -785,6 +782,7 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
ALfloat WetGain[MAX_SENDS];
ALfloat WetGainHF[MAX_SENDS];
ALfloat WetGainLF[MAX_SENDS];
+ ALfloat HFScale, LFScale;
ALboolean WetGainAuto;
ALboolean WetGainHFAuto;
ALfloat Pitch;
@@ -1208,42 +1206,38 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
}
{
- ALfloat hfscale = ATOMIC_LOAD(&props->Direct.HFReference, almemory_order_relaxed) /
- Frequency;
- ALfloat lfscale = ATOMIC_LOAD(&props->Direct.LFReference, almemory_order_relaxed) /
- Frequency;
- DryGainHF = maxf(DryGainHF, 0.0001f);
- DryGainLF = maxf(DryGainLF, 0.0001f);
+ HFScale = ATOMIC_LOAD(&props->Direct.HFReference, almemory_order_relaxed) / Frequency;
+ LFScale = ATOMIC_LOAD(&props->Direct.LFReference, almemory_order_relaxed) / Frequency;
+ DryGainHF = maxf(DryGainHF, 0.0625f); /* Limit -24dB */
+ DryGainLF = maxf(DryGainLF, 0.0625f);
voice->Direct.Params[0].FilterType = AF_None;
if(DryGainHF != 1.0f) voice->Direct.Params[0].FilterType |= AF_LowPass;
if(DryGainLF != 1.0f) voice->Direct.Params[0].FilterType |= AF_HighPass;
ALfilterState_setParams(
&voice->Direct.Params[0].LowPass, ALfilterType_HighShelf,
- DryGainHF, hfscale, calc_rcpQ_from_slope(DryGainHF, 0.75f)
+ DryGainHF, HFScale, calc_rcpQ_from_slope(DryGainHF, 0.75f)
);
ALfilterState_setParams(
&voice->Direct.Params[0].HighPass, ALfilterType_LowShelf,
- DryGainLF, lfscale, calc_rcpQ_from_slope(DryGainLF, 0.75f)
+ DryGainLF, LFScale, calc_rcpQ_from_slope(DryGainLF, 0.75f)
);
}
for(i = 0;i < NumSends;i++)
{
- ALfloat hfscale = ATOMIC_LOAD(&props->Send[i].HFReference, almemory_order_relaxed) /
- Frequency;
- ALfloat lfscale = ATOMIC_LOAD(&props->Send[i].LFReference, almemory_order_relaxed) /
- Frequency;
- WetGainHF[i] = maxf(WetGainHF[i], 0.0001f);
- WetGainLF[i] = maxf(WetGainLF[i], 0.0001f);
+ HFScale = ATOMIC_LOAD(&props->Send[i].HFReference, almemory_order_relaxed) / Frequency;
+ LFScale = ATOMIC_LOAD(&props->Send[i].LFReference, almemory_order_relaxed) / Frequency;
+ WetGainHF[i] = maxf(WetGainHF[i], 0.0625f);
+ WetGainLF[i] = maxf(WetGainLF[i], 0.0625f);
voice->Send[i].Params[0].FilterType = AF_None;
if(WetGainHF[i] != 1.0f) voice->Send[i].Params[0].FilterType |= AF_LowPass;
if(WetGainLF[i] != 1.0f) voice->Send[i].Params[0].FilterType |= AF_HighPass;
ALfilterState_setParams(
&voice->Send[i].Params[0].LowPass, ALfilterType_HighShelf,
- WetGainHF[i], hfscale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f)
+ WetGainHF[i], HFScale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f)
);
ALfilterState_setParams(
&voice->Send[i].Params[0].HighPass, ALfilterType_LowShelf,
- WetGainLF[i], lfscale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f)
+ WetGainLF[i], LFScale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f)
);
}
}
diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c
index 3ad1e975..4a11d811 100644
--- a/Alc/effects/echo.c
+++ b/Alc/effects/echo.c
@@ -126,7 +126,7 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, co
state->FeedGain = props->Echo.Feedback;
- gain = minf(1.0f - props->Echo.Damping, 0.01f);
+ gain = minf(1.0f - props->Echo.Damping, 0.0625f); /* Limit -24dB */
ALfilterState_setParams(&state->Filter, ALfilterType_HighShelf,
gain, LOWPASSFREQREF/frequency,
calc_rcpQ_from_slope(gain, 0.75f));
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c
index 13826a3b..36683d79 100644
--- a/Alc/effects/equalizer.c
+++ b/Alc/effects/equalizer.c
@@ -138,7 +138,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *
* filters' gain is for the reference frequency, which is the centerpoint
* of the transition band.
*/
- gain = sqrtf(props->Equalizer.LowGain);
+ gain = maxf(sqrtf(props->Equalizer.LowGain), 0.0625f); /* Limit -24dB */
freq_mult = props->Equalizer.LowCutoff/frequency;
ALfilterState_setParams(&state->filter[0][0], ALfilterType_LowShelf,
gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f)
@@ -153,7 +153,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *
state->filter[0][i].a2 = state->filter[0][0].a2;
}
- gain = props->Equalizer.Mid1Gain;
+ gain = maxf(props->Equalizer.Mid1Gain, 0.0625f);
freq_mult = props->Equalizer.Mid1Center/frequency;
ALfilterState_setParams(&state->filter[1][0], ALfilterType_Peaking,
gain, freq_mult, calc_rcpQ_from_bandwidth(
@@ -169,7 +169,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *
state->filter[1][i].a2 = state->filter[1][0].a2;
}
- gain = props->Equalizer.Mid2Gain;
+ gain = maxf(props->Equalizer.Mid2Gain, 0.0625f);
freq_mult = props->Equalizer.Mid2Center/frequency;
ALfilterState_setParams(&state->filter[2][0], ALfilterType_Peaking,
gain, freq_mult, calc_rcpQ_from_bandwidth(
@@ -185,7 +185,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *
state->filter[2][i].a2 = state->filter[2][0].a2;
}
- gain = sqrtf(props->Equalizer.HighGain);
+ gain = maxf(sqrtf(props->Equalizer.HighGain), 0.0625f);
freq_mult = props->Equalizer.HighCutoff/frequency;
ALfilterState_setParams(&state->filter[3][0], ALfilterType_HighShelf,
gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f)
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index 456b25dc..afae2943 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -1089,11 +1089,11 @@ static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device
// Calculate the master filters
hfscale = props->Reverb.HFReference / frequency;
- gainhf = maxf(props->Reverb.GainHF, 0.0001f);
+ gainhf = maxf(props->Reverb.GainHF, 0.0625f); /* Limit -24dB */
ALfilterState_setParams(&State->Filter[0].Lp, ALfilterType_HighShelf,
gainhf, hfscale, calc_rcpQ_from_slope(gainhf, 0.75f));
lfscale = props->Reverb.LFReference / frequency;
- gainlf = maxf(props->Reverb.GainLF, 0.0001f);
+ gainlf = maxf(props->Reverb.GainLF, 0.0625f);
ALfilterState_setParams(&State->Filter[0].Hp, ALfilterType_LowShelf,
gainlf, lfscale, calc_rcpQ_from_slope(gainlf, 0.75f));
for(i = 1;i < 4;i++)