[Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.35,1.36 dimuse.h,1.21,1.22 dimuse_music.cpp,1.7,1.8

Pawel Kolodziejski aquadran at users.sourceforge.net
Sun Jan 18 03:40:01 CET 2004


Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1:/tmp/cvs-serv7867

Modified Files:
	dimuse.cpp dimuse.h dimuse_music.cpp 
Log Message:
next cleanup

Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- dimuse.cpp	18 Jan 2004 11:18:46 -0000	1.35
+++ dimuse.cpp	18 Jan 2004 11:39:29 -0000	1.36
@@ -236,7 +236,7 @@
 	_track[track].regionOffset = 0;
 }
 
-void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId) {
+void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId, int volume) {
 	Common::StackLock lock(_mutex);
 	debug(5, "IMuseDigital::startSound(%d)", soundId);
 	int l;
@@ -244,7 +244,7 @@
 	for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
 		if (!_track[l].used && !_track[l].handle.isActive()) {
 			_track[l].pan = 64;
-			_track[l].vol = 127 * 1000;
+			_track[l].vol = volume * 1000;
 			_track[l].volFadeDest = 0;
 			_track[l].volFadeStep = 0;
 			_track[l].volFadeDelay = 0;
@@ -385,6 +385,19 @@
 	}*/
 }
 
+void IMuseDigital::fadeOutMusic(int fadeDelay) {
+	Common::StackLock lock(_mutex);
+	debug(5, "IMuseDigital::fadeOutMusic");
+	for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
+		if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) {
+			_track[l].volFadeDelay = fadeDelay;
+			_track[l].volFadeDest = 0;
+			_track[l].volFadeStep = (_track[l].volFadeDest - _track[l].vol) * 60 * 40 / (1000 * fadeDelay);
+			_track[l].volFadeUsed = true;
+		}
+	}
+}
+
 void IMuseDigital::pause(bool p) {
 	Common::StackLock lock(_mutex);
 	for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
@@ -447,29 +460,29 @@
 		if ((_vm->_gameId == GID_DIG) && (_vm->_features & GF_DEMO)) {
 			if (b == 1) {
 				fadeOutMusic(120);
-				startMusic(1, false);
+				startMusic(1, false, 127);
 			} else {
 				if (getSoundStatus(2) == 0) {
 					fadeOutMusic(120);
-					startMusic(2, false);
+					startMusic(2, false, 127);
 				}
 			}
 		} else if ((_vm->_gameId == GID_CMI) && (_vm->_features & GF_DEMO)) {
 			if (b == 2) {
 				fadeOutMusic(120);
-				startMusic("in1.imx", 2002, false, 0);
+				startMusic("in1.imx", 2002, false, 0, 127);
 			} else if (b == 4) {
 				fadeOutMusic(120);
-				startMusic("in2.imx", 2004, false, 0);
+				startMusic("in2.imx", 2004, false, 0, 127);
 			} else if (b == 8) {
 				fadeOutMusic(120);
-				startMusic("out1.imx", 2008, false, 0);
+				startMusic("out1.imx", 2008, false, 0, 127);
 			} else if (b == 9) {
 				fadeOutMusic(120);
-				startMusic("out2.imx", 2009, false, 0);
+				startMusic("out2.imx", 2009, false, 0, 127);
 			} else if (b == 16) {
 				fadeOutMusic(120);
-				startMusic("gun.imx", 2016, false, 0);
+				startMusic("gun.imx", 2016, false, 0, 127);
 			} else {
 				warning("imuse digital: set state unknown for cmi demo: %d, room: %d", b, this->_vm->_currentRoom);
 			}

Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- dimuse.h	18 Jan 2004 11:18:46 -0000	1.21
+++ dimuse.h	18 Jan 2004 11:39:29 -0000	1.22
@@ -90,7 +90,7 @@
 	static void timer_handler(void *refConf);
 	void callback();
 	void switchToNextRegion(int track);
-	void startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId);
+	void startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId, int volume);
 
 	int32 getPosInMs(int soundId);
 	void getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height);
@@ -116,17 +116,17 @@
 	virtual ~IMuseDigital();
 
 	void startVoice(int soundId, AudioStream *input)
-		{ debug(5, "startVoiceStream(%d)", soundId); startSound(soundId, NULL, 0, IMUSE_VOICE, input, false, 0); }
+		{ debug(5, "startVoiceStream(%d)", soundId); startSound(soundId, NULL, 0, IMUSE_VOICE, input, false, 0, 127); }
 	void startVoice(int soundId)
-		{ debug(5, "startVoiceBundle(%d)", soundId); startSound(soundId, NULL, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0); }
+		{ debug(5, "startVoiceBundle(%d)", soundId); startSound(soundId, NULL, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0, 127); }
 	void startVoice(int soundId, const char *soundName)
-		{ debug(5, "startVoiceBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0); }
-	void startMusic(int soundId, bool sequence)
-		{ debug(5, "startMusicResource(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_MUSIC, NULL, sequence, 0); }
-	void startMusic(const char *soundName, int soundId, bool sequence, int hookId)
-		{ debug(5, "startMusicBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_MUSIC, NULL, sequence, hookId); }
+		{ debug(5, "startVoiceBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0, 127); }
+	void startMusic(int soundId, bool sequence, int volume)
+		{ debug(5, "startMusicResource(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_MUSIC, NULL, sequence, 0, volume); }
+	void startMusic(const char *soundName, int soundId, bool sequence, int hookId, int volume)
+		{ debug(5, "startMusicBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_MUSIC, NULL, sequence, hookId, volume); }
 	void startSfx(int soundId)
-		{ debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL, false, 0); }
+		{ debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL, false, 0, 127); }
 	void startSound(int soundId)
 		{ error("MusicEngine::startSound() Should be never called"); }
 

Index: dimuse_music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_music.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dimuse_music.cpp	18 Jan 2004 11:18:46 -0000	1.7
+++ dimuse_music.cpp	18 Jan 2004 11:39:29 -0000	1.8
@@ -168,13 +168,13 @@
 		case 3:
 			if ((!sequence) && (table->param != 0)) {
 				if (table->param == _digStateMusicTable[_curMusicState].param) {
-					startMusic(table->filename, table->soundId, sequence, 0);
+					startMusic(table->filename, table->soundId, sequence, 0, 127);
 				} 
 			} else {
-				startMusic(table->filename, table->soundId, sequence, hookId);
+				startMusic(table->filename, table->soundId, sequence, hookId, 127);
 			}
 		case 4:
-			startMusic(table->filename, table->soundId, sequence, 0);
+			startMusic(table->filename, table->soundId, sequence, 0, 127);
 			break;
 	}
 }
@@ -287,9 +287,8 @@
 			break;
 		case 1:
 			fadeOutMusic(120);
-			startMusic(table->filename, table->soundId, sequence, 0);
-			parseScriptCmds(12, table->soundId, 0x600, 1, 0, 0, 0, 0);
-			parseScriptCmds(14, table->soundId, 0x600, 127, 120, 0, 0, 0);
+			startMusic(table->filename, table->soundId, sequence, 0, 1);
+			setFade(table->soundId, 127, 120);
 			break;
 		case 2:
 			{
@@ -297,7 +296,7 @@
 				if (fadeDelay == 0)
 					fadeDelay = 1000;
 				fadeOutMusic(fadeDelay);
-				startMusic(table->filename, table->soundId, sequence, table->hookId);
+				startMusic(table->filename, table->soundId, sequence, table->hookId, 127);
 			}
 			break;
 		case 3:
@@ -307,18 +306,18 @@
 					if (fadeDelay == 0)
 						fadeDelay = 1000;
 					fadeOutMusic(fadeDelay);
-					startMusic(table->filename, table->soundId, sequence, 0);
+					startMusic(table->filename, table->soundId, sequence, 0, 127);
 				} 
 			} else {
 				int fadeDelay = table->fadeDelay;
 				if (fadeDelay == 0)
 					fadeDelay = 1000;
 				fadeOutMusic(fadeDelay);
-				startMusic(table->filename, table->soundId, sequence, table->hookId);
+				startMusic(table->filename, table->soundId, sequence, table->hookId, 127);
 			}
 		case 4:
 			fadeOutMusic(120);
-			startMusic(table->filename, table->soundId, sequence, 0);
+			startMusic(table->filename, table->soundId, sequence, 0, 127);
 			break;
 		case 12:
 			{
@@ -326,7 +325,7 @@
 				if (fadeDelay == 0)
 					fadeDelay = 1000;
 				fadeOutMusic(fadeDelay);
-				startMusic(table->filename, table->soundId, sequence, table->hookId);
+				startMusic(table->filename, table->soundId, sequence, table->hookId, 127);
 			}
 			break;
 	}
@@ -411,16 +410,6 @@
 	return -1;
 }
 
-void IMuseDigital::fadeOutMusic(int fadeDelay) {
-	Common::StackLock lock(_mutex);
-	debug(5, "IMuseDigital::fadeOutMusic");
-	for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
-		if (_track[l].used) {
-			parseScriptCmds(14, _track[l].soundId, 0x600, 0, fadeDelay, 0, 0, 0);
-		}
-	}
-}
-
 void IMuseDigital::playFtMusic(const char *songName, int opcode, int volume, bool sequence) {
 	fadeOutMusic(200);
 
@@ -432,11 +421,9 @@
 		case 2:
 		case 3:
 			{
-			int soundId = getSoundIdByName(songName);
-			if (soundId != -1) {
-				startMusic(soundId, sequence);
-				parseScriptCmds(12, soundId, 0x600, volume, 0, 0, 0, 0);
-			}
+				int soundId = getSoundIdByName(songName);
+				if (soundId != -1)
+					startMusic(soundId, sequence, volume);
 			}
 			break;
 	}





More information about the Scummvm-git-logs mailing list