aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/sound.cpp
diff options
context:
space:
mode:
authorMax Horn2011-04-12 16:53:15 +0200
committerMax Horn2011-04-12 16:53:15 +0200
commit0ce2ca4e006a70d787481040fa844c85aac43222 (patch)
tree25fb61d7e7165ec2570ecf14a4af52e9bdb6b176 /engines/scumm/sound.cpp
parenta8b3501252c46c3fc4fd129fa0a945eb87f47d0a (diff)
downloadscummvm-rg350-0ce2ca4e006a70d787481040fa844c85aac43222.tar.gz
scummvm-rg350-0ce2ca4e006a70d787481040fa844c85aac43222.tar.bz2
scummvm-rg350-0ce2ca4e006a70d787481040fa844c85aac43222.zip
COMMON: Replace MKID_BE by MKTAG
MKID_BE relied on unspecified behavior of the C++ compiler, and as such was always a bit unsafe. The new MKTAG macro is slightly less elegant, but does no longer depend on the behavior of the compiler. Inspired by FFmpeg, which has an almost identical macro.
Diffstat (limited to 'engines/scumm/sound.cpp')
-rw-r--r--engines/scumm/sound.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 0051319151..54f35c1969 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -206,7 +206,7 @@ void Sound::playSound(int soundID) {
// Support for SFX in Monkey Island 1, Mac version
// This is rather hackish right now, but works OK. SFX are not sounding
// 100% correct, though, not sure right now what is causing this.
- else if (READ_BE_UINT32(ptr) == MKID_BE('Mac1')) {
+ else if (READ_BE_UINT32(ptr) == MKTAG('M','a','c','1')) {
// Read info from the header
size = READ_BE_UINT32(ptr+0x60);
rate = READ_BE_UINT16(ptr+0x64);
@@ -245,7 +245,7 @@ void Sound::playSound(int soundID) {
_mixer->playStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID);
}
// Support for sampled sound effects in Monkey Island 1 and 2
- else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKID_BE('SBL ')) {
+ else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKTAG('S','B','L',' ')) {
debugC(DEBUG_SOUND, "Using SBL sound effect");
// SBL resources essentially contain VOC sound data.
@@ -316,7 +316,7 @@ void Sound::playSound(int soundID) {
stream = Audio::makeRawStream(sound, size, rate, Audio::FLAG_UNSIGNED);
_mixer->playStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID);
}
- else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKID_BE('SOUN')) {
+ else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKTAG('S','O','U','N')) {
if (_vm->_game.version != 3)
ptr += 2;
@@ -415,7 +415,7 @@ void Sound::playSound(int soundID) {
// Rather it seems that starting a new music is supposed to
// automatically stop the old song.
if (_vm->_imuse) {
- if (READ_BE_UINT32(ptr) != MKID_BE('ASFX'))
+ if (READ_BE_UINT32(ptr) != MKTAG('A','S','F','X'))
_vm->_imuse->stopAllSounds();
}
}
@@ -1090,15 +1090,15 @@ int ScummEngine::readSoundResource(int idx) {
debugC(DEBUG_RESOURCE, " basetag: %s, total_size=%d", tag2str(basetag), total_size);
switch (basetag) {
- case MKID_BE('MIDI'):
- case MKID_BE('iMUS'):
+ case MKTAG('M','I','D','I'):
+ case MKTAG('i','M','U','S'):
if (_musicType != MDT_PCSPK && _musicType != MDT_PCJR) {
_fileHandle->seek(-8, SEEK_CUR);
_fileHandle->read(_res->createResource(rtSound, idx, total_size + 8), total_size + 8);
return 1;
}
break;
- case MKID_BE('SOU '):
+ case MKTAG('S','O','U',' '):
best_pri = -1;
while (pos < total_size) {
tag = _fileHandle->readUint32BE();
@@ -1108,32 +1108,32 @@ int ScummEngine::readSoundResource(int idx) {
pri = -1;
switch (tag) {
- case MKID_BE('TOWS'):
+ case MKTAG('T','O','W','S'):
pri = 16;
break;
- case MKID_BE('SBL '):
+ case MKTAG('S','B','L',' '):
pri = 15;
break;
- case MKID_BE('ADL '):
+ case MKTAG('A','D','L',' '):
pri = 1;
if (_musicType == MDT_ADLIB)
pri = 10;
break;
- case MKID_BE('AMI '):
+ case MKTAG('A','M','I',' '):
pri = 3;
break;
- case MKID_BE('ROL '):
+ case MKTAG('R','O','L',' '):
pri = 3;
if (_native_mt32)
pri = 5;
break;
- case MKID_BE('GMD '):
+ case MKTAG('G','M','D',' '):
pri = 4;
break;
- case MKID_BE('MAC '): // Occurs in Mac MI2, FOA
+ case MKTAG('M','A','C',' '): // Occurs in Mac MI2, FOA
pri = 2;
break;
- case MKID_BE('SPK '):
+ case MKTAG('S','P','K',' '):
pri = -1;
// if (_musicType == MDT_PCSPK || _musicType == MDT_PCJR)
// pri = 11;
@@ -1163,7 +1163,7 @@ int ScummEngine::readSoundResource(int idx) {
return 1;
}
break;
- case MKID_BE('Mac0'):
+ case MKTAG('M','a','c','0'):
_fileHandle->seek(-12, SEEK_CUR);
total_size = _fileHandle->readUint32BE() - 8;
ptr = (byte *)calloc(total_size, 1);
@@ -1173,11 +1173,11 @@ int ScummEngine::readSoundResource(int idx) {
free(ptr);
return 1;
- case MKID_BE('Mac1'):
- case MKID_BE('RIFF'):
- case MKID_BE('TALK'):
- case MKID_BE('DIGI'):
- case MKID_BE('Crea'):
+ case MKTAG('M','a','c','1'):
+ case MKTAG('R','I','F','F'):
+ case MKTAG('T','A','L','K'):
+ case MKTAG('D','I','G','I'):
+ case MKTAG('C','r','e','a'):
case 0x460e200d: // WORKAROUND bug # 1311447
_fileHandle->seek(-12, SEEK_CUR);
total_size = _fileHandle->readUint32BE();
@@ -1186,7 +1186,7 @@ int ScummEngine::readSoundResource(int idx) {
//dumpResource("sound-", idx, ptr);
return 1;
- case MKID_BE('HSHD'):
+ case MKTAG('H','S','H','D'):
// HE sound type without SOUN header
_fileHandle->seek(-16, SEEK_CUR);
total_size = max_total_size + 8;
@@ -1195,7 +1195,7 @@ int ScummEngine::readSoundResource(int idx) {
//dumpResource("sound-", idx, ptr);
return 1;
- case MKID_BE('FMUS'): {
+ case MKTAG('F','M','U','S'): {
// Used in 3DO version of puttputt joins the parade and probably others
// Specifies a separate file to be used for music from what I gather.
int tmpsize;
@@ -1406,20 +1406,20 @@ static byte *writeVLQ(byte *ptr, int value) {
static byte Mac0ToGMInstrument(uint32 type, int &transpose) {
transpose = 0;
switch (type) {
- case MKID_BE('MARI'): return 12;
- case MKID_BE('PLUC'): return 45;
- case MKID_BE('HARM'): return 22;
- case MKID_BE('PIPE'): return 19;
- case MKID_BE('TROM'): transpose = -12; return 57;
- case MKID_BE('STRI'): return 48;
- case MKID_BE('HORN'): return 60;
- case MKID_BE('VIBE'): return 11;
- case MKID_BE('SHAK'): return 77;
- case MKID_BE('PANP'): return 75;
- case MKID_BE('WHIS'): return 76;
- case MKID_BE('ORGA'): return 17;
- case MKID_BE('BONG'): return 115;
- case MKID_BE('BASS'): transpose = -24; return 35;
+ case MKTAG('M','A','R','I'): return 12;
+ case MKTAG('P','L','U','C'): return 45;
+ case MKTAG('H','A','R','M'): return 22;
+ case MKTAG('P','I','P','E'): return 19;
+ case MKTAG('T','R','O','M'): transpose = -12; return 57;
+ case MKTAG('S','T','R','I'): return 48;
+ case MKTAG('H','O','R','N'): return 60;
+ case MKTAG('V','I','B','E'): return 11;
+ case MKTAG('S','H','A','K'): return 77;
+ case MKTAG('P','A','N','P'): return 75;
+ case MKTAG('W','H','I','S'): return 76;
+ case MKTAG('O','R','G','A'): return 17;
+ case MKTAG('B','O','N','G'): return 115;
+ case MKTAG('B','A','S','S'): transpose = -24; return 35;
default:
error("Unknown Mac0 instrument %s found", tag2str(type));
}
@@ -1504,13 +1504,13 @@ static void convertMac0Resource(ResourceManager *res, int idx, byte *src_ptr, in
// Parse the three channels
for (i = 0; i < 3; i++) {
- assert(READ_BE_UINT32(src_ptr) == MKID_BE('Chan'));
+ assert(READ_BE_UINT32(src_ptr) == MKTAG('C','h','a','n'));
len = READ_BE_UINT32(src_ptr + 4);
track_len[i] = len - 24;
track_instr[i] = Mac0ToGMInstrument(READ_BE_UINT32(src_ptr + 8), track_transpose[i]);
track_data[i] = src_ptr + 12;
src_ptr += len;
- looped = (READ_BE_UINT32(src_ptr - 8) == MKID_BE('Loop'));
+ looped = (READ_BE_UINT32(src_ptr - 8) == MKTAG('L','o','o','p'));
// For each note event, we need up to 6 bytes for the
// Note On (3 VLQ, 3 event), and 6 bytes for the Note