[Scummvm-cvs-logs] CVS: scummvm/sound voc.cpp,1.4,1.5 voc.h,1.5,1.6

Pawel Kolodziejski aquadran at users.sourceforge.net
Fri Dec 26 14:54:01 CET 2003


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv3175/sound

Modified Files:
	voc.cpp voc.h 
Log Message:
added handing voc loops

Index: voc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- voc.cpp	26 Dec 2003 13:14:03 -0000	1.4
+++ voc.cpp	26 Dec 2003 22:53:30 -0000	1.5
@@ -26,23 +26,27 @@
 #include "sound/voc.h"
 
 
-byte *readCreativeVoc(byte *ptr, int32 &size, int &rate) {
+byte *readCreativeVoc(byte *ptr, int32 &size, int &rate, int32 &loops) {
+	
 	assert(strncmp((char *)ptr, "Creative Voice File\x1A", 20) == 0);
 	int32 offset = READ_LE_UINT16(ptr + 20);
 	int16 version = READ_LE_UINT16(ptr + 22);
 	int16 code = READ_LE_UINT16(ptr + 24);
 	assert(version == 0x010A || version == 0x0114);
 	assert(code == ~version + 0x1234);
+	
 	bool quit = 0;
-	byte *ret_sound = 0; size = 0;
-	int loops = 0;
+	byte *ret_sound = 0;
+	size = 0;
+
 	while (!quit) {
 		int len = READ_LE_UINT32(ptr + offset);
 		offset += 4;
 		code = len & 0xFF;
 		len >>= 8;
 		switch(code) {
-		case 0: quit = 1; break;
+		case 0: quit = 1;
+			break;
 		case 1: {
 			int time_constant = ptr[offset++];
 			int packing = ptr[offset++];
@@ -62,7 +66,8 @@
 			}
 			} break;
 		case 6:	// begin of loop
-			loops = len + 1;
+			loops = (uint16)READ_LE_UINT16(ptr + offset);
+			warning("voc loops: %d", loops);
 			break;
 		case 7:	// end of loop
 			break;

Index: voc.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- voc.h	26 Dec 2003 12:15:23 -0000	1.5
+++ voc.h	26 Dec 2003 22:53:30 -0000	1.6
@@ -55,7 +55,7 @@
  * return the corresponding sample frequency.
  */
 extern int getSampleRateFromVOCRate(int vocSR);
-extern byte *readCreativeVoc(byte *ptr, int32 &size, int &rate);
+extern byte *readCreativeVoc(byte *ptr, int32 &size, int &rate, int32 &loops);
 extern byte *loadVocSample(File *file, int32 &size, int &rate);
 
 #endif





More information about the Scummvm-git-logs mailing list