diff options
-rw-r--r-- | scumm/smush/channel.h | 2 | ||||
-rw-r--r-- | scumm/smush/imuse_channel.cpp | 43 | ||||
-rw-r--r-- | scumm/smush/smush_mixer.cpp | 4 |
3 files changed, 11 insertions, 38 deletions
diff --git a/scumm/smush/channel.h b/scumm/smush/channel.h index c0ce8ca7fb..b0821ef6dc 100644 --- a/scumm/smush/channel.h +++ b/scumm/smush/channel.h @@ -129,7 +129,7 @@ public: void getSoundData(int8 *sound_buffer, int32 size); int32 getRate() { return _rate; } bool getParameters(int32 &rate, bool &stereo, bool &is_16bit) { - rate = _frequency; + rate = _rate; stereo = (_channels == 2); is_16bit = (_bitsize > 8); return true; diff --git a/scumm/smush/imuse_channel.cpp b/scumm/smush/imuse_channel.cpp index 526d6d5e1b..e4c0000a06 100644 --- a/scumm/smush/imuse_channel.cpp +++ b/scumm/smush/imuse_channel.cpp @@ -322,27 +322,13 @@ void ImuseChannel::getSoundData(int16 *snd, int32 size) { if (_dataSize <= 0 || _bitsize <= 8) error("invalid call to imuse_channel::read_sound_data()"); if (_channels == 2) size *= 2; byte * buf = (byte*)snd; - if (_rate == 11025) { - // TODO / FIXME: Instead of upsampling here in the worst possible way - // (by repeating samples), we should pass the 11khz data to the mixer, - // and leave the upsampling to the mixer. - for (int32 i = 0; i < size; i++) { - byte sample1 = *(_sbuffer + i * 2); - byte sample2 = *(_sbuffer + i * 2 + 1); - uint16 sample = (uint16)(((int16)((sample1 << 8) | sample2) * _volume) >> 8); - buf[i * 4 + 0] = (byte)(sample >> 8); - buf[i * 4 + 1] = (byte)(sample & 0xff); - buf[i * 4 + 2] = buf[i * 4 + 0]; - buf[i * 4 + 3] = buf[i * 4 + 1]; - } - } else { - for (int32 i = 0; i < size; i++){ - byte sample1 = *(_sbuffer + i * 2); - byte sample2 = *(_sbuffer + i * 2 + 1); - uint16 sample = (uint16)(((int16)((sample1 << 8) | sample2) * _volume) >> 8); - buf[i * 2 + 0] = (byte)(sample >> 8); - buf[i * 2 + 1] = (byte)(sample & 0xff); - } + + for (int32 i = 0; i < size; i++){ + byte sample1 = *(_sbuffer + i * 2); + byte sample2 = *(_sbuffer + i * 2 + 1); + uint16 sample = (uint16)(((int16)((sample1 << 8) | sample2) * _volume) >> 8); + buf[i * 2 + 0] = (byte)(sample >> 8); + buf[i * 2 + 1] = (byte)(sample & 0xff); } delete []_sbuffer; assert(_sbufferSize == 2 * size); @@ -354,18 +340,9 @@ void ImuseChannel::getSoundData(int16 *snd, int32 size) { void ImuseChannel::getSoundData(int8 *snd, int32 size) { if (_dataSize <= 0 || _bitsize > 8) error("invalid call to imuse_channel::read_sound_data()"); if (_channels == 2) size *= 2; - if (_rate == 11025) { - // TODO / FIXME: Instead of upsampling here in the worst possible way - // (by repeating samples), we should pass the 11khz data to the mixer, - // and leave the upsampling to the mixer. - for (int32 i = 0; i < size; i++) { - snd[i * 2] = (int8)(((int8)(_sbuffer[i] ^ 0x80) * _volume) >> 8) ^ 0x80; - snd[i * 2 + 1] = snd[i * 2]; - } - } else { - for (int32 i = 0; i < size; i++){ - snd[i] = (int8)(((int8)(_sbuffer[i] ^ 0x80) * _volume) >> 8) ^ 0x80; - } + + for (int32 i = 0; i < size; i++){ + snd[i] = (int8)(((int8)(_sbuffer[i] ^ 0x80) * _volume) >> 8) ^ 0x80; } delete []_sbuffer; _sbuffer = 0; diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index e5a41799d4..78f6c02e51 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -117,8 +117,6 @@ bool SmushMixer::handleFrame() { if (is_short) { data = malloc(size * (stereo ? 2 : 1) * 4); _channels[i].chan->getSoundData((int16 *)data, size); - if (_channels[i].chan->getRate() == 11025) - size *= 2; size *= stereo ? 4 : 2; flags |= SoundMixer::FLAG_16BITS; @@ -126,8 +124,6 @@ bool SmushMixer::handleFrame() { } else { data = malloc(size * (stereo ? 2 : 1) * 2); _channels[i].chan->getSoundData((int8 *)data, size); - if (_channels[i].chan->getRate() == 11025) - size *= 2; size *= stereo ? 2 : 1; flags |= SoundMixer::FLAG_UNSIGNED; |