diff -ur ScummVM-cvs20021117/scummvm/sound/mixer.cpp ScummVM-cvs20021117+hack/scummvm/sound/mixer.cpp
old
|
new
|
|
837 | 837 | |
838 | 838 | while ((_posInFrame < _synth.pcm.length) && (len > 0)) { |
839 | 839 | int16 sample = (int16)((scale_sample(*ch) * volume) / 32); |
840 | | *data++ += sample; |
841 | | *data++ += sample; |
| 840 | *data = clamped_add_16(*data, sample); |
| 841 | data++; |
| 842 | *data = clamped_add_16(*data, sample); |
| 843 | data++; |
842 | 844 | len--; |
843 | 845 | ch++; |
844 | 846 | _posInFrame++; |
… |
… |
|
957 | 959 | ch = _synth.pcm.samples[0] + _posInFrame; |
958 | 960 | while ((_posInFrame < _synth.pcm.length) && (len > 0)) { |
959 | 961 | int16 sample = (int16)((scale_sample(*ch++) * volume) / 32); |
960 | | *data++ += sample; |
961 | | *data++ += sample; |
| 962 | *data = clamped_add_16(*data, sample); |
| 963 | data++; |
| 964 | *data = clamped_add_16(*data, sample); |
| 965 | data++; |
962 | 966 | len--; |
963 | 967 | _posInFrame++; |
964 | 968 | } |
… |
… |
|
1083 | 1087 | // Mix the samples in |
1084 | 1088 | for (uint i = 0; i < len; i++) { |
1085 | 1089 | int16 sample = (int16) ((int32) samples[i * channels] * volume / 256); |
1086 | | *data++ += sample; |
| 1090 | *data = clamped_add_16(*data, sample); |
| 1091 | data++; |
1087 | 1092 | if (channels > 1) |
1088 | 1093 | sample = (int16) ((int32) samples[i * channels + 1] * volume / 256); |
1089 | | *data++ += sample; |
| 1094 | *data = clamped_add_16(*data, sample); |
| 1095 | data++; |
1090 | 1096 | } |
1091 | 1097 | |
1092 | 1098 | delete [] samples; |