aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/sound.cpp
diff options
context:
space:
mode:
authorMax Horn2007-12-24 14:20:53 +0000
committerMax Horn2007-12-24 14:20:53 +0000
commit138263ec035bc7a38fe49aa7296adfaa6d0bf6e1 (patch)
tree7774080c41c96bf1041c7fc607a70277cac9122a /engines/scumm/sound.cpp
parent50cf084a6b992c588cd8c9da9c175dc907335544 (diff)
downloadscummvm-rg350-138263ec035bc7a38fe49aa7296adfaa6d0bf6e1.tar.gz
scummvm-rg350-138263ec035bc7a38fe49aa7296adfaa6d0bf6e1.tar.bz2
scummvm-rg350-138263ec035bc7a38fe49aa7296adfaa6d0bf6e1.zip
cleanup
svn-id: r29974
Diffstat (limited to 'engines/scumm/sound.cpp')
-rw-r--r--engines/scumm/sound.cpp47
1 files changed, 23 insertions, 24 deletions
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 6e68c8405f..ed67829cdd 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -1072,7 +1072,7 @@ void Sound::saveLoadWithSerializer(Serializer *ser) {
#pragma mark --- Sound resource handling ---
#pragma mark -
-static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *src_ptr, int size);
+static void convertMac0Resource(ResourceManager *res, int idx, byte *src_ptr, int size);
/*
@@ -1082,7 +1082,7 @@ static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *s
* could stand a thorough cleanup!
*/
-int ScummEngine::readSoundResource(int type, int idx) {
+int ScummEngine::readSoundResource(int idx) {
uint32 pos, total_size, size, tag, basetag, max_total_size;
int pri, best_pri;
uint32 best_size = 0, best_offs = 0;
@@ -1104,7 +1104,7 @@ int ScummEngine::readSoundResource(int type, int idx) {
case MKID_BE('iMUS'):
if (_musicType != MDT_PCSPK) {
_fileHandle->seek(-8, SEEK_CUR);
- _fileHandle->read(_res->createResource(type, idx, total_size + 8), total_size + 8);
+ _fileHandle->read(_res->createResource(rtSound, idx, total_size + 8), total_size + 8);
return 1;
}
break;
@@ -1167,7 +1167,7 @@ int ScummEngine::readSoundResource(int type, int idx) {
if (best_pri != -1) {
_fileHandle->seek(best_offs - 8, SEEK_SET);
- ptr = _res->createResource(type, idx, best_size);
+ ptr = _res->createResource(rtSound, idx, best_size);
_fileHandle->read(ptr, best_size);
//dumpResource("sound-", idx, ptr);
return 1;
@@ -1179,7 +1179,7 @@ int ScummEngine::readSoundResource(int type, int idx) {
ptr = (byte *)calloc(total_size, 1);
_fileHandle->read(ptr, total_size);
//dumpResource("sound-", idx, ptr);
- convertMac0Resource(_res, type, idx, ptr, total_size);
+ convertMac0Resource(_res, idx, ptr, total_size);
free(ptr);
return 1;
@@ -1191,7 +1191,7 @@ int ScummEngine::readSoundResource(int type, int idx) {
case 0x460e200d: // WORKAROUND bug # 1311447
_fileHandle->seek(-12, SEEK_CUR);
total_size = _fileHandle->readUint32BE();
- ptr = _res->createResource(type, idx, total_size);
+ ptr = _res->createResource(rtSound, idx, total_size);
_fileHandle->read(ptr, total_size - 8);
//dumpResource("sound-", idx, ptr);
return 1;
@@ -1200,7 +1200,7 @@ int ScummEngine::readSoundResource(int type, int idx) {
// HE sound type without SOUN header
_fileHandle->seek(-16, SEEK_CUR);
total_size = max_total_size + 8;
- ptr = _res->createResource(type, idx, total_size);
+ ptr = _res->createResource(rtSound, idx, total_size);
_fileHandle->read(ptr, total_size);
//dumpResource("sound-", idx, ptr);
return 1;
@@ -1232,14 +1232,14 @@ int ScummEngine::readSoundResource(int type, int idx) {
if (!dmuFile.open(buffer)) {
error("Can't open music file %s", buffer);
- _res->roomoffs[type][idx] = (uint32)RES_INVALID_OFFSET;
+ _res->roomoffs[rtSound][idx] = (uint32)RES_INVALID_OFFSET;
return 0;
}
dmuFile.seek(4, SEEK_SET);
total_size = dmuFile.readUint32BE();
debugC(DEBUG_SOUND, "dmu file size %d", total_size);
dmuFile.seek(-8, SEEK_CUR);
- dmuFile.read(_res->createResource(type, idx, total_size), total_size);
+ dmuFile.read(_res->createResource(rtSound, idx, total_size), total_size);
dmuFile.close();
}
return 1;
@@ -1249,14 +1249,14 @@ int ScummEngine::readSoundResource(int type, int idx) {
_fileHandle->seek(-12, SEEK_CUR);
total_size = _fileHandle->readUint32BE();
_fileHandle->seek(-8, SEEK_CUR);
- ptr = _res->createResource(type, idx, total_size);
+ ptr = _res->createResource(rtSound, idx, total_size);
_fileHandle->read(ptr, total_size);
//dumpResource("sound-", idx, ptr);
return 1;
}
error("Unrecognized base tag 0x%08x in sound %d", basetag, idx);
}
- _res->roomoffs[type][idx] = (uint32)RES_INVALID_OFFSET;
+ _res->roomoffs[rtSound][idx] = (uint32)RES_INVALID_OFFSET;
return 0;
}
@@ -1435,7 +1435,7 @@ static byte Mac0ToGMInstrument(uint32 type, int &transpose) {
}
}
-static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *src_ptr, int size) {
+static void convertMac0Resource(ResourceManager *res, int idx, byte *src_ptr, int size) {
/*
From Markus Magnuson (superqult) we got this information:
Mac0
@@ -1488,7 +1488,7 @@ static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *s
*/
#if 0
- byte *ptr = _res->createResource(type, idx, size);
+ byte *ptr = _res->createResource(rtSound, idx, size);
memcpy(ptr, src_ptr, size);
#else
const int ppqn = 480;
@@ -1530,7 +1530,7 @@ static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *s
assert(*src_ptr == 0x09);
// Create sound resource
- start_ptr = res->createResource(type, idx, total_size);
+ start_ptr = res->createResource(rtSound, idx, total_size);
// Insert MIDI header
ptr = writeMIDIHeader(start_ptr, "GMD ", ppqn, total_size);
@@ -1626,8 +1626,7 @@ static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *s
#endif
}
-static void convertADResource(ResourceManager *res, const GameSettings& game, int type, int idx, byte *src_ptr, int size) {
-
+static void convertADResource(ResourceManager *res, const GameSettings& game, int idx, byte *src_ptr, int size) {
// We will ignore the PPQN in the original resource, because
// it's invalid anyway. We use a constant PPQN of 480.
const int ppqn = 480;
@@ -1637,7 +1636,7 @@ static void convertADResource(ResourceManager *res, const GameSettings& game, in
int total_size = kMIDIHeaderSize + 7 + 8 * sizeof(ADLIB_INSTR_MIDI_HACK) + size;
total_size += 24; // Up to 24 additional bytes are needed for the jump sysex
- ptr = res->createResource(type, idx, total_size);
+ ptr = res->createResource(rtSound, idx, total_size);
src_ptr += 2;
size -= 2;
@@ -2010,7 +2009,7 @@ static void convertADResource(ResourceManager *res, const GameSettings& game, in
}
-int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
+int ScummEngine::readSoundResourceSmallHeader(int idx) {
uint32 pos, total_size, size, tag;
uint32 ad_size = 0, ad_offs = 0;
uint32 ro_size = 0, ro_offs = 0;
@@ -2029,7 +2028,7 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
_fileHandle->seek(ro_offs + 4, SEEK_SET);
_fileHandle->read(src_ptr, ro_size -4);
- ptr = _res->createResource(type, idx, ro_size + 2);
+ ptr = _res->createResource(rtSound, idx, ro_size + 2);
memcpy(ptr, "RO", 2); ptr += 2;
memcpy(ptr, src_ptr, ro_size - 4); ptr += ro_size - 4;
return 1;
@@ -2101,24 +2100,24 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
}
ptr = (byte *) calloc(ad_size, 1);
_fileHandle->read(ptr, ad_size);
- convertADResource(_res, _game, type, idx, ptr, ad_size);
+ convertADResource(_res, _game, idx, ptr, ad_size);
free(ptr);
return 1;
} else if ((_musicType == MDT_PCSPK) && wa_offs != 0) {
if (_game.features & GF_OLD_BUNDLE) {
_fileHandle->seek(wa_offs, SEEK_SET);
- _fileHandle->read(_res->createResource(type, idx, wa_size), wa_size);
+ _fileHandle->read(_res->createResource(rtSound, idx, wa_size), wa_size);
} else {
_fileHandle->seek(wa_offs - 6, SEEK_SET);
- _fileHandle->read(_res->createResource(type, idx, wa_size + 6), wa_size + 6);
+ _fileHandle->read(_res->createResource(rtSound, idx, wa_size + 6), wa_size + 6);
}
return 1;
} else if (ro_offs != 0) {
_fileHandle->seek(ro_offs - 2, SEEK_SET);
- _fileHandle->read(_res->createResource(type, idx, ro_size - 4), ro_size - 4);
+ _fileHandle->read(_res->createResource(rtSound, idx, ro_size - 4), ro_size - 4);
return 1;
}
- _res->roomoffs[type][idx] = (uint32)RES_INVALID_OFFSET;
+ _res->roomoffs[rtSound][idx] = (uint32)RES_INVALID_OFFSET;
return 0;
}