diff --git a/Alc/ALu.c b/Alc/ALu.c index 4c23dad4..c5915c1b 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -234,7 +234,6 @@ ALvoid aluInitPanning(ALCdevice *Device) Channel Speaker2Chan[OUTPUTCHANNELS]; ALfloat Alpha, Theta; ALint pos, offset; - ALfloat maxout; ALuint s, s2; for(s = 0;s < OUTPUTCHANNELS;s++) @@ -381,23 +380,25 @@ ALvoid aluInitPanning(ALCdevice *Device) assert(0); } - maxout = 1.0f; - for(s = 0;s < OUTPUTCHANNELS;s++) + if(GetConfigValueBool(NULL, "scalemix", 0)) { - ALfloat out = 0.0f; - for(s2 = 0;s2 < OUTPUTCHANNELS;s2++) - out += Device->ChannelMatrix[s2][s]; - maxout = __max(maxout, out); - } + ALfloat maxout = 1.0f; + 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; + maxout = 1.0f/maxout; + for(s = 0;s < OUTPUTCHANNELS;s++) + { + for(s2 = 0;s2 < OUTPUTCHANNELS;s2++) + Device->ChannelMatrix[s2][s] *= maxout; + } } - for(pos = 0; pos < LUT_NUM; pos++) { /* clear all values */ diff --git a/alsoftrc.sample b/alsoftrc.sample index 50008b8e..648126fe 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -102,6 +102,15 @@ # will cause stereo sounds to only play out the front speakers. #stereodup = false +## scalemix: +# Sets whether to scale the remixed output. When the final mix is written to +# the device, the multi-channel data is remixed so pure-virtual channels (eg. +# front-center on stereo output) are remixed and added to available channels +# (eg. front-left and front-right). Scaling helps ensure that no single source +# will put out more than 100% on a given physical channel. This can cause a +# noticeable reduction in overall volume, however, so it is off by default. +#scalemix = false + ## drivers: # Sets the backend driver list order, comma-seperated. Unknown backends and # duplicated names are ignored. Unlisted backends won't be considered for use