diff options
author | Matthew Hoops | 2011-01-22 16:16:30 +0000 |
---|---|---|
committer | Matthew Hoops | 2011-01-22 16:16:30 +0000 |
commit | 755558de042d76751e4684fb8e56bd9463cfef89 (patch) | |
tree | e7a37c375f125a673dee7326f71ab71bd5f8d852 /engines/mohawk | |
parent | a8e6fa3346a9cf5107629397545cb04e44b831c6 (diff) | |
download | scummvm-rg350-755558de042d76751e4684fb8e56bd9463cfef89.tar.gz scummvm-rg350-755558de042d76751e4684fb8e56bd9463cfef89.tar.bz2 scummvm-rg350-755558de042d76751e4684fb8e56bd9463cfef89.zip |
MOHAWK: Update the ADPC chunk code
svn-id: r55431
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/sound.cpp | 20 | ||||
-rw-r--r-- | engines/mohawk/sound.h | 5 |
2 files changed, 19 insertions, 6 deletions
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index 31d7c37e79..ac7aa79892 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -365,9 +365,16 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre 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 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre 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: diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h index 96cb555942..de8dffe1d3 100644 --- a/engines/mohawk/sound.h +++ b/engines/mohawk/sound.h @@ -80,7 +80,10 @@ struct ADPCMStatus { // Holds ADPCM status data, but is irrelevant for us. struct StatusItem { uint32 sampleFrame; - uint32 channelStatus[MAX_CHANNELS]; + struct { + int16 last; + uint16 stepIndex; + } channelStatus[MAX_CHANNELS]; } *statusItems; }; |