aboutsummaryrefslogtreecommitdiff
path: root/simon/midi.cpp
diff options
context:
space:
mode:
authorMax Horn2002-10-21 13:23:25 +0000
committerMax Horn2002-10-21 13:23:25 +0000
commit8af300fec3a760cc5c153c5be92134c1a99169a4 (patch)
tree422e11a861066b333615f602a0357944007c99e0 /simon/midi.cpp
parent0006197cf11187fc9756c7aba5de239cf719c4a4 (diff)
downloadscummvm-rg350-8af300fec3a760cc5c153c5be92134c1a99169a4.tar.gz
scummvm-rg350-8af300fec3a760cc5c153c5be92134c1a99169a4.tar.bz2
scummvm-rg350-8af300fec3a760cc5c153c5be92134c1a99169a4.zip
The terms Word and DWord are somewhat Windows centric; in fact there are systems on which word is 32bit, as opposed to our 16 bits. Hence, use the uin16/uint32 naming scheme, which is not ambigious
svn-id: r5216
Diffstat (limited to 'simon/midi.cpp')
-rw-r--r--simon/midi.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/simon/midi.cpp b/simon/midi.cpp
index f59d7c42cd..19d573a935 100644
--- a/simon/midi.cpp
+++ b/simon/midi.cpp
@@ -59,17 +59,17 @@ void MidiPlayer::read_mthd(File *in, Song *s, bool old)
uint i;
if (!old) {
- if (in->readDwordBE() != 6)
+ if (in->readUint32BE() != 6)
error("Invalid 'MThd' chunk size");
- s->midi_format = in->readWordBE();
- s->num_tracks = in->readWordBE();
- s->ppqn = in->readWordBE();
+ s->midi_format = in->readUint16BE();
+ s->num_tracks = in->readUint16BE();
+ s->ppqn = in->readUint16BE();
} else {
s->midi_format = 0;
s->num_tracks = 1;
s->ppqn = 0xc0;
- in->readWordBE();
+ in->readUint16BE();
in->readByte();
}
@@ -79,10 +79,11 @@ void MidiPlayer::read_mthd(File *in, Song *s, bool old)
for (i = 0; i != s->num_tracks; i++, t++) {
if (!old) {
- if (in->readDwordBE() != 'MTrk')
- error("Midi track has no 'MTrk'");
+ uint32 foo = in->readUint32BE();
+ if (foo != 'MTrk')
+ error("Midi track has no 'MTrk' (%d, %08x)", i, foo);
- t->data_size = in->readDwordLE();
+ t->data_size = in->readUint32LE();
} else {
uint32 pos = in->pos();
in->seek(0, SEEK_END);
@@ -93,7 +94,7 @@ void MidiPlayer::read_mthd(File *in, Song *s, bool old)
t->data_ptr = (byte *)calloc(t->data_size, 1);
if (t->data_ptr == NULL)
- error("Out of memory when allocating MIDI track data");
+ error("Out of memory when allocating MIDI track data (%d)", t->data_size);
in->read(t->data_ptr, t->data_size);
@@ -122,7 +123,7 @@ void MidiPlayer::read_one_song(File *in, Song *s)
s->num_tracks = 0;
s->tracks = NULL;
- uint32 id = in->readDwordBE();
+ uint32 id = in->readUint32BE();
switch (id) {
case 'MThd':