aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/imuse_player.cpp25
-rw-r--r--sound/midiparser.cpp19
2 files changed, 23 insertions, 21 deletions
diff --git a/scumm/imuse_player.cpp b/scumm/imuse_player.cpp
index 50cee4bae5..6e9146bd13 100644
--- a/scumm/imuse_player.cpp
+++ b/scumm/imuse_player.cpp
@@ -336,15 +336,17 @@ void Player::sysEx(byte *p, uint16 len) {
return;
#ifdef IMUSE_DEBUG
- for (a = 0; a < len + 1 && a < 19; ++a) {
- sprintf((char *)&buf[a*3], " %02X", p[a]);
- } // next for
- if (a < len + 1) {
- buf[a*3] = buf[a*3+1] = buf[a*3+2] = '.';
- ++a;
- } // end if
- buf[a*3] = '\0';
- debug(0, "[%02d] SysEx:%s", _id, buf);
+ if (!_scanning) {
+ for (a = 0; a < len + 1 && a < 19; ++a) {
+ sprintf((char *)&buf[a*3], " %02X", p[a]);
+ } // next for
+ if (a < len + 1) {
+ buf[a*3] = buf[a*3+1] = buf[a*3+2] = '.';
+ ++a;
+ } // end if
+ buf[a*3] = '\0';
+ debug(0, "[%02d] SysEx:%s", _id, buf);
+ }
#endif
switch (code = *p++) {
@@ -826,6 +828,11 @@ int Player::scan(uint totrack, uint tobeat, uint totick) {
clear_active_notes();
_scanning = true;
+ // If the scan involves a track switch, scan to the end of
+ // the current track so that our state when starting the
+ // new track is fully up to date.
+ if (totrack != _track_index)
+ _parser->jumpToTick (-1, true);
_parser->setTrack(totrack);
if (!_parser->jumpToTick((tobeat - 1) * TICKS_PER_BEAT + totick, true)) {
_scanning = false;
diff --git a/sound/midiparser.cpp b/sound/midiparser.cpp
index 0b2408f4cf..4f16e5b72b 100644
--- a/sound/midiparser.cpp
+++ b/sound/midiparser.cpp
@@ -330,19 +330,14 @@ bool MidiParser::jumpToTick (uint32 tick, bool fireEvents) {
if (info.event == 0xFF) {
if (info.ext.type == 0x2F) { // End of track
- if (_autoLoop) {
- _position._play_pos = _tracks[_active_track];
- parseNextEvent (_next_event);
- } else {
- _position = currentPos;
- _next_event = currentEvent;
- return false;
- }
- break;
- } else if (info.ext.type == 0x51) { // Tempo
- if (info.length >= 3) {
+ _position = currentPos;
+ _next_event = currentEvent;
+ return false;
+ } else {
+ if (info.ext.type == 0x51 && info.length >= 3) // Tempo
setTempo (info.ext.data[0] << 16 | info.ext.data[1] << 8 | info.ext.data[2]);
- }
+ if (fireEvents)
+ _driver->metaEvent (info.ext.type, info.ext.data, (uint16) info.length);
}
} else if (fireEvents) {
if (info.event == 0xF0)