From 921e865c8e0e704ad25e4c2e696f3f88be1d4fc3 Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Mon, 18 Oct 2010 12:27:31 +0000 Subject: [PATCH] SPU2-X: - Prevent the mixer from clamping to the maximum possible range as some audio output modules hate that and start clipping. Notably portaudio is unaffected in tests but all the MS APIs not ;) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3938 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/spu2-x/src/Mixer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/spu2-x/src/Mixer.cpp b/plugins/spu2-x/src/Mixer.cpp index 33652cc6b..d34ac662a 100644 --- a/plugins/spu2-x/src/Mixer.cpp +++ b/plugins/spu2-x/src/Mixer.cpp @@ -63,9 +63,12 @@ __forceinline #endif StereoOut32 clamp_mix( const StereoOut32& sample, u8 bitshift ) { + // We should clampify between -0x8000 and 0x7fff, however some audio output + // modules or sound drivers could (will :p) overshoot with that. So giving it a small safety. + return StereoOut32( - GetClamped( sample.Left, -0x8000<