diff options
| -rw-r--r-- | engines/mohawk/sound.cpp | 29 | ||||
| -rw-r--r-- | engines/mohawk/sound.h | 15 | 
2 files changed, 24 insertions, 20 deletions
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index 97e4b91386..30d084108d 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -170,7 +170,7 @@ void Sound::playMidi(uint16 id) {  	// Read the MThd Data  	midi->read(midiData, 14); -	// Skip the unknown Prg# section +	// TODO: Load patches from the Prg# section... skip it for now.  	idTag = midi->readUint32BE();  	assert(idTag == ID_PRG);  	midi->skip(midi->readUint32BE()); @@ -363,20 +363,25 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre  		case ID_ADPC:  			debug(2, "Found Tag ADPC");  			// Riven ADPCM Sound Only -			// NOTE: This is completely useless for us. All of this -			// is already in the ADPCM decoder in /sound. +			// 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. +  			adpc.size = stream->readUint32BE(); -			adpc.u0 = stream->readUint16BE(); +			adpc.itemCount = stream->readUint16BE();  			adpc.channels = stream->readUint16BE(); -			adpc.u1 = stream->readUint32BE(); - -			for (uint16 i = 0; i < adpc.channels; i++) -				adpc.u2[i] = stream->readUint32BE(); -			if (adpc.u0 == 2) { -				adpc.u3 = stream->readUint32BE(); -				for (uint16 i = 0; i < adpc.channels; i++) -					adpc.u4[i] = stream->readUint32BE(); +			adpc.statusItems = new ADPC_Chunk::StatusItem[adpc.itemCount]; +			 +			assert(adpc.channels <= 2); + +			for (uint16 i = 0; i < adpc.itemCount; i++) { +				adpc.statusItems[i].sampleFrame = stream->readUint32BE(); + +				for (uint16 j = 0; j < adpc.channels; j++) +					adpc.statusItems[i].channelStatus[j] = stream->readUint32BE();  			} +			 +			delete[] adpc.statusItems;  			break;  		case ID_CUE:  			debug(2, "Found Tag Cue#"); diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h index e2234e7c30..eb545a4752 100644 --- a/engines/mohawk/sound.h +++ b/engines/mohawk/sound.h @@ -72,16 +72,15 @@ struct SLSTSndHandle {  	uint16 id;  }; -struct ADPC_Chunk {            // Appears to only exist if there isn't MPEG-2 Audio +struct ADPC_Chunk {            // Holds ADPCM status data, but is irrelevant for us.  	uint32 size; -	uint16 u0;                 // Unknown (2 when there's a Cue# Chunk, 1 when there's not) +	uint16 itemCount;  	uint16 channels; -	uint32 u1;                 // Unknown (always 0) -	uint32 u2[MAX_CHANNELS];   // Unknown (0x00400000 for both channels) - -	// If there is a Cue# chunk, there can be two more variables: -	uint32 u3; -	uint32 u4[MAX_CHANNELS]; +	 +	struct StatusItem { +		uint32 sampleFrame; +		uint32 channelStatus[MAX_CHANNELS]; +	} *statusItems;  };  struct Cue_Chunk {  | 
