aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorAlyssa Milburn2014-01-27 00:08:57 +0100
committerAlyssa Milburn2014-01-27 00:08:57 +0100
commit83ce4cfb5e72975805875000200e8ab2ff2c8319 (patch)
tree7fbba472516572e24bf10c26590847165ac92b17 /audio
parentafa54072a9622d7a370846bf280016843dc61009 (diff)
downloadscummvm-rg350-83ce4cfb5e72975805875000200e8ab2ff2c8319.tar.gz
scummvm-rg350-83ce4cfb5e72975805875000200e8ab2ff2c8319.tar.bz2
scummvm-rg350-83ce4cfb5e72975805875000200e8ab2ff2c8319.zip
Revert "AUDIO: fix invalid mem access in midiparser.cpp"
This broke SCI, since it doesn't call processEvent any more. This reverts commit afa54072a9622d7a370846bf280016843dc61009.
Diffstat (limited to 'audio')
-rw-r--r--audio/midiparser.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/audio/midiparser.cpp b/audio/midiparser.cpp
index 6840cfcbad..2454575413 100644
--- a/audio/midiparser.cpp
+++ b/audio/midiparser.cpp
@@ -214,21 +214,6 @@ void MidiParser::onTimer() {
activeNote(info.channel(), info.basic.param1, true);
}
- if (info.event == 0xFF && info.ext.type == 0x2F) {
- // End of Track must be processed by us, as well as sending it to the output device.
- // It must be processed here instead of inside processEvent() to avoid invalid mem access,
- // since Player::metaEvent() in SCUMM will delete the parser object.
- if (_autoLoop) {
- jumpToTick(0);
- parseNextEvent(_nextEvent);
- } else {
- stopPlaying();
- _driver->metaEvent(info.ext.type, info.ext.data, (uint16)info.length);
- }
- return;
-
- }
-
processEvent(info);
if (_abortParse)
@@ -255,7 +240,21 @@ void MidiParser::processEvent(const EventInfo &info, bool fireEvents) {
_driver->sysEx(info.ext.data, (uint16)info.length);
}
} else if (info.event == 0xFF) {
- if (info.ext.type == 0x51) {
+ // META event
+ if (info.ext.type == 0x2F) {
+ // End of Track must be processed by us,
+ // as well as sending it to the output device.
+ if (_autoLoop) {
+ jumpToTick(0);
+ parseNextEvent(_nextEvent);
+ } else {
+ stopPlaying();
+ if (fireEvents)
+ _driver->metaEvent(info.ext.type, info.ext.data, (uint16)info.length);
+ }
+ _abortParse = true;
+ return;
+ } 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]);
}