diff options
author | Matthew Hoops | 2011-04-13 16:04:29 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-04-13 16:04:29 -0400 |
commit | 6d153f311c65fe414e31e99f8a9a6503c49a01a5 (patch) | |
tree | 9173f9964c0fec4215514e622f705810730d0ce9 /engines/scumm/imuse_digi | |
parent | 47c2a9adbe8d9e6640a819386f0f34e929937672 (diff) | |
parent | 66b43f2312578f35e0718d0699de207a7bf77f1a (diff) | |
download | scummvm-rg350-6d153f311c65fe414e31e99f8a9a6503c49a01a5.tar.gz scummvm-rg350-6d153f311c65fe414e31e99f8a9a6503c49a01a5.tar.bz2 scummvm-rg350-6d153f311c65fe414e31e99f8a9a6503c49a01a5.zip |
Merge remote branch 'upstream/master' into t7g-ios
Conflicts:
video/qt_decoder.cpp
Diffstat (limited to 'engines/scumm/imuse_digi')
-rw-r--r-- | engines/scumm/imuse_digi/dimuse.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_bndmgr.cpp | 7 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_bndmgr.h | 8 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_codecs.cpp | 311 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_codecs.h | 44 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_sndmgr.cpp | 42 |
6 files changed, 231 insertions, 182 deletions
diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index 516a0497fa..3831689def 100644 --- a/engines/scumm/imuse_digi/dimuse.cpp +++ b/engines/scumm/imuse_digi/dimuse.cpp @@ -31,6 +31,7 @@ #include "scumm/sound.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" +#include "scumm/imuse_digi/dimuse_codecs.h" #include "scumm/imuse_digi/dimuse_track.h" #include "audio/audiostream.h" diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp index f10f17f3d8..cb894d77cc 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -28,6 +28,7 @@ #include "scumm/util.h" #include "scumm/file.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" +#include "scumm/imuse_digi/dimuse_codecs.h" namespace Scumm { @@ -92,7 +93,7 @@ int BundleDirCache::matchFile(const char *filename) { error("BundleDirCache::matchFileFile() Can't find free slot for file bundle dir cache"); tag = file.readUint32BE(); - if (tag == MKID_BE('LB23')) + if (tag == MKTAG('L','B','2','3')) _budleDirCache[freeSlot].isCompressed = true; offset = file.readUint32BE(); @@ -112,7 +113,7 @@ int BundleDirCache::matchFile(const char *filename) { int32 z = 0; int32 z2; - if (tag == MKID_BE('LB23')) { + if (tag == MKTAG('L','B','2','3')) { file.read(_budleDirCache[freeSlot].bundleTable[i].filename, 24); } else { for (z2 = 0; z2 < 8; z2++) @@ -224,7 +225,7 @@ bool BundleMgr::loadCompTable(int32 index) { assert(_numCompItems > 0); _file->seek(8, SEEK_CUR); - if (tag != MKID_BE('COMP')) { + if (tag != MKTAG('C','O','M','P')) { error("BundleMgr::loadCompTable() Compressed sound %d (%s:%d) invalid (%s)", index, _file->getName(), _bundleTable[index].offset, tag2str(tag)); return false; } diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.h b/engines/scumm/imuse_digi/dimuse_bndmgr.h index a78697a854..bed1ac6549 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.h +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.h @@ -107,14 +107,6 @@ public: int32 decompressSampleByCurIndex(int32 offset, int32 size, byte **compFinal, int headerSize, bool headerOutside); }; -namespace BundleCodecs { - -uint32 decode12BitsSample(const byte *src, byte **dst, uint32 size); -void initializeImcTables(); -int32 decompressCodec(int32 codec, byte *compInput, byte *compOutput, int32 inputSize); - -} // End of namespace BundleCodecs - } // End of namespace Scumm #endif diff --git a/engines/scumm/imuse_digi/dimuse_codecs.cpp b/engines/scumm/imuse_digi/dimuse_codecs.cpp index 62a006c56b..fd9deb7b44 100644 --- a/engines/scumm/imuse_digi/dimuse_codecs.cpp +++ b/engines/scumm/imuse_digi/dimuse_codecs.cpp @@ -25,6 +25,9 @@ #include "common/scummsys.h" #include "common/endian.h" #include "common/util.h" +#include "scumm/imuse_digi/dimuse_codecs.h" + +#include "audio/decoders/adpcm_intern.h" namespace Scumm { @@ -59,23 +62,10 @@ uint32 decode12BitsSample(const byte *src, byte **dst, uint32 size) { * varies the size of each "packet" between 2 and 7 bits. */ -static byte _imcTableEntryBitCount[89]; - -static const int16 imcTable[89] = { - 7, 8, 9, 10, 11, 12, 13, 14, - 16, 17, 19, 21, 23, 25, 28, 31, - 34, 37, 41, 45, 50, 55, 60, 66, - 73, 80, 88, 97, 107, 118, 130, 143, - 157, 173, 190, 209, 230, 253, 279, 307, - 337, 371, 408, 449, 494, 544, 598, 658, - 724, 796, 876, 963, 1060, 1166, 1282, 1411, - 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, - 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, - 7132, 7845, 8630, 9493,10442,11487,12635,13899, - 15289,16818,18500,20350,22385,24623,27086,29794, - 32767 -}; +static byte *_destImcTable = NULL; +static uint32 *_destImcTable2 = NULL; +// This table is the "big brother" of Audio::ADPCMStream::_stepAdjustTable. static const byte imxOtherTable[6][64] = { { 0xFF, @@ -116,23 +106,47 @@ static const byte imxOtherTable[6][64] = { } }; +void releaseImcTables() { + free(_destImcTable); + free(_destImcTable2); +} + void initializeImcTables() { int pos; - for (pos = 0; pos < ARRAYSIZE(imcTable); ++pos) { - byte put = 0; - int32 tableValue = ((imcTable[pos] * 4) / 7) / 2; + if (!_destImcTable) _destImcTable = (byte *)calloc(89, sizeof(byte)); + if (!_destImcTable2) _destImcTable2 = (uint32 *)calloc(89 * 64, sizeof(uint32)); + + for (pos = 0; pos <= 88; ++pos) { + byte put = 1; + int32 tableValue = ((Audio::Ima_ADPCMStream::_imaTable[pos] * 4) / 7) / 2; while (tableValue != 0) { tableValue /= 2; put++; } - if (put < 2) { - put = 2; + if (put < 3) { + put = 3; + } + if (put > 8) { + put = 8; } - if (put > 7) { - put = 7; + _destImcTable[pos] = put - 1; + } + + for (int n = 0; n < 64; n++) { + for (pos = 0; pos <= 88; ++pos) { + int32 count = 32; + int32 put = 0; + int32 tableValue = Audio::Ima_ADPCMStream::_imaTable[pos]; + do { + if ((count & n) != 0) { + put += tableValue; + } + count /= 2; + tableValue /= 2; + } while (count != 0); + _destImcTable2[n + pos * 64] = put; } - _imcTableEntryBitCount[pos] = put; } } @@ -183,8 +197,128 @@ static int32 compDecode(byte *src, byte *dst) { } #undef NextBit +int32 decompressADPCM(byte *compInput, byte *compOutput, int channels) { + byte *src; + + // Decoder for the the IMA ADPCM variants used in COMI. + // Contrary to regular IMA ADPCM, this codec uses a variable + // bitsize for the encoded data. + + const int MAX_CHANNELS = 2; + int32 outputSamplesLeft; + int32 destPos; + int16 firstWord; + byte initialTablePos[MAX_CHANNELS] = {0, 0}; + int32 initialimcTableEntry[MAX_CHANNELS] = {7, 7}; + int32 initialOutputWord[MAX_CHANNELS] = {0, 0}; + int32 totalBitOffset, curTablePos, outputWord; + byte *dst; + int i; + + // We only support mono and stereo + assert(channels == 1 || channels == 2); + + src = compInput; + dst = compOutput; + outputSamplesLeft = 0x1000; + + // Every data packet contains 0x2000 bytes of audio data + // when extracted. In order to encode bigger data sets, + // one has to split the data into multiple blocks. + // + // Every block starts with a 2 byte word. If that word is + // non-zero, it indicates the size of a block of raw audio + // data (not encoded) following it. That data we simply copy + // to the output buffer and the proceed by decoding the + // remaining data. + // + // If on the other hand the word is zero, then what follows + // are 7*channels bytes containing seed data for the decoder. + firstWord = READ_BE_UINT16(src); + src += 2; + if (firstWord != 0) { + // Copy raw data + memcpy(dst, src, firstWord); + dst += firstWord; + src += firstWord; + assert((firstWord & 1) == 0); + outputSamplesLeft -= firstWord / 2; + } else { + // Read the seed values for the decoder. + for (i = 0; i < channels; i++) { + initialTablePos[i] = *src; + src += 1; + initialimcTableEntry[i] = READ_BE_UINT32(src); + src += 4; + initialOutputWord[i] = READ_BE_UINT32(src); + src += 4; + } + } + + totalBitOffset = 0; + // The channels are encoded separately. + for (int chan = 0; chan < channels; chan++) { + // Read initial state (this makes it possible for the data stream + // to be split & spread across multiple data chunks. + curTablePos = initialTablePos[chan]; + //imcTableEntry = initialimcTableEntry[chan]; + outputWord = initialOutputWord[chan]; + + // We need to interleave the channels in the output; we achieve + // that by using a variables dest offset: + destPos = chan * 2; + + 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); + + // Read the next data packet + const byte *readPos = src + (totalBitOffset >> 3); + const uint16 readWord = (uint16)(READ_BE_UINT16(readPos) << (totalBitOffset & 7)); + const byte packet = (byte)(readWord >> (16 - curTableEntryBitCount)); + + // Advance read position to the next data packet + totalBitOffset += curTableEntryBitCount; + + // Decode the data packet into a delta value for the output signal. + const byte signBitMask = (1 << (curTableEntryBitCount - 1)); + const byte dataBitMask = (signBitMask - 1); + const byte data = (packet & dataBitMask); + + const int32 tmpA = (data << (7 - curTableEntryBitCount)); + const int32 imcTableEntry = Audio::Ima_ADPCMStream::_imaTable[curTablePos] >> (curTableEntryBitCount - 1); + int32 delta = imcTableEntry + _destImcTable2[tmpA + (curTablePos * 64)]; + + // The topmost bit in the data packet tells is a sign bit + if ((packet & signBitMask) != 0) { + delta = -delta; + } + + // Accumulate the delta onto the output data + outputWord += delta; + + // Clip outputWord to 16 bit signed, and write it into the destination stream + outputWord = CLIP<int32>(outputWord, -0x8000, 0x7fff); + WRITE_BE_UINT16(dst + destPos, outputWord); + destPos += channels << 1; + + // Adjust the curTablePos + curTablePos += (int8)imxOtherTable[curTableEntryBitCount - 2][data]; + curTablePos = CLIP<int32>(curTablePos, 0, ARRAYSIZE(Audio::Ima_ADPCMStream::_imaTable) - 1); + } + } + + return 0x2000; +} + int32 decompressCodec(int32 codec, byte *compInput, byte *compOutput, int32 inputSize) { - int32 outputSize, channels; + int32 outputSize; int32 offset1, offset2, offset3, length, k, c, s, j, r, t, z; byte *src, *t_table, *p, *ptr; byte t_tmp1, t_tmp2; @@ -506,132 +640,7 @@ int32 decompressCodec(int32 codec, byte *compInput, byte *compOutput, int32 inpu case 13: case 15: - if (codec == 13) { - channels = 1; - } else { - channels = 2; - } - - { - // Decoder for the the IMA ADPCM variants used in COMI. - // Contrary to regular IMA ADPCM, this codec uses a variable - // bitsize for the encoded data. - - const int MAX_CHANNELS = 2; - int32 outputSamplesLeft; - int32 destPos; - int16 firstWord; - byte initialTablePos[MAX_CHANNELS] = {0, 0}; - //int32 initialimcTableEntry[MAX_CHANNELS] = {7, 7}; - int32 initialOutputWord[MAX_CHANNELS] = {0, 0}; - int32 totalBitOffset, curTablePos, outputWord; - byte *dst; - int i; - - // We only support mono and stereo - assert(channels == 1 || channels == 2); - - src = compInput; - dst = compOutput; - outputSize = 0x2000; - outputSamplesLeft = 0x1000; - - // Every data packet contains 0x2000 bytes of audio data - // when extracted. In order to encode bigger data sets, - // one has to split the data into multiple blocks. - // - // Every block starts with a 2 byte word. If that word is - // non-zero, it indicates the size of a block of raw audio - // data (not encoded) following it. That data we simply copy - // to the output buffer and the proceed by decoding the - // remaining data. - // - // If on the other hand the word is zero, then what follows - // are 7*channels bytes containing seed data for the decoder. - firstWord = READ_BE_UINT16(src); - src += 2; - if (firstWord != 0) { - // Copy raw data - memcpy(dst, src, firstWord); - dst += firstWord; - src += firstWord; - assert((firstWord & 1) == 0); - outputSamplesLeft -= firstWord / 2; - } else { - // Read the seed values for the decoder. - for (i = 0; i < channels; i++) { - initialTablePos[i] = *src; - src += 1; - //initialimcTableEntry[i] = READ_BE_UINT32(src); - src += 4; - initialOutputWord[i] = READ_BE_UINT32(src); - src += 4; - } - } - - totalBitOffset = 0; - // The channels are encoded separately. - for (int chan = 0; chan < channels; chan++) { - // Read initial state (this makes it possible for the data stream - // to be split & spread across multiple data chunks. - curTablePos = initialTablePos[chan]; - //imcTableEntry = initialimcTableEntry[chan]; - outputWord = initialOutputWord[chan]; - - // We need to interleave the channels in the output; we achieve - // that by using a variables dest offset: - destPos = chan * 2; - - 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 = _imcTableEntryBitCount[curTablePos]; - assert(2 <= curTableEntryBitCount && curTableEntryBitCount <= 7); - - // Read the next data packet - const byte *readPos = src + (totalBitOffset >> 3); - const uint16 readWord = (uint16)(READ_BE_UINT16(readPos) << (totalBitOffset & 7)); - const byte packet = (byte)(readWord >> (16 - curTableEntryBitCount)); - - // Advance read position to the next data packet - totalBitOffset += curTableEntryBitCount; - - // Decode the data packet into a delta value for the output signal. - const byte signBitMask = (1 << (curTableEntryBitCount - 1)); - const byte dataBitMask = (signBitMask - 1); - const byte data = (packet & dataBitMask); - - int32 delta = imcTable[curTablePos] * (2 * data + 1) >> (curTableEntryBitCount - 1); - - // The topmost bit in the data packet tells is a sign bit - if ((packet & signBitMask) != 0) { - delta = -delta; - } - - // Accumulate the delta onto the output data - outputWord += delta; - - // Clip outputWord to 16 bit signed, and write it into the destination stream - if (outputWord > 0x7fff) - outputWord = 0x7fff; - if (outputWord < -0x8000) - outputWord = -0x8000; - WRITE_BE_UINT16(dst + destPos, outputWord); - destPos += channels << 1; - - // Adjust the curTablePos - curTablePos += (int8)imxOtherTable[curTableEntryBitCount - 2][data]; - if (curTablePos < 0) - curTablePos = 0; - else if (curTablePos >= ARRAYSIZE(imcTable)) - curTablePos = ARRAYSIZE(imcTable) - 1; - } - } - } + outputSize = decompressADPCM(compInput, compOutput, (codec == 13) ? 1 : 2); break; default: diff --git a/engines/scumm/imuse_digi/dimuse_codecs.h b/engines/scumm/imuse_digi/dimuse_codecs.h new file mode 100644 index 0000000000..71fd24c3ac --- /dev/null +++ b/engines/scumm/imuse_digi/dimuse_codecs.h @@ -0,0 +1,44 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + */ + +#ifndef SCUMM_IMUSE_DIGI_CODECS_H +#define SCUMM_IMUSE_DIGI_CODECS_H + +#include "common/scummsys.h" + +namespace Scumm { + +namespace BundleCodecs { + +uint32 decode12BitsSample(const byte *src, byte **dst, uint32 size); +int32 decompressCodec(int32 codec, byte *compInput, byte *compOutput, int32 inputSize); + +void initializeImcTables(); +void releaseImcTables(); + +} // End of namespace BundleCodecs + +} // End of namespace Scumm + +#endif diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 00074a951a..2cd90c4f2b 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -34,8 +34,9 @@ #include "scumm/scumm.h" #include "scumm/util.h" #include "scumm/imuse_digi/dimuse.h" -#include "scumm/imuse_digi/dimuse_sndmgr.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" +#include "scumm/imuse_digi/dimuse_codecs.h" +#include "scumm/imuse_digi/dimuse_sndmgr.h" namespace Scumm { @@ -56,6 +57,7 @@ ImuseDigiSndMgr::~ImuseDigiSndMgr() { } delete _cacheBundleDir; + BundleCodecs::releaseImcTables(); } void ImuseDigiSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs, int &numMarkers) { @@ -65,32 +67,32 @@ void ImuseDigiSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps, i do { tag = READ_BE_UINT32(ptr); ptr += 4; switch (tag) { - case MKID_BE('STOP'): - case MKID_BE('FRMT'): - case MKID_BE('DATA'): + case MKTAG('S','T','O','P'): + case MKTAG('F','R','M','T'): + case MKTAG('D','A','T','A'): size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('TEXT'): + case MKTAG('T','E','X','T'): if (!scumm_stricmp((const char *)(ptr + 8), "exit")) numMarkers++; size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('REGN'): + case MKTAG('R','E','G','N'): numRegions++; size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('JUMP'): + case MKTAG('J','U','M','P'): numJumps++; size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('SYNC'): + case MKTAG('S','Y','N','C'): numSyncs++; size = READ_BE_UINT32(ptr); ptr += size + 4; break; default: error("ImuseDigiSndMgr::countElements() Unknown sfx header '%s'", tag2str(tag)); } - } while (tag != MKID_BE('DATA')); + } while (tag != MKTAG('D','A','T','A')); } void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::SeekableReadStream *file, SoundDesc *sound, int32 offset, int32 size) { @@ -98,7 +100,7 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::SeekableReadStream *file, Sou file->seek(offset, SEEK_SET); uint32 tag = file->readUint32BE(); - assert(tag == MKID_BE('RMAP')); + assert(tag == MKTAG('R','M','A','P')); int32 version = file->readUint32BE(); if (version != 3) { if (version == 2) { @@ -153,7 +155,7 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::SeekableReadStream *file, Sou } void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { - if (READ_BE_UINT32(ptr) == MKID_BE('Crea')) { + if (READ_BE_UINT32(ptr) == MKTAG('C','r','e','a')) { bool quit = false; int len; @@ -222,7 +224,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { } offset += len; } - } else if (READ_BE_UINT32(ptr) == MKID_BE('iMUS')) { + } else if (READ_BE_UINT32(ptr) == MKTAG('i','M','U','S')) { uint32 tag; int32 size = 0; byte *s_ptr = ptr; @@ -250,13 +252,13 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { do { tag = READ_BE_UINT32(ptr); ptr += 4; switch (tag) { - case MKID_BE('FRMT'): + case MKTAG('F','R','M','T'): ptr += 12; sound->bits = READ_BE_UINT32(ptr); ptr += 4; sound->freq = READ_BE_UINT32(ptr); ptr += 4; sound->channels = READ_BE_UINT32(ptr); ptr += 4; break; - case MKID_BE('TEXT'): + case MKTAG('T','E','X','T'): if (!scumm_stricmp((const char *)(ptr + 8), "exit")) { sound->marker[curIndexMarker].pos = READ_BE_UINT32(ptr + 4); sound->marker[curIndexMarker].length = strlen((const char *)(ptr + 8)) + 1; @@ -267,16 +269,16 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { } size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('STOP'): + case MKTAG('S','T','O','P'): size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('REGN'): + case MKTAG('R','E','G','N'): ptr += 4; sound->region[curIndexRegion].offset = READ_BE_UINT32(ptr); ptr += 4; sound->region[curIndexRegion].length = READ_BE_UINT32(ptr); ptr += 4; curIndexRegion++; break; - case MKID_BE('JUMP'): + case MKTAG('J','U','M','P'): ptr += 4; sound->jump[curIndexJump].offset = READ_BE_UINT32(ptr); ptr += 4; sound->jump[curIndexJump].dest = READ_BE_UINT32(ptr); ptr += 4; @@ -284,7 +286,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { sound->jump[curIndexJump].fadeDelay = READ_BE_UINT32(ptr); ptr += 4; curIndexJump++; break; - case MKID_BE('SYNC'): + case MKTAG('S','Y','N','C'): size = READ_BE_UINT32(ptr); ptr += 4; sound->sync[curIndexSync].size = size; sound->sync[curIndexSync].ptr = new byte[size]; @@ -293,13 +295,13 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { curIndexSync++; ptr += size; break; - case MKID_BE('DATA'): + case MKTAG('D','A','T','A'): ptr += 4; break; default: error("ImuseDigiSndMgr::prepareSound(%d/%s) Unknown sfx header '%s'", sound->soundId, sound->name, tag2str(tag)); } - } while (tag != MKID_BE('DATA')); + } while (tag != MKTAG('D','A','T','A')); sound->offsetData = ptr - s_ptr; } else { error("ImuseDigiSndMgr::prepareSound(): Unknown sound format"); |