[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,1.20,1.21

Pawe? Ko?odziejski aquadran at users.sourceforge.net
Mon Sep 30 23:47:04 CEST 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv13521

Modified Files:
	imuse.cpp 
Log Message:
fixed ending of non loop sounds

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- imuse.cpp	30 Sep 2002 22:35:32 -0000	1.20
+++ imuse.cpp	1 Oct 2002 06:46:50 -0000	1.21
@@ -4866,14 +4866,16 @@
 			}
 
 			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 @@
 			}
 
 			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);





More information about the Scummvm-git-logs mailing list