aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 2bb502eb..ebe7d199 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -509,6 +509,7 @@ void EnableRTPrio(ALint level)
static void SetupChannelMatrix(ALCdevice *Device)
{
+ ALfloat maxout;
ALuint s, s2;
for(s = 0;s < OUTPUTCHANNELS;s++)
@@ -587,6 +588,21 @@ static void SetupChannelMatrix(ALCdevice *Device)
default:
assert(0);
}
+
+ for(s = 0;s < OUTPUTCHANNELS;s++)
+ {
+ ALfloat out = 0.0f;
+ for(s2 = 0;s2 < OUTPUTCHANNELS;s2++)
+ out += Device->ChannelMatrix[s2][s];
+ maxout = __max(maxout, out);
+ }
+
+ maxout = 1.0f/maxout;
+ for(s = 0;s < OUTPUTCHANNELS;s++)
+ {
+ for(s2 = 0;s2 < OUTPUTCHANNELS;s2++)
+ Device->ChannelMatrix[s2][s] *= maxout;
+ }
}
/*