[Scummvm-cvs-logs] SF.net SVN: scummvm:[49156] scummvm/trunk/engines/sci/sound/music.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun May 23 14:22:24 CEST 2010


Revision: 49156
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49156&view=rev
Author:   m_kiewitz
Date:     2010-05-23 12:22:23 +0000 (Sun, 23 May 2010)

Log Message:
-----------
SCI: use priority when queuing up music in sound sci0 -> fixes lsl3 jingle issues

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

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-05-23 11:48:21 UTC (rev 49155)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-05-23 12:22:23 UTC (rev 49156)
@@ -243,14 +243,14 @@
 
 	uint playListCount = _playList.size();
 	uint playListNo = playListCount;
-	bool alreadyPlaying = false;
+	MusicEntry *alreadyPlaying = NULL;
 
 	// searching if sound is already in _playList
 	for (uint i = 0; i < playListCount; i++) {
 		if (_playList[i] == pSnd)
 			playListNo = i;
 		if ((_playList[i]->status == kSoundPlaying) && (_playList[i]->pMidiParser))
-			alreadyPlaying = true;
+			alreadyPlaying = _playList[i];
 	}
 	if (playListNo == playListCount) { // not found
 		_playList.push_back(pSnd);
@@ -261,13 +261,20 @@
 
 	if (pSnd->pMidiParser) {
 		if ((_soundVersion <= SCI_VERSION_0_LATE) && (alreadyPlaying)) {
-			// if any music is already playing, SCI0 queues music and plays it after the current music has finished
-			//  done by SoundCommandParser::updateSci0Cues()
-			// Example of such case: iceman room 14
-			// FIXME: this code is supposed to also take a look at priority and pause currently playing sound accordingly
-			pSnd->isQueued = true;
-			pSnd->status = kSoundPaused;
-			return;
+			// Music already playing in SCI0?
+			if (pSnd->priority > alreadyPlaying->priority) {
+				// And new priority higher? pause previous music and play new one immediately
+				// Example of such case: lsl3, when getting points (jingle is played then)
+				soundPause(alreadyPlaying);
+				alreadyPlaying->isQueued = true;
+			} else {
+				// And new priority equal or lower? queue up music and play it afterwards done by
+				//  SoundCommandParser::updateSci0Cues()
+				// Example of such case: iceman room 14
+				pSnd->isQueued = true;
+				pSnd->status = kSoundPaused;
+				return;
+			}
 		}
 	}
 


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