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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Jun 19 22:23:55 CEST 2010


Revision: 50062
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50062&view=rev
Author:   m_kiewitz
Date:     2010-06-19 20:23:55 +0000 (Sat, 19 Jun 2010)

Log Message:
-----------
SCI: fixing another uninitialized variable usage issue - also limiting reset velocity to used channels only, same is true for setting voice count

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

Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-06-19 20:22:04 UTC (rev 50061)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-06-19 20:23:55 UTC (rev 50062)
@@ -81,10 +81,6 @@
 	_channelRemap[9] = 9; // never map channel 9, because that's used for percussion
 	_channelRemap[15] = 15; // never map channel 15, because thats used by sierra internally
 
-	// we can't do this later, because otherwise we really send to unmapped channels
-	if (_pSnd)
-		setVolume(_pSnd->volume);
-
 	if (channelFilterMask) {
 		// SCI0 only has 1 data stream, but we need to filter out channels depending on music hardware selection
 		midiFilterChannels(channelFilterMask);
@@ -98,24 +94,28 @@
 		setTrack(0);
 	_loopTick = 0;
 
+	return true;
+}
+
+void MidiParser_SCI::sendInitCommands() {
 	if (_pSnd) {
 		if (_soundVersion <= SCI_VERSION_0_LATE) {
 			// Set initial voice count
-			for (int i = 0; i < 16; ++i) {
+			for (int i = 0; i < 15; ++i) {
 				byte voiceCount = 0;
-				if (channelFilterMask & (1 << i))
-					voiceCount = psnd->soundRes->getInitialVoiceCount(i);
-				_driver->send(0xB0 | i, 0x4B, voiceCount);
+				if (_channelUsed[i]) {
+					voiceCount = _pSnd->soundRes->getInitialVoiceCount(i);
+					_driver->send(0xB0 | i, 0x4B, voiceCount);
+				}
 			}
 		}
+	}
 
-		// Send a velocity off signal to all channels
-		for (int i = 0; i < 16; ++i) {
-			_driver->send(0xB0 | i, 0x4E, 0);	// Reset velocity
-		}
+	// Send a velocity off signal to all channels
+	for (int i = 0; i < 15; ++i) {
+		if (_channelUsed[i])
+			sendToDriver(0xB0 | i, 0x4E, 0);	// Reset velocity
 	}
-
-	return true;
 }
 
 void MidiParser_SCI::unloadMusic() {

Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.h
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.h	2010-06-19 20:22:04 UTC (rev 50061)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.h	2010-06-19 20:23:55 UTC (rev 50062)
@@ -59,6 +59,7 @@
 	bool loadMusic(byte *, uint32) {
 		return false;
 	}
+	void sendInitCommands();
 	void unloadMusic();
 	void setVolume(byte volume);
 	void stop() {

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-06-19 20:22:04 UTC (rev 50061)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-06-19 20:23:55 UTC (rev 50062)
@@ -326,9 +326,10 @@
 		if (pSnd->pMidiParser) {
 			pSnd->pMidiParser->tryToOwnChannels();
 			pSnd->pMidiParser->setVolume(pSnd->volume);
-			if (pSnd->status == kSoundStopped)
+			if (pSnd->status == kSoundStopped) {
+				pSnd->pMidiParser->sendInitCommands();
 				pSnd->pMidiParser->jumpToTick(0);
-			else
+			} else
 				// Fast forward to the last position and perform associated events when loading
 				pSnd->pMidiParser->jumpToTick(pSnd->ticker, true);
 		}


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