aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-05-02 22:33:28 +0000
committerMax Horn2004-05-02 22:33:28 +0000
commit151d92e8cd40afebe424f1d8494dcc9234e892ac (patch)
tree977329baa52476f068dd1903829212d51ed58634
parenteec8b61b8d0d159fd65f0ced8c13e0446d9b661f (diff)
downloadscummvm-rg350-151d92e8cd40afebe424f1d8494dcc9234e892ac.tar.gz
scummvm-rg350-151d92e8cd40afebe424f1d8494dcc9234e892ac.tar.bz2
scummvm-rg350-151d92e8cd40afebe424f1d8494dcc9234e892ac.zip
Explain a bit what getSampleRateFromVOCRate() does; mark a hack in it more clearly; disable warning
svn-id: r13756
-rw-r--r--sound/voc.cpp12
-rw-r--r--sound/voc.h6
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);