[Scummvm-cvs-logs] SF.net SVN: scummvm: [24590] scummvm/trunk/sound/voc.cpp
cyx at users.sourceforge.net
cyx at users.sourceforge.net
Fri Nov 3 22:03:19 CET 2006
Revision: 24590
http://svn.sourceforge.net/scummvm/?rev=24590&view=rev
Author: cyx
Date: 2006-11-03 13:03:12 -0800 (Fri, 03 Nov 2006)
Log Message:
-----------
added basic handler for VOC block 9
Modified Paths:
--------------
scummvm/trunk/sound/voc.cpp
Modified: scummvm/trunk/sound/voc.cpp
===================================================================
--- scummvm/trunk/sound/voc.cpp 2006-11-03 21:01:49 UTC (rev 24589)
+++ scummvm/trunk/sound/voc.cpp 2006-11-03 21:03:12 UTC (rev 24590)
@@ -47,7 +47,7 @@
}
}
-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 @@
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 @@
assert(len == 0);
break;
default:
- warning("Invalid code in VOC file : %d", code);
+ warning("Unhandled code in VOC file : %d", code);
return ret_sound;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list