[Scummvm-cvs-logs] SF.net SVN: scummvm: [31473] scummvm/trunk/engines/kyra/sound.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Apr 10 21:33:06 CEST 2008


Revision: 31473
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31473&view=rev
Author:   lordhoto
Date:     2008-04-10 12:33:06 -0700 (Thu, 10 Apr 2008)

Log Message:
-----------
- fixed valgrind warning
- reduced midi volume fadeout from 2s to 1s like HoF is doing (Kyra1 should use the same value)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/sound.cpp

Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2008-04-10 19:15:14 UTC (rev 31472)
+++ scummvm/trunk/engines/kyra/sound.cpp	2008-04-10 19:33:06 UTC (rev 31473)
@@ -155,6 +155,9 @@
 	
 	_nativeMT32 = _useC55 = false;
 
+	_fadeStartTime = 0;
+	_fadeMusicOut = false;
+
 	memset(_channel, 0, sizeof(_channel));
 	memset(_channelVolume, 50, sizeof(_channelVolume));
 	_channelVolume[10] = 100;
@@ -381,26 +384,28 @@
 	Common::StackLock lock(sound->_mutex);
 
 	// this should be set to the fadeToBlack value
-	static const uint32 musicFadeTime = 2 * 1000;
+	static const uint32 musicFadeTime = 1 * 1000;
 
-	if (sound->_fadeMusicOut && sound->_fadeStartTime + musicFadeTime > sound->_vm->_system->getMillis()) {
-		byte volume = (byte)((musicFadeTime - (sound->_vm->_system->getMillis() - sound->_fadeStartTime)) * sound->_musicVolume / musicFadeTime);
-		sound->updateChannelVolume(volume);
-	} else if (sound->_fadeStartTime) {
-		sound->_fadeStartTime = 0;
-		sound->_fadeMusicOut = false;
-		sound->_isMusicPlaying = false;
+	if (sound->_fadeMusicOut) {
+		if (sound->_fadeStartTime + musicFadeTime > sound->_vm->_system->getMillis()) {
+			byte volume = (byte)((musicFadeTime - (sound->_vm->_system->getMillis() - sound->_fadeStartTime)) * sound->_musicVolume / musicFadeTime);
+			sound->updateChannelVolume(volume);
+		} else {
+			sound->_fadeStartTime = 0;
+			sound->_fadeMusicOut = false;
+			sound->_isMusicPlaying = false;
 
-		sound->_eventFromMusic = true;
-		// from sound/midiparser.cpp
-		for (int i = 0; i < 128; ++i) {
-			for (int j = 0; j < 16; ++j) {
-				sound->send(0x80 | j | i << 8);
+			sound->_eventFromMusic = true;
+			// from sound/midiparser.cpp
+			for (int i = 0; i < 128; ++i) {
+				for (int j = 0; j < 16; ++j) {
+					sound->send(0x80 | j | i << 8);
+				}
 			}
+
+			for (int i = 0; i < 16; ++i)
+				sound->send(0x007BB0 | i);
 		}
-
-		for (int i = 0; i < 16; ++i)
-			sound->send(0x007BB0 | i);
 	}
 
 	if (sound->_isMusicPlaying) {


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