From d6db8560c61fae5597ab108dbf8adf745d1728d4 Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Tue, 1 Oct 2002 06:46:50 +0000 Subject: fixed ending of non loop sounds svn-id: r5057 --- scumm/imuse.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 819c8eb89a..1b5f848352 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -4866,14 +4866,16 @@ void IMuseDigital::handler() { } uint32 new_size = _channel[l]._mixerSize; + uint32 mixer_size = new_size; if (_channel[l]._offset + _channel[l]._mixerSize > _channel[l]._size) { new_size = _channel[l]._size - _channel[l]._offset; if(_channel[l]._isLoop == false) { _channel[l]._toBeRemoved = true; + mixer_size = new_size; } } - byte *buf = (byte*)malloc(_channel[l]._mixerSize); + byte *buf = (byte*)malloc(mixer_size); memcpy(buf, _channel[l]._data + _channel[l]._offset, new_size); if ((new_size != _channel[l]._mixerSize) && (_channel[l]._isLoop == true)) { memcpy(buf + new_size, _channel[l]._data, _channel[l]._mixerSize - new_size); @@ -4896,10 +4898,10 @@ void IMuseDigital::handler() { } if (new_mixer) { - _scumm->_mixer->playStream(NULL, _channel[l]._mixerTrack, buf, _channel[l]._mixerSize, + _scumm->_mixer->playStream(NULL, _channel[l]._mixerTrack, buf, mixer_size, _channel[l]._freq, _channel[l]._mixerFlags); } else { - _scumm->_mixer->append(_channel[l]._mixerTrack, buf, _channel[l]._mixerSize, + _scumm->_mixer->append(_channel[l]._mixerTrack, buf, mixer_size, _channel[l]._freq, _channel[l]._mixerFlags); } _scumm->_system->unlock_mutex(_scumm->_mixer->_mutex); -- cgit v1.2.3