[Scummvm-cvs-logs] SF.net SVN: scummvm:[46473] scummvm/trunk/engines/sci/sfx

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Dec 22 01:12:59 CET 2009


Revision: 46473
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46473&view=rev
Author:   thebluegr
Date:     2009-12-22 00:12:59 +0000 (Tue, 22 Dec 2009)

Log Message:
-----------
Some bugfixes to the new music code

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sfx/music.cpp
    scummvm/trunk/engines/sci/sfx/soundcmd.cpp

Modified: scummvm/trunk/engines/sci/sfx/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.cpp	2009-12-21 22:40:52 UTC (rev 46472)
+++ scummvm/trunk/engines/sci/sfx/music.cpp	2009-12-22 00:12:59 UTC (rev 46473)
@@ -446,6 +446,7 @@
 	// Remove sound from playlist
 	for (i = 0; i < sz; i++) {
 		if (_playList[i] == pSnd) {
+			delete _playList[i]->soundRes;
 			_playList.remove_at(i);
 			break;
 		}

Modified: scummvm/trunk/engines/sci/sfx/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2009-12-21 22:40:52 UTC (rev 46472)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2009-12-22 00:12:59 UTC (rev 46473)
@@ -276,6 +276,11 @@
 	PUT_SEL32(_segMan, obj, handle, obj);
 
 #ifndef USE_OLD_MUSIC_FUNCTIONS
+	// Check if a track with the same sound object is already playing
+	int prevTrack = _music->findListSlot(obj);
+	if (prevTrack > -1)
+		_music->soundKill(_music->_playList[prevTrack]);
+
 	MusicEntry *newSound = new MusicEntry();
 	newSound->soundRes = 0;
 	if (_resMan->testResource(ResourceId(kResourceTypeSound, number)))
@@ -284,9 +289,6 @@
 	newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF;
 	newSound->pStreamAud = 0;
 	newSound->pMidiParser = 0;
-
-	// TODO
-	//_music->soundKill(newSound);
 	_music->_playList.push_back(newSound);
 
 	if (newSound->soundRes)
@@ -424,8 +426,6 @@
 
 	if (!GET_SEL32(_segMan, obj, nodePtr).isNull()) {
 		_music->soundKill(_music->_playList[slot]);
-		delete _music->_playList[slot]->soundRes;
-		_music->_playList.remove_at(slot);
 		PUT_SEL32(_segMan, obj, nodePtr, NULL_REG);
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list