diff options
author | Johannes Schickel | 2011-08-09 23:57:22 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-08-10 00:00:12 +0200 |
commit | b95bbb2ace6a240da8b6ee54ceb66c6ab2484ab7 (patch) | |
tree | 0c61f39f83d39551246c265b4ec97e15fc8e457b /audio/softsynth | |
parent | 74560278b2d7d14f459bafc7d5eed63bc6a363b0 (diff) | |
download | scummvm-rg350-b95bbb2ace6a240da8b6ee54ceb66c6ab2484ab7.tar.gz scummvm-rg350-b95bbb2ace6a240da8b6ee54ceb66c6ab2484ab7.tar.bz2 scummvm-rg350-b95bbb2ace6a240da8b6ee54ceb66c6ab2484ab7.zip |
CMS: Do proper clipping of the sound data on generation.
This fixes some overflows/underflows which resulted in crackling.
Diffstat (limited to 'audio/softsynth')
-rw-r--r-- | audio/softsynth/cms.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/audio/softsynth/cms.cpp b/audio/softsynth/cms.cpp index 67eacd1a41..889f19a6f9 100644 --- a/audio/softsynth/cms.cpp +++ b/audio/softsynth/cms.cpp @@ -244,8 +244,8 @@ void CMSEmulator::update(int chip, int16 *buffer, int length) { } } /* write sound data to the buffer */ - buffer[j*2] += output_l / 6; - buffer[j*2+1] += output_r / 6; + buffer[j*2+0] = CLIP<int>(buffer[j*2+0] + output_l / 6, -32768, 32767); + buffer[j*2+1] = CLIP<int>(buffer[j*2+1] + output_r / 6, -32768, 32767); } } |