diff options
| -rw-r--r-- | sound/voc.cpp | 12 | ||||
| -rw-r--r-- | sound/voc.h | 6 | 
2 files changed, 16 insertions, 2 deletions
| diff --git a/sound/voc.cpp b/sound/voc.cpp index ac946b12ae..9bc0cb297a 100644 --- a/sound/voc.cpp +++ b/sound/voc.cpp @@ -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;  	}  } diff --git a/sound/voc.h b/sound/voc.h index 0a43d42a28..3cfeaeca28 100644 --- a/sound/voc.h +++ b/sound/voc.h @@ -54,6 +54,12 @@ struct VocBlockHeader {  /**   * 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); | 
