[Scummvm-cvs-logs] CVS: scummvm/scumm resource_v7he.cpp,1.34,1.35 sound.cpp,1.443,1.444

kirben kirben at users.sourceforge.net
Tue Apr 19 03:38:05 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27106/scumm

Modified Files:
	resource_v7he.cpp sound.cpp 
Log Message:

Add RIFF sound type.


Index: resource_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v7he.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- resource_v7he.cpp	18 Apr 2005 11:44:01 -0000	1.34
+++ resource_v7he.cpp	19 Apr 2005 10:35:25 -0000	1.35
@@ -30,6 +30,7 @@
 #include "scumm/resource_v7he.h"
 #include "scumm/sound.h"
 #include "scumm/util.h"
+#include "sound/wave.h"
 
 #include "common/stream.h"
 #include "common/system.h"
@@ -1765,18 +1766,30 @@
 		if (!ptr)
 			return 0;
 
-		if (READ_UINT32(ptr) == MKID('HSHD')) {
-			ptr += READ_BE_UINT32(ptr + 4);
+		if (READ_UINT32(ptr) == MKID('RIFF')) {
+			byte flags;
+			int rate;
+
+			size = READ_BE_UINT32(ptr + 4);
+			Common::MemoryReadStream stream(ptr, size);
+
+			if (!loadWAVFromStream(stream, size, rate, flags)) {
+				error("getSoundResourceSize: Not a valid WAV file");
+			}
 		} else {
-			ptr += 8 + READ_BE_UINT32(ptr + 12);
-		}
+			if (READ_UINT32(ptr) == MKID('HSHD')) {
+				ptr += READ_BE_UINT32(ptr + 4);
+			} else {
+				ptr += 8 + READ_BE_UINT32(ptr + 12);
+			}
 
-		if (READ_UINT32(ptr) == MKID('SBNG')) {
-			ptr += READ_BE_UINT32(ptr + 4);
-		}
+			if (READ_UINT32(ptr) == MKID('SBNG')) {
+				ptr += READ_BE_UINT32(ptr + 4);
+			}
 
-		assert(READ_UINT32(ptr) == MKID('SDAT'));
-		size = READ_BE_UINT32(ptr + 4) - 8;
+			assert(READ_UINT32(ptr) == MKID('SDAT'));
+			size = READ_BE_UINT32(ptr + 4) - 8;
+		}
 	}
 
 	return size;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.443
retrieving revision 1.444
diff -u -d -r1.443 -r1.444
--- sound.cpp	18 Apr 2005 07:18:32 -0000	1.443
+++ sound.cpp	19 Apr 2005 10:35:25 -0000	1.444
@@ -293,8 +293,7 @@
 		Common::MemoryReadStream stream(ptr, size);
 
 		if (!loadWAVFromStream(stream, size, rate, flags)) {
-			warning("playSound: Not a valid WAV file");
-			return;
+			error("playSound: Not a valid WAV file");
 		}
 
 		// Allocate a sound buffer, copy the data into it, and play





More information about the Scummvm-git-logs mailing list