[Scummvm-cvs-logs] CVS: scummvm resource.cpp,1.102,1.103 sound.cpp,1.128,1.129

Max Horn fingolfin at users.sourceforge.net
Mon Aug 19 05:57:01 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv8725

Modified Files:
	resource.cpp sound.cpp 
Log Message:
sampled sound in MI1&2 (patch #557109)

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- resource.cpp	14 Aug 2002 20:43:55 -0000	1.102
+++ resource.cpp	19 Aug 2002 12:56:12 -0000	1.103
@@ -605,6 +605,9 @@
 			pri = -1;
 
 			switch (tag) {
+			case MKID('SBL '):
+				pri = 15;
+				break;
 			case MKID('ADL '):
 				if (_use_adlib)
 					pri = 10;
@@ -702,7 +705,7 @@
 		   00 0F 00 40
 
 		   Maybe I am mistaken when I think it's four byte, some other parts
-		   seem to suggest it's 2 byte oriented, or even variable lenght...
+		   seem to suggest it's 2 byte oriented, or even variable length...
 		 */
 		fileSeek(_fileHandle, -12, SEEK_CUR);
 		total_size = fileReadDwordBE();

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- sound.cpp	18 Aug 2002 22:47:11 -0000	1.128
+++ sound.cpp	19 Aug 2002 12:56:12 -0000	1.129
@@ -216,6 +216,42 @@
 		_scumm->_mixer->play_raw(NULL, sound, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
 		return;
 	}
+	// Support for sampled sound effects in Monkey1 and Monkey2
+	else if (ptr != NULL && READ_UINT32_UNALIGNED(ptr) == MKID('SBL ')) {
+		debug(2, "Using SBL sound effect");
+
+		// TODO - Figuring out how the SBL chunk works. Here's an
+		// example:
+		//
+		// 53 42 4c 20 00 00 11 ae  |SBL ....|
+		// 41 55 68 64 00 00 00 03  |AUhd....|
+		// 00 00 80 41 55 64 74 00  |...AUdt.|
+		// 00 11 9b 01 96 11 00 a6  |........|
+		// 00 7f 7f 7e 7e 7e 7e 7e  |...~~~~~|
+		// 7e 7f 7f 80 80 7f 7f 7f  |~.......|
+		// 7f 80 80 7f 7e 7d 7d 7e  |....~}}~|
+		// 7e 7e 7e 7e 7e 7e 7e 7f  |~~~~~~~.|
+		// 7f 7f 7f 80 80 80 80 80  |........|
+		// 80 81 80 80 7f 7f 80 85  |........|
+		// 8b 8b 83 78 72 6d 6f 75  |...xrmou|
+		// 7a 78 77 7d 83 84 83 81  |zxw}....|
+		//
+		// The length of the AUhd chunk always seems to be 3 bytes.
+		// Let's skip that for now.
+		//
+		// The starting offset, length and sample rate is all pure
+		// guesswork. The result sounds reasonable to me, but I've
+		// never heard the original.
+
+		int size = READ_BE_UINT32_UNALIGNED(ptr + 4) - 27;
+		int rate = 8000;
+
+		// Allocate a sound buffer, copy the data into it, and play
+		char *sound = (char*)malloc(size);
+		memcpy(sound, ptr + 33, size);
+		_scumm->_mixer->play_raw(NULL, sound, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+		return;
+	}
 
 	if ((_scumm->_features & GF_OLD256) && (ptr != NULL)) {
 		char *sound;





More information about the Scummvm-git-logs mailing list