From 0cc5313689d980fc9855eba6bbdc973c7a9d9e96 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sat, 30 May 2015 17:42:36 +0200 Subject: SHERLOCK: midi parser delta reading changed --- engines/sherlock/music.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'engines/sherlock/music.cpp') diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp index 3e31bcc83d..884fbd6221 100644 --- a/engines/sherlock/music.cpp +++ b/engines/sherlock/music.cpp @@ -86,9 +86,15 @@ void MidiParser_SH::parseNextEvent(EventInfo &info) { 115, 112, 55, 124, 123, 0, 14, 117 /* 120-127 */ }; + // there is no delta right at the start of the music data + // this order is essential, otherwise notes will get delayed or even go missing + if (_position._playPos != _tracks[0]) { + info.delta = *(_position._playPos++); + } else { + info.delta = 0; + } info.start = _position._playPos; - info.delta = 0; info.event = *_position._playPos++; //warning("Event %x", info.event); @@ -157,8 +163,6 @@ void MidiParser_SH::parseNextEvent(EventInfo &info) { warning("MidiParser_SH::parseNextEvent: Unsupported event code %x", info.event); break; }// switch (info.command()) - - info.delta = *(_position._playPos++); } bool MidiParser_SH::loadMusic(byte *data, uint32 size) { -- cgit v1.2.3