diff options
Diffstat (limited to 'audio')
-rw-r--r-- | audio/midiparser.cpp | 8 | ||||
-rw-r--r-- | audio/midiparser.h | 1 |
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); |