aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2005-05-25 19:40:30 +0000
committerMax Horn2005-05-25 19:40:30 +0000
commite3db264d890687d5b549865a636730523a9e968b (patch)
tree1acdfb07132d665538d5d133864423907b95e6f2
parentfc1b116f1242d1171ae97255eed1f83f931ec256 (diff)
downloadscummvm-rg350-e3db264d890687d5b549865a636730523a9e968b.tar.gz
scummvm-rg350-e3db264d890687d5b549865a636730523a9e968b.tar.bz2
scummvm-rg350-e3db264d890687d5b549865a636730523a9e968b.zip
cleanup
svn-id: r18251
-rw-r--r--scumm/imuse.cpp6
-rw-r--r--scumm/imuse_player.cpp4
-rw-r--r--scumm/instrument.cpp6
-rw-r--r--scumm/sound.cpp71
4 files changed, 43 insertions, 44 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 29b4daca76..23023de4d1 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -128,6 +128,8 @@ bool IMuseInternal::isMT32(int sound) {
case MKID('AMI '):
case MKID('ROL '):
+ return true;
+
case MKID('MAC '):
return true;
@@ -163,9 +165,11 @@ bool IMuseInternal::isMIDI(int sound) {
case MKID('ASFX'): // Special AD class for old Adlib sound effects
case MKID('SPK '):
return false;
- return false;
+
case MKID('AMI '):
case MKID('ROL '):
+ return true;
+
case MKID('MAC '):
return true;
diff --git a/scumm/imuse_player.cpp b/scumm/imuse_player.cpp
index 67676c8d27..98bcefbfd5 100644
--- a/scumm/imuse_player.cpp
+++ b/scumm/imuse_player.cpp
@@ -414,7 +414,7 @@ void Player::sysEx(byte *p, uint16 len) {
part->set_onoff(p[2] & 0x01);
part->set_pri (p[4]);
part->volume((p[5] & 0x0F) << 4 |(p[6] & 0x0F));
- part->_percussion = _isMIDI ?((p[9] & 0x08) > 0) : false;
+ part->_percussion = _isMIDI ? ((p[9] & 0x08) > 0) : false;
if (part->_percussion) {
if (part->_mc) {
part->off();
@@ -469,7 +469,7 @@ void Player::sysEx(byte *p, uint16 len) {
part->set_instrument((byte *) buf);
} else {
// SPK tracks have len == 49 here, and are not supported
- part->programChange(254); // Must be invalid, but not 255(which is reserved)
+ part->programChange(254); // Must be invalid, but not 255 (which is reserved)
}
}
break;
diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp
index 8d65368674..284c562ac7 100644
--- a/scumm/instrument.cpp
+++ b/scumm/instrument.cpp
@@ -134,7 +134,11 @@ public:
void saveOrLoad (Serializer *s);
void send (MidiChannel *mc);
void copy_to (Instrument *dest) { dest->program (_program, _mt32); }
- bool is_valid() { return (_program < 128) && ((_native_mt32 == _mt32) || _native_mt32 ? (MidiDriver::_gmToMt32[_program] < 128) : (MidiDriver::_mt32ToGm[_program] < 128)); }
+ bool is_valid() {
+ return (_program < 128) &&
+ ((_native_mt32 == _mt32) || _native_mt32
+ ? (MidiDriver::_gmToMt32[_program] < 128)
+ : (MidiDriver::_mt32ToGm[_program] < 128)); }
};
class Instrument_Adlib : public InstrumentInternal {
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index afb83043c1..75ab56c869 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -1292,6 +1292,7 @@ int ScummEngine::readSoundResource(int type, int idx) {
uint32 pos, total_size, size, tag, basetag, max_total_size;
int pri, best_pri;
uint32 best_size = 0, best_offs = 0;
+ byte *ptr;
debugC(DEBUG_RESOURCE, "readSoundResource(%d)", idx);
@@ -1304,13 +1305,16 @@ int ScummEngine::readSoundResource(int type, int idx) {
debugC(DEBUG_RESOURCE, " basetag: %s, total_size=%d", tag2str(TO_BE_32(basetag)), total_size);
- if (basetag == MKID('MIDI') || basetag == MKID('iMUS')) {
+ switch (basetag) {
+ case MKID('MIDI'):
+ case MKID('iMUS'):
if (_midiDriver != MD_PCSPK && _midiDriver != MD_PCJR) {
_fileHandle->seek(-8, SEEK_CUR);
_fileHandle->read(res.createResource(type, idx, total_size + 8), total_size + 8);
return 1;
}
- } else if (basetag == MKID('SOU ')) {
+ break;
+ case MKID('SOU '):
best_pri = -1;
while (pos < total_size) {
tag = fileReadDword();
@@ -1342,7 +1346,7 @@ int ScummEngine::readSoundResource(int type, int idx) {
case MKID('GMD '):
pri = 4;
break;
- case MKID('MAC '):
+ case MKID('MAC '): // Occurs in Mac MI2, FOA
pri = 2;
break;
case MKID('SPK '):
@@ -1369,44 +1373,33 @@ int ScummEngine::readSoundResource(int type, int idx) {
if (best_pri != -1) {
_fileHandle->seek(best_offs - 8, SEEK_SET);
- _fileHandle->read(res.createResource(type, idx, best_size), best_size);
+ ptr = res.createResource(type, idx, best_size);
+ _fileHandle->read(ptr, best_size);
return 1;
}
- } else if (basetag == MKID('Mac0')) {
+ break;
+ case MKID('Mac0'):
_fileHandle->seek(-12, SEEK_CUR);
total_size = _fileHandle->readUint32BE() - 8;
- byte *ptr = (byte *)calloc(total_size, 1);
+ ptr = (byte *)calloc(total_size, 1);
_fileHandle->read(ptr, total_size);
// dumpResource("sound-", idx, ptr);
convertMac0Resource(type, idx, ptr, total_size);
free(ptr);
return 1;
- } else if (basetag == MKID('Mac1')) {
- _fileHandle->seek(-12, SEEK_CUR);
- total_size = _fileHandle->readUint32BE();
- _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8);
- return 1;
- } else if (basetag == MKID('RIFF')) {
- _fileHandle->seek(-12, SEEK_CUR);
- total_size = _fileHandle->readUint32BE();
- _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8);
- return 1;
- } else if (basetag == MKID('HSHD')) {
- _fileHandle->seek(-12, SEEK_CUR);
- total_size = _fileHandle->readUint32BE();
- _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8);
- return 1;
- } else if (basetag == MKID('TALK')) {
- _fileHandle->seek(-12, SEEK_CUR);
- total_size = _fileHandle->readUint32BE();
- _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8);
- return 1;
- } else if (basetag == MKID('DIGI')) {
+
+ case MKID('Mac1'):
+ case MKID('RIFF'):
+ case MKID('HSHD'):
+ case MKID('TALK'):
+ case MKID('DIGI'):
+ case MKID('Crea'):
_fileHandle->seek(-12, SEEK_CUR);
total_size = _fileHandle->readUint32BE();
_fileHandle->read(res.createResource(type, idx, total_size), total_size - 8);
return 1;
- } else if (basetag == MKID('FMUS')) {
+
+ case MKID('FMUS'): {
// 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;
@@ -1440,19 +1433,17 @@ int ScummEngine::readSoundResource(int type, int idx) {
dmuFile.seek(-8, SEEK_CUR);
dmuFile.read(res.createResource(type, idx, total_size), total_size);
dmuFile.close();
+ }
return 1;
- } else if (basetag == MKID('Crea')) {
- _fileHandle->seek(-12, SEEK_CUR);
- total_size = _fileHandle->readUint32BE();
- _fileHandle->read(res.createResource(type, idx, total_size), total_size - 8);
- return 1;
- } else if (FROM_LE_32(basetag) == max_total_size) {
- _fileHandle->seek(-12, SEEK_CUR);
- total_size = _fileHandle->readUint32BE();
- _fileHandle->seek(-8, SEEK_CUR);
- _fileHandle->read(res.createResource(type, idx, total_size), total_size);
- return 1;
- } else {
+
+ default:
+ if (FROM_LE_32(basetag) == max_total_size) {
+ _fileHandle->seek(-12, SEEK_CUR);
+ total_size = _fileHandle->readUint32BE();
+ _fileHandle->seek(-8, SEEK_CUR);
+ _fileHandle->read(res.createResource(type, idx, total_size), total_size);
+ return 1;
+ }
warning("Unrecognized base tag 0x%08x in sound %d", basetag, idx);
}
res.roomoffs[type][idx] = 0xFFFFFFFF;