From 3d59021702c2f6ea4dbdf5d2f6231fd945370e27 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 27 Aug 2016 06:28:04 -0700 Subject: Clamp the maximum mixing gain boost to 16 The combined source and listener gains now can't exceed a multiplier of 16 (~24dB). This is to avoid mixes getting out of control with large volume boosts, which reduces the effective precision given by floating-point. --- OpenAL32/Include/alu.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenAL32/Include') diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 1d922881..70ce7059 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -173,6 +173,8 @@ typedef void (*HrtfDirectMixerFunc)(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALfloat (*restrict Values)[2], ALuint BufferSize); +#define GAIN_MIX_MAX (16.0f) /* +24dB */ + #define GAIN_SILENCE_THRESHOLD (0.00001f) /* -100dB */ #define SPEEDOFSOUNDMETRESPERSEC (343.3f) -- cgit v1.2.3