[Scummvm-cvs-logs] CVS: scummvm/sound voc.cpp,1.16,1.17 voc.h,1.12,1.13

Max Horn fingolfin at users.sourceforge.net
Sun May 2 15:34:01 CEST 2004


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

Modified Files:
	voc.cpp voc.h 
Log Message:
Explain a bit what getSampleRateFromVOCRate() does; mark a hack in it more clearly; disable warning

Index: voc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- voc.cpp	10 Apr 2004 22:34:07 -0000	1.16
+++ voc.cpp	2 May 2004 22:33:20 -0000	1.17
@@ -30,13 +30,21 @@
 
 
 int getSampleRateFromVOCRate(int vocSR) {
-	if (vocSR == 0xa5 || vocSR == 0xa6 || vocSR == 0x83) {
+	if (vocSR == 0x83) {
+		// FIXME: This is a special hack added by Kirben on Fri Nov 7 11:11:06 2003 UTC,
+		// with the comment: "Correct voc rate in DOTT demo".
+		// It's not clear to me whether this is indeed a proper workaround for a broken
+		// data file, or just a random fix... ?
+		return 11025;
+	} else if (vocSR == 0xa5 || vocSR == 0xa6) {
 		return 11025;
 	} else if (vocSR == 0xd2 || vocSR == 0xd3) {
 		return 22050;
 	} else {
 		int sr = 1000000L / (256L - vocSR);
-		warning("inexact sample rate used: %i (0x%x)", sr, vocSR);
+		// Inexect% sampling rates occur e.g. in the kitchen in Monkey Island,
+		// very easy to reach right from the start of the game.
+		//warning("inexact sample rate used: %i (0x%x)", sr, vocSR);
 		return sr;
 	}
 }

Index: voc.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- voc.h	10 Apr 2004 01:46:38 -0000	1.12
+++ voc.h	2 May 2004 22:33:28 -0000	1.13
@@ -54,6 +54,12 @@
 /**
  * Take a sample rate parameter as it occurs in a VOC sound header, and
  * return the corresponding sample frequency.
+ *
+ * This method has special cases for the standard rates of 11025 and 22050 kHz,
+ * which due to limitations of the format, cannot be encoded exactly in a VOC
+ * file. As a consequence, many game files have sound data sampled with those
+ * rates, but the VOC marks them incorrectly as 11111 or 22222 kHz. This code
+ * works around that and "unrounds" the sampling rates.
  */
 extern int getSampleRateFromVOCRate(int vocSR);
 





More information about the Scummvm-git-logs mailing list