diff options
author | Paweł Kołodziejski | 2004-01-07 19:38:37 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-01-07 19:38:37 +0000 |
commit | 81c8c722f585d34d553535c5331501e6d6fd8c02 (patch) | |
tree | 22b3f8b1535f0f18852350caad331db8c5ca5259 /scumm | |
parent | 63fbde359adfae8a545977f7a5092216b696368a (diff) | |
download | scummvm-rg350-81c8c722f585d34d553535c5331501e6d6fd8c02.tar.gz scummvm-rg350-81c8c722f585d34d553535c5331501e6d6fd8c02.tar.bz2 scummvm-rg350-81c8c722f585d34d553535c5331501e6d6fd8c02.zip |
fixed size result related bug in imuse digi
svn-id: r12224
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/imuse_digi/dimuse.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index f8dc46992d..80b02150a4 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -133,20 +133,16 @@ void IMuseDigital::callback() { do { if (_sound->getBits(_track[l].soundHandle) == 12) { byte *ptr = NULL; + mixer_size += _track[l].mod; - int length = (((mixer_size * 3) / 4) / 3) * 3; // == (mixer_size / 4) * 3 != (mixer_size / 3) * 4 - _track[l].mod = ((mixer_size * 3) / 4) - length; - mixer_size = length; + int mixer_size_12 = (mixer_size * 3) / 4; + int length = (mixer_size_12 / 3) * 4; + _track[l].mod = mixer_size - length; int32 offset = (_track[l].regionOffset * 3) / 4; - result = _sound->getDataFromRegion(_track[l].soundHandle, _track[l].curRegion, &ptr, offset, mixer_size); - int32 result2 = BundleCodecs::decode12BitsSample(ptr, &data, result); - result = (result * 4) / 3; - if (result != result2) { - debug(5, "result: %d, result2: %d", result, result2); - result &= ~1; - } - mixer_size = (mixer_size * 4) / 3; + int result2 = _sound->getDataFromRegion(_track[l].soundHandle, _track[l].curRegion, &ptr, offset, mixer_size_12); + result = BundleCodecs::decode12BitsSample(ptr, &data, result2); + free(ptr); } else if (_sound->getBits(_track[l].soundHandle) == 16) { result = _sound->getDataFromRegion(_track[l].soundHandle, _track[l].curRegion, &data, _track[l].regionOffset, mixer_size); @@ -166,6 +162,9 @@ void IMuseDigital::callback() { } } + if (result > mixer_size) + result = mixer_size; + if (_scumm->_mixer->isReady()) { _scumm->_mixer->setChannelVolume(_track[l].handle, _track[l].vol / 1000); _scumm->_mixer->setChannelPan(_track[l].handle, pan); @@ -181,9 +180,6 @@ void IMuseDigital::callback() { break; } mixer_size -= result; - if (mixer_size < 0) - mixer_size = 0; - assert(mixer_size >= 0); } while (mixer_size != 0); } } |