diff options
author | Max Horn | 2002-10-21 13:23:25 +0000 |
---|---|---|
committer | Max Horn | 2002-10-21 13:23:25 +0000 |
commit | 8af300fec3a760cc5c153c5be92134c1a99169a4 (patch) | |
tree | 422e11a861066b333615f602a0357944007c99e0 /simon/midi.cpp | |
parent | 0006197cf11187fc9756c7aba5de239cf719c4a4 (diff) | |
download | scummvm-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.cpp | 21 |
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': |