From 3792af8e955bea5a07359c808361a16b15481327 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 21 Sep 2013 09:30:42 +0200 Subject: AUDIO: Simplify SCI inFastForward flag by moving it to MidiParser --- audio/midiparser.cpp | 8 +++++++- audio/midiparser.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'audio') 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); -- cgit v1.2.3