aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorGregory Montoir2006-11-03 21:03:12 +0000
committerGregory Montoir2006-11-03 21:03:12 +0000
commita8d7265c5eae16b18bb336b3f3f70f6eb5552374 (patch)
tree0ad0f7be86db1c95a552ca9549c09caf984b1b2c /sound
parentf9cf368a670ee58b579da8affca914e0b5634d8c (diff)
downloadscummvm-rg350-a8d7265c5eae16b18bb336b3f3f70f6eb5552374.tar.gz
scummvm-rg350-a8d7265c5eae16b18bb336b3f3f70f6eb5552374.tar.bz2
scummvm-rg350-a8d7265c5eae16b18bb336b3f3f70f6eb5552374.zip
added basic handler for VOC block 9
svn-id: r24590
Diffstat (limited to 'sound')
-rw-r--r--sound/voc.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/sound/voc.cpp b/sound/voc.cpp
index 5f6118537f..726b555a79 100644
--- a/sound/voc.cpp
+++ b/sound/voc.cpp
@@ -47,7 +47,7 @@ int getSampleRateFromVOCRate(int vocSR) {
}
}
-byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate, int &loops, int &begin_loop, int &end_loop) {
+static byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate, int &loops, int &begin_loop, int &end_loop) {
VocFileHeader fileHeader;
if (stream.read(&fileHeader, 8) != 8)
@@ -91,11 +91,26 @@ byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate, int &l
len |= stream.readByte() << 16;
switch (code) {
- case 1: {
- int time_constant = stream.readByte();
- int packing = stream.readByte();
- len -= 2;
- rate = getSampleRateFromVOCRate(time_constant);
+ case 1:
+ case 9: {
+ int packing;
+ if (code == 1) {
+ int time_constant = stream.readByte();
+ packing = stream.readByte();
+ len -= 2;
+ rate = getSampleRateFromVOCRate(time_constant);
+ } else {
+ rate = stream.readUint32LE();
+ int bits = stream.readByte();
+ int channels = stream.readByte();
+ if (bits != 8 || channels != 1) {
+ warning("Unsupported VOC file format (%d bits per sample, %d channels)", bits, channels);
+ break;
+ }
+ packing = stream.readUint16LE();
+ stream.readUint32LE();
+ len -= 12;
+ }
debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
if (packing == 0) {
if (size) {
@@ -119,7 +134,7 @@ byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate, int &l
assert(len == 0);
break;
default:
- warning("Invalid code in VOC file : %d", code);
+ warning("Unhandled code in VOC file : %d", code);
return ret_sound;
}
}