aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2005-06-27 00:00:32 +0000
committerMax Horn2005-06-27 00:00:32 +0000
commitea3dd90f35b71cdb05357ae8bae866ad8d88ccd6 (patch)
treeb60a73c21ffba32c29ec906d805698dea4c1b82f
parent48a00b6846e324dbe4d53d67f50c3c541582ae88 (diff)
downloadscummvm-rg350-ea3dd90f35b71cdb05357ae8bae866ad8d88ccd6.tar.gz
scummvm-rg350-ea3dd90f35b71cdb05357ae8bae866ad8d88ccd6.tar.bz2
scummvm-rg350-ea3dd90f35b71cdb05357ae8bae866ad8d88ccd6.zip
Fix handling of music data in COMI
svn-id: r18470
-rw-r--r--scumm/imuse_digi/dimuse_codecs.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/scumm/imuse_digi/dimuse_codecs.cpp b/scumm/imuse_digi/dimuse_codecs.cpp
index 6f10fffdd4..40e3616b04 100644
--- a/scumm/imuse_digi/dimuse_codecs.cpp
+++ b/scumm/imuse_digi/dimuse_codecs.cpp
@@ -576,7 +576,7 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in
memcpy(dst, src, firstWord);
dst += firstWord;
src += firstWord;
- assert((firstWord & 3) == 0);
+ assert((firstWord & 1) == 0);
outputSamplesLeft -= firstWord / 2;
} else {
// Read the seed values for the decoder.
@@ -590,7 +590,6 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in
}
}
- outputSamplesLeft /= channels;
totalBitOffset = 0;
// The channels are encoded separately.
for (int chan = 0; chan < channels; chan++) {
@@ -604,7 +603,12 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in
// that by using a variables dest offset:
destPos = chan * 2;
- for (i = 0; i < outputSamplesLeft; ++i) {
+ const int bound = (channels == 1)
+ ? outputSamplesLeft
+ : ((chan == 0)
+ ? (outputSamplesLeft+1) / 2
+ : outputSamplesLeft / 2);
+ for (i = 0; i < bound; ++i) {
// Determine the size (in bits) of the next data packet
const int32 curTableEntryBitCount = _destImcTable[curTablePos];
assert(2 <= curTableEntryBitCount && curTableEntryBitCount <= 7);