aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-09-21 09:30:42 +0200
committerWillem Jan Palenstijn2013-09-21 09:31:08 +0200
commit3792af8e955bea5a07359c808361a16b15481327 (patch)
tree5a50228ce36d0fbd576473345e5982b0e602ed3b /audio
parent11d425b76c7d6cdae8b72a1c3c438cc74e9c37a0 (diff)
downloadscummvm-rg350-3792af8e955bea5a07359c808361a16b15481327.tar.gz
scummvm-rg350-3792af8e955bea5a07359c808361a16b15481327.tar.bz2
scummvm-rg350-3792af8e955bea5a07359c808361a16b15481327.zip
AUDIO: Simplify SCI inFastForward flag by moving it to MidiParser
Diffstat (limited to 'audio')
-rw-r--r--audio/midiparser.cpp8
-rw-r--r--audio/midiparser.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/audio/midiparser.cpp b/audio/midiparser.cpp
index dcb83bb090..2454575413 100644
--- a/audio/midiparser.cpp
+++ b/audio/midiparser.cpp
@@ -44,7 +44,8 @@ _centerPitchWheelOnUnload(false),
_sendSustainOffOnNotesOff(false),
_numTracks(0),
_activeTrack(255),
-_abortParse(0) {
+_abortParse(false),
+_jumpingToTick(false) {
memset(_activeNotes, 0, sizeof(_activeNotes));
memset(_tracks, 0, sizeof(_tracks));
_nextEvent.start = NULL;
@@ -382,6 +383,9 @@ bool MidiParser::jumpToTick(uint32 tick, bool fireEvents, bool stopNotes, bool d
if (_activeTrack >= _numTracks)
return false;
+ assert(!_jumpingToTick); // This function is not re-entrant
+ _jumpingToTick = true;
+
Tracker currentPos(_position);
EventInfo currentEvent(_nextEvent);
@@ -411,6 +415,7 @@ bool MidiParser::jumpToTick(uint32 tick, bool fireEvents, bool stopNotes, bool d
// This means that we failed to find the right tick.
_position = currentPos;
_nextEvent = currentEvent;
+ _jumpingToTick = false;
return false;
} else {
processEvent(info, fireEvents);
@@ -437,6 +442,7 @@ bool MidiParser::jumpToTick(uint32 tick, bool fireEvents, bool stopNotes, bool d
}
_abortParse = true;
+ _jumpingToTick = false;
return true;
}
diff --git a/audio/midiparser.h b/audio/midiparser.h
index 28f39e623f..05d0cbe1db 100644
--- a/audio/midiparser.h
+++ b/audio/midiparser.h
@@ -287,6 +287,7 @@ protected:
///< so each event is parsed only once; this permits
///< simulated events in certain formats.
bool _abortParse; ///< If a jump or other operation interrupts parsing, flag to abort.
+ bool _jumpingToTick; ///< True if currently inside jumpToTick
protected:
static uint32 readVLQ(byte * &data);