diff options
author | Max Horn | 2003-07-02 11:04:48 +0000 |
---|---|---|
committer | Max Horn | 2003-07-02 11:04:48 +0000 |
commit | fe8719d7bd521316c5adbddab489c59fbba20512 (patch) | |
tree | 86e19222b16b2a6abbcbfc057a863c52ddc269a6 /scumm | |
parent | 01f992db9bddf16c1d3a59a2a1a4354c4f4e7f7d (diff) | |
download | scummvm-rg350-fe8719d7bd521316c5adbddab489c59fbba20512.tar.gz scummvm-rg350-fe8719d7bd521316c5adbddab489c59fbba20512.tar.bz2 scummvm-rg350-fe8719d7bd521316c5adbddab489c59fbba20512.zip |
more cleanup
svn-id: r8707
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/imuse_digi.cpp | 25 | ||||
-rw-r--r-- | scumm/sound.cpp | 4 |
2 files changed, 15 insertions, 14 deletions
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp index d02e335925..e182a650e9 100644 --- a/scumm/imuse_digi.cpp +++ b/scumm/imuse_digi.cpp @@ -870,8 +870,10 @@ void IMuseDigital::startSound(int sound) { if (READ_UINT32(ptr) == MKID('Crea')) { _channel[l]._bits = 8; + // Always output stereo, because in IMuseDigital::handler the data is expected to be in stereo, and + // different volumes for the left and right channel are being applied. + // That might also be the justification for specifying FLAG_REVERSE_STEREO here. Not sure. _channel[l]._channels = 2; - _channel[l]._mixerSize = (22050 / 5) * 2; _channel[l]._mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO | SoundMixer::FLAG_UNSIGNED; byte * t_ptr= readCreativeVocFile(ptr, size, _channel[l]._freq, _channel[l]._numLoops); @@ -880,10 +882,8 @@ void IMuseDigital::startSound(int sound) { } else if (_channel[l]._freq == 10989) { _channel[l]._freq = 11025; } - - if (_channel[l]._freq == 11025) { - _channel[l]._mixerSize /= 2; - } + _channel[l]._mixerSize = (_channel[l]._freq / 5) * 2; + size *= 2; _channel[l]._data = (byte *)malloc(size); for (t = 0; t < size / 2; t++) { @@ -971,14 +971,17 @@ void IMuseDigital::startSound(int sound) { } } } - _channel[l]._mixerSize = (22050 / 5) * 2; + + // Always output stereo, because in IMuseDigital::handler the data is expected to be in stereo, and + // different volumes for the left and right channel are being applied. + // That might also be the justification for specifying FLAG_REVERSE_STEREO here. Not sure. _channel[l]._mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO; + _channel[l]._mixerSize = (_channel[l]._freq / 5) * 2; if (_channel[l]._bits == 12) { _channel[l]._mixerSize *= 2; _channel[l]._mixerFlags |= SoundMixer::FLAG_16BITS; _channel[l]._size = _scumm->_sound->decode12BitsSample(ptr, &_channel[l]._data, size, (_channel[l]._channels == 2) ? false : true); - } - if (_channel[l]._bits == 8) { + } else if (_channel[l]._bits == 8) { _channel[l]._mixerFlags |= SoundMixer::FLAG_UNSIGNED; if (_channel[l]._channels == 1) { size *= 2; @@ -993,10 +996,8 @@ void IMuseDigital::startSound(int sound) { memcpy(_channel[l]._data, ptr, size); } _channel[l]._size = size; - } - if (_channel[l]._freq == 11025) { - _channel[l]._mixerSize /= 2; - } + } else + error("Can't handle %d bit samples in iMuseDigital", _channel[l]._bits); } _channel[l]._toBeRemoved = false; _channel[l]._used = true; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 7f424c7875..e8705be378 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -975,7 +975,7 @@ bool Sound::isSfxFinished() const { return !_scumm->_mixer->hasActiveSFXChannel(); } -uint32 Sound::decode12BitsSample(byte *src, byte **dst, uint32 size, bool stereo = false) { +uint32 Sound::decode12BitsSample(byte *src, byte **dst, uint32 size, bool stereo) { uint32 s_size = (size / 3) * 4; uint32 loop_size = s_size / 4; if (stereo) { @@ -1178,7 +1178,7 @@ void Sound::bundleMusicHandler(Scumm *scumm) { byte *buffer = NULL; uint32 final_size; if (_bundleMusicSampleBits == 12) { - final_size = decode12BitsSample(ptr, &buffer, _outputMixerSize); + final_size = decode12BitsSample(ptr, &buffer, _outputMixerSize, false); } else if (_bundleMusicSampleBits == 16) { buffer = (byte *)malloc(_outputMixerSize); final_size = _outputMixerSize; |