[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.229,1.230

Travis Howell kirben at users.sourceforge.net
Fri Sep 5 19:28:02 CEST 2003


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

Modified Files:
	sound.cpp 
Log Message:

Search header of Amiga V2 games for rate and volume.


Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -d -r1.229 -r1.230
--- sound.cpp	6 Sep 2003 01:44:29 -0000	1.229
+++ sound.cpp	6 Sep 2003 02:27:03 -0000	1.230
@@ -462,17 +462,22 @@
 			size = READ_BE_UINT16(ptr + 6);
 			int start = READ_BE_UINT16(ptr + 8);
 			start += 10;
-
 			rate = 11000;
-			if ((READ_BE_UINT16(ptr + 50) == 0x357c) && (ptr[55] == 6))
-				rate = 3579545 / READ_BE_UINT16(ptr + 52);
-
 			int vol = 255;
-			if ((READ_BE_UINT16(ptr + 56) == 0x357c) && (ptr[61] == 8)) 
-				vol = READ_BE_UINT16(ptr + 58) * 2;
+			int i = 0;
+
+			while (i < start) {
+				if ((READ_BE_UINT16(ptr) == 0x357c) && (READ_BE_UINT16(ptr + 4) == 6))
+					rate = 3579545 / READ_BE_UINT16(ptr + 2);
+
+				if ((READ_BE_UINT16(ptr) == 0x357c) && (READ_BE_UINT16(ptr + 4) == 8))
+					vol = READ_BE_UINT16(ptr + 2) * 2;
+				ptr += 2;
+				i += 2;
+			}
 
 			sound = (char *)malloc(size);
-			memcpy(sound, ptr + start, size);
+			memcpy(sound, ptr, size);
 			_scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0);
 			return;
 		}





More information about the Scummvm-git-logs mailing list