diff options
author | Johannes Schickel | 2009-08-08 13:57:21 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-08-08 13:57:21 +0000 |
commit | c455e135b2eb89e9bf250dce2c5765a6afb284e0 (patch) | |
tree | d2efaefabb2322ff1701a7f64875de5680044d6a | |
parent | d14c0fd886cfb46854034cfbada43d6300a35dae (diff) | |
download | scummvm-rg350-c455e135b2eb89e9bf250dce2c5765a6afb284e0.tar.gz scummvm-rg350-c455e135b2eb89e9bf250dce2c5765a6afb284e0.tar.bz2 scummvm-rg350-c455e135b2eb89e9bf250dce2c5765a6afb284e0.zip |
Fix XMIDI looping implementation. Now for example the music in the ferret village of ITE plays fine.
svn-id: r43126
-rw-r--r-- | sound/midiparser_xmidi.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/midiparser_xmidi.cpp b/sound/midiparser_xmidi.cpp index f7d5e9c32a..343ca34659 100644 --- a/sound/midiparser_xmidi.cpp +++ b/sound/midiparser_xmidi.cpp @@ -115,6 +115,8 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) { byte *pos = _position._play_pos; if (_loopCount < ARRAYSIZE(_loop) - 1) _loopCount++; + else + warning("XMIDI: Exceeding maximum loop count %d", ARRAYSIZE(_loop)); _loop[_loopCount].pos = pos; _loop[_loopCount].repeat = info.basic.param2; @@ -127,11 +129,14 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) { // End the current loop. _loopCount--; } else { - _position._play_pos = _loop[_loopCount].pos; // Repeat 0 means "loop forever". if (_loop[_loopCount].repeat) { if (--_loop[_loopCount].repeat == 0) _loopCount--; + else + _position._play_pos = _loop[_loopCount].pos; + } else { + _position._play_pos = _loop[_loopCount].pos; } } } @@ -155,7 +160,6 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) { warning("Unsupported XMIDI controller %d (0x%2x)", info.basic.param1, info.basic.param1); } - break; } // Should we really keep passing the XMIDI controller events to |