[Scummvm-cvs-logs] SF.net SVN: scummvm:[55431] scummvm/trunk/engines/mohawk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Sat Jan 22 17:16:30 CET 2011


Revision: 55431
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55431&view=rev
Author:   mthreepwood
Date:     2011-01-22 16:16:30 +0000 (Sat, 22 Jan 2011)

Log Message:
-----------
MOHAWK: Update the ADPC chunk code

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/sound.cpp
    scummvm/trunk/engines/mohawk/sound.h

Modified: scummvm/trunk/engines/mohawk/sound.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/sound.cpp	2011-01-22 15:39:52 UTC (rev 55430)
+++ scummvm/trunk/engines/mohawk/sound.cpp	2011-01-22 16:16:30 UTC (rev 55431)
@@ -365,9 +365,16 @@
 		case ID_ADPC:
 			debug(2, "Found Tag ADPC");
 			// ADPCM Sound Only
-			// NOTE: We completely ignore the contents of this chunk on purpose. In the original
-			// engine this held the status for the ADPCM decoder, while in ScummVM we store this data
-			// in the ADPCM decoder itself. The code is here for reference only.
+			//
+			// This is useful for seeking in the stream, and is actually quite brilliant
+			// considering some of the other things Broderbund did with the engine.
+			// Only Riven and CSTime are known to use ADPCM audio and only CSTime
+			// actually requires this for seeking. On the other hand, it may be interesting
+			// to look at that one Riven sample that uses the cue points.
+			//
+			// Basically, the sample frame from the cue list is looked up here and then
+			// sets the starting sample and step index at the point specified. Quite
+			// an elegant/efficient system, really.
 
 			adpcmStatus.size = stream->readUint32BE();
 			adpcmStatus.itemCount = stream->readUint16BE();
@@ -379,10 +386,13 @@
 			for (uint16 i = 0; i < adpcmStatus.itemCount; i++) {
 				adpcmStatus.statusItems[i].sampleFrame = stream->readUint32BE();
 
-				for (uint16 j = 0; j < adpcmStatus.channels; j++)
-					adpcmStatus.statusItems[i].channelStatus[j] = stream->readUint32BE();
+				for (uint16 j = 0; j < adpcmStatus.channels; j++) {
+					adpcmStatus.statusItems[i].channelStatus[j].last = stream->readSint16BE();
+					adpcmStatus.statusItems[i].channelStatus[j].stepIndex = stream->readUint16BE();
+				}
 			}
 
+			// TODO: Actually use this chunk. For now, just delete the status items...
 			delete[] adpcmStatus.statusItems;
 			break;
 		case ID_CUE:

Modified: scummvm/trunk/engines/mohawk/sound.h
===================================================================
--- scummvm/trunk/engines/mohawk/sound.h	2011-01-22 15:39:52 UTC (rev 55430)
+++ scummvm/trunk/engines/mohawk/sound.h	2011-01-22 16:16:30 UTC (rev 55431)
@@ -80,7 +80,10 @@
 
 	struct StatusItem {
 		uint32 sampleFrame;
-		uint32 channelStatus[MAX_CHANNELS];
+		struct {
+			int16 last;
+			uint16 stepIndex;
+		} channelStatus[MAX_CHANNELS];
 	} *statusItems;
 };
 


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