From 1b4b6030fedf0fde1431e2e53d03a97caade4005 Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Sat, 24 May 2003 03:10:14 +0000 Subject: [PATCH] Added support for GMF loop specifier svn-id: r7874 --- simon/midi.cpp | 13 +++++++++---- simon/simon.cpp | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/simon/midi.cpp b/simon/midi.cpp index 9159f6f9930..bb19e43b9f1 100644 --- a/simon/midi.cpp +++ b/simon/midi.cpp @@ -298,10 +298,15 @@ void MidiPlayer::loadSMF (File *in, int song, bool sfx) { p->data = (byte *) calloc (size + 4, 1); in->read (p->data, size); - // For GMF files, we're going to have to use - // hardcoded size tables. - if (!memcmp (p->data, "GMF\x1", 4) && size == 64000) - size = simon1_gmf_size [song]; + if (!memcmp (p->data, "GMF\x1", 4)) { + if (!sfx) + setLoop (p->data[6] != 0); + + // For GMF files, we're going to have to use + // hardcoded size tables. + if (size == 64000) + size = simon1_gmf_size [song]; + } MidiParser *parser = MidiParser::createParser_SMF(); parser->property (MidiParser::mpMalformedPitchBends, 1); diff --git a/simon/simon.cpp b/simon/simon.cpp index 59323cc93c2..70a14d3a47a 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -5307,6 +5307,8 @@ void SimonState::loadMusic (uint music) { // TODO Add music support for simon1demo } else { midi.stop(); + midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.) + if (_game & GF_WIN) { _game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET); midi.loadMultipleSMF (_game_file); @@ -5326,7 +5328,6 @@ void SimonState::loadMusic (uint music) { delete f; } - midi.setLoop (true); midi.startTrack (0); } }