- 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
This commit is contained in:
ramapcsx2 2010-10-18 12:27:31 +00:00
parent 8c58c8ee3c
commit 921e865c8e
1 changed files with 5 additions and 2 deletions

View File

@ -63,9 +63,12 @@ __forceinline
#endif #endif
StereoOut32 clamp_mix( const StereoOut32& sample, u8 bitshift ) 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( return StereoOut32(
GetClamped( sample.Left, -0x8000<<bitshift, 0x7fff<<bitshift ), GetClamped( sample.Left, -0x7f00<<bitshift, 0x7f00<<bitshift ),
GetClamped( sample.Right, -0x8000<<bitshift, 0x7fff<<bitshift ) GetClamped( sample.Right, -0x7f00<<bitshift, 0x7f00<<bitshift )
); );
} }