diff options
-rw-r--r-- | Alc/ALu.c | 10 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 3 |
3 files changed, 10 insertions, 7 deletions
@@ -1098,8 +1098,8 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop RoomAirAbsorption[i] = SendSlots[i]->Params.AirAbsorptionGainHF; if(SendSlots[i]->Params.DecayHFLimit && RoomAirAbsorption[i] < 1.0f) { - ALfloat limitRatio = log10f(0.001f)/*-60 dB*/ / (log10f(RoomAirAbsorption[i]) * - DecayDistance[i]); + ALfloat limitRatio = log10f(REVERB_DECAY_GAIN) / + (log10f(RoomAirAbsorption[i]) * DecayDistance[i]); limitRatio = minf(limitRatio, SendSlots[i]->Params.DecayHFRatio); DecayHFDistance[i] = minf(DecayHFDistance[i], limitRatio*DecayDistance[i]); } @@ -1258,15 +1258,15 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop if(!(DecayDistance[i] > 0.0f)) continue; - gain = powf(0.001f/*-60dB*/, meters_base/DecayDistance[i]); + gain = powf(REVERB_DECAY_GAIN, meters_base/DecayDistance[i]); WetGain[i] *= gain; /* Yes, the wet path's air absorption is applied with * WetGainAuto on, rather than WetGainHFAuto. */ if(gain > 0.0f) { - ALfloat gainhf = powf(0.001f/*-60dB*/, meters_base/DecayHFDistance[i]) / gain; - WetGainHF[i] *= minf(gainhf, 1.0f); + ALfloat gainhf = powf(REVERB_DECAY_GAIN, meters_base/DecayHFDistance[i]); + WetGainHF[i] *= minf(gainhf / gain, 1.0f); } } } diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 0d0ca277..39daff53 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -645,7 +645,7 @@ static ALboolean ALreverbState_deviceUpdate(ALreverbState *State, ALCdevice *Dev */ static inline ALfloat CalcDecayCoeff(const ALfloat length, const ALfloat decayTime) { - return powf(0.001f/*-60 dB*/, length/decayTime); + return powf(REVERB_DECAY_GAIN, length/decayTime); } /* Calculate a decay length from a coefficient and the time until the decay @@ -653,7 +653,7 @@ static inline ALfloat CalcDecayCoeff(const ALfloat length, const ALfloat decayTi */ static inline ALfloat CalcDecayLength(const ALfloat coeff, const ALfloat decayTime) { - return log10f(coeff) * decayTime / log10f(0.001f)/*-60 dB*/; + return log10f(coeff) * decayTime / log10f(REVERB_DECAY_GAIN); } /* Calculate an attenuation to be applied to the input of any echo models to diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 30b245a5..c44f94d4 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -348,6 +348,9 @@ typedef void (*HrtfDirectMixerFunc)(ALfloat *restrict LeftOut, ALfloat *restrict #define SPEEDOFSOUNDMETRESPERSEC (343.3f) #define AIRABSORBGAINHF (0.99426f) /* -0.05dB */ +/* Target gain for the reverb decay feedback reaching the decay time. */ +#define REVERB_DECAY_GAIN (0.001f) /* -60 dB */ + #define FRACTIONBITS (12) #define FRACTIONONE (1<<FRACTIONBITS) #define FRACTIONMASK (FRACTIONONE-1) |