diff options
author | Alyssa Milburn | 2011-08-17 09:28:51 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-08-17 09:28:51 +0200 |
commit | ae287ccee58ebf68ab6125e5bbb4d8a44874330e (patch) | |
tree | 2f4cee4b2940466b8a578962e0174c6f89077a40 /audio/softsynth/cms.cpp | |
parent | f5255288eabc0527c4c6b727a9db6b8d09a31206 (diff) | |
parent | e36832bbf84cba88fe6b17e1634fab0d550f13df (diff) | |
download | scummvm-rg350-ae287ccee58ebf68ab6125e5bbb4d8a44874330e.tar.gz scummvm-rg350-ae287ccee58ebf68ab6125e5bbb4d8a44874330e.tar.bz2 scummvm-rg350-ae287ccee58ebf68ab6125e5bbb4d8a44874330e.zip |
Merge remote-tracking branch 'origin/master' into soccer
Conflicts:
engines/scumm/he/logic_he.cpp
engines/scumm/he/logic_he.h
Diffstat (limited to 'audio/softsynth/cms.cpp')
-rw-r--r-- | audio/softsynth/cms.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/audio/softsynth/cms.cpp b/audio/softsynth/cms.cpp index 67eacd1a41..a675da3f03 100644 --- a/audio/softsynth/cms.cpp +++ b/audio/softsynth/cms.cpp @@ -163,19 +163,15 @@ void CMSEmulator::update(int chip, int16 *buffer, int length) { struct SAA1099 *saa = &_saa1099[chip]; int j, ch; + if (chip == 0) { + memset(buffer, 0, sizeof(int16)*length*2); + } + /* if the channels are disabled we're done */ if (!saa->all_ch_enable) { - /* init output data */ - if (chip == 0) { - memset(buffer, 0, sizeof(int16)*length*2); - } return; } - if (chip == 0) { - memset(buffer, 0, sizeof(int16)*length*2); - } - for (ch = 0; ch < 2; ch++) { switch (saa->noise_params[ch]) { case 0: saa->noise[ch].freq = 31250.0 * 2; break; @@ -244,8 +240,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); } } |