aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sound/midiparser.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/sound/midiparser.cpp b/sound/midiparser.cpp
index 093cde614a..648ad2fe1b 100644
--- a/sound/midiparser.cpp
+++ b/sound/midiparser.cpp
@@ -285,7 +285,18 @@ void MidiParser::resetTracking() {
bool MidiParser::setTrack(int track) {
if (track < 0 || track >= _num_tracks)
return false;
- else if (track == _active_track && _position._play_pos)
+ // We allow restarting the track via setTrack when
+ // it isn't playing anymore. This allows us to reuse
+ // a MidiParser when a track has been played and will
+ // be restarted via setTrack by the client again.
+ // This isn't exactly how setTrack behaved before though,
+ // the old MidiParser code did not allow setTrack to be
+ // used to restart a track, which was already finished.
+ //
+ // TODO: Check if any engine has problem with this
+ // handling, if so we need to find a better way to handle
+ // track restarts. (KYRA relies on this working)
+ else if (track == _active_track && !isPlaying())
return true;
if (_smartJump)
@@ -302,10 +313,7 @@ bool MidiParser::setTrack(int track) {
}
void MidiParser::stopPlaying() {
- if (_smartJump)
- hangAllActiveNotes();
- else
- allNotesOff();
+ allNotesOff();
resetTracking();
}