mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
Revert "AUDIO: Simplify MidiTracker::processEvent return value"
MI2 deletes the parser object(!) so we can't access any member
variables here. Thanks to athrxx for finding this.
This reverts commit 86c2fe47e0 and adds
a comment explaining why.
This commit is contained in:
+13
-9
@@ -214,13 +214,16 @@ void MidiParser::onTimer() {
|
||||
activeNote(info.channel(), info.basic.param1, true);
|
||||
}
|
||||
|
||||
processEvent(info);
|
||||
// Player::metaEvent() in SCUMM will delete the parser object,
|
||||
// so return immediately if that might have happened.
|
||||
bool ret = processEvent(info);
|
||||
if (!ret)
|
||||
return;
|
||||
|
||||
if (_abortParse)
|
||||
break;
|
||||
|
||||
_position._lastEventTime = eventTime;
|
||||
parseNextEvent(_nextEvent);
|
||||
if (!_abortParse) {
|
||||
_position._lastEventTime = eventTime;
|
||||
parseNextEvent(_nextEvent);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_abortParse) {
|
||||
@@ -229,7 +232,7 @@ void MidiParser::onTimer() {
|
||||
}
|
||||
}
|
||||
|
||||
void MidiParser::processEvent(const EventInfo &info, bool fireEvents) {
|
||||
bool MidiParser::processEvent(const EventInfo &info, bool fireEvents) {
|
||||
if (info.event == 0xF0) {
|
||||
// SysEx event
|
||||
// Check for trailing 0xF7 -- if present, remove it.
|
||||
@@ -252,8 +255,7 @@ void MidiParser::processEvent(const EventInfo &info, bool fireEvents) {
|
||||
if (fireEvents)
|
||||
_driver->metaEvent(info.ext.type, info.ext.data, (uint16)info.length);
|
||||
}
|
||||
_abortParse = true;
|
||||
return;
|
||||
return false;
|
||||
} else if (info.ext.type == 0x51) {
|
||||
if (info.length >= 3) {
|
||||
setTempo(info.ext.data[0] << 16 | info.ext.data[1] << 8 | info.ext.data[2]);
|
||||
@@ -265,6 +267,8 @@ void MidiParser::processEvent(const EventInfo &info, bool fireEvents) {
|
||||
if (fireEvents)
|
||||
sendToDriver(info.event, info.basic.param1, info.basic.param2);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ protected:
|
||||
virtual void resetTracking();
|
||||
virtual void allNotesOff();
|
||||
virtual void parseNextEvent(EventInfo &info) = 0;
|
||||
virtual void processEvent(const EventInfo &info, bool fireEvents = true);
|
||||
virtual bool processEvent(const EventInfo &info, bool fireEvents = true);
|
||||
|
||||
void activeNote(byte channel, byte note, bool active);
|
||||
void hangingNote(byte channel, byte note, uint32 ticksLeft, bool recycle = true);
|
||||
|
||||
Reference in New Issue
Block a user