From 121b00a6f718f4b691c77708120083da2fedd018 Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Sat, 16 Aug 2003 09:34:19 +0000 Subject: Corrected timing mechanism for RO music streams. RO streams have built-in timer markers (the unknown 0xA0 mentioned in FR [742249]) that override automated methods of updating VAR_MUSIC_TIMER. Since these timer markers do not seem to be present in AD resources, the old mechanism is used if MD_ADLIB is the current MidiDriver. svn-id: r9720 --- scumm/midiparser_ro.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scumm/midiparser_ro.cpp') diff --git a/scumm/midiparser_ro.cpp b/scumm/midiparser_ro.cpp index 67d61a82f3..4f01a3e5fe 100644 --- a/scumm/midiparser_ro.cpp +++ b/scumm/midiparser_ro.cpp @@ -32,12 +32,16 @@ ////////////////////////////////////////////////// class MidiParser_RO : public MidiParser { +protected: + int _markerCount; // Number of markers encountered in stream so far + protected: void compressToType0(); void parseNextEvent (EventInfo &info); public: bool loadMusic (byte *data, uint32 size); + uint32 getTime() { return (uint32) _markerCount * 1000000; } }; @@ -53,7 +57,10 @@ void MidiParser_RO::parseNextEvent (EventInfo &info) { do { info.start = _position._play_pos; info.event = *(_position._play_pos++); - if (info.command() == 0xA) continue; + if (info.command() == 0xA) { + ++_markerCount; + continue; + } // end if if (info.event == 0xF0) { byte delay = *(_position._play_pos++); @@ -107,6 +114,7 @@ bool MidiParser_RO::loadMusic (byte *data, uint32 size) { _num_tracks = 1; _ppqn = 120; _tracks[0] = pos + 2; + _markerCount = 0; // Note that we assume the original data passed in // will persist beyond this call, i.e. we do NOT -- cgit v1.2.3