[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.82,2.83 imuse.h,1.40,1.41 imuse_internal.h,2.15,2.16 imuse_player.cpp,2.23,2.24 midiparser_ro.cpp,1.1,1.2 scummvm.cpp,2.340,2.341

Jamieson Christian jamieson630 at users.sourceforge.net
Sat Aug 16 03:05:09 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv943

Modified Files:
	imuse.cpp imuse.h imuse_internal.h imuse_player.cpp 
	midiparser_ro.cpp scummvm.cpp 
Log Message:
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.

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.82
retrieving revision 2.83
diff -u -d -r2.82 -r2.83
--- imuse.cpp	16 Aug 2003 06:17:27 -0000	2.82
+++ imuse.cpp	16 Aug 2003 09:33:45 -0000	2.83
@@ -317,6 +317,21 @@
 	sequencer_timers(midi);
 }
 
+int IMuseInternal::getMusicTimer() {
+	int best_time = 0;
+	Player *player = _players;
+	int i;
+
+	for (i = ARRAYSIZE(_players); i != 0; i--, player++) {
+		if (player->isActive()) {
+			int timer = player->getMusicTimer();
+			if (timer > best_time)
+				best_time = timer;
+		}
+	}
+	return best_time / 1000000;
+}
+
 void IMuseInternal::sequencer_timers(MidiDriver *midi) {
 	Player *player = _players;
 	int i;
@@ -1744,6 +1759,7 @@
 int IMuse::stop_all_sounds() { in(); int ret = _target->stop_all_sounds(); out(); return ret; }
 int IMuse::getSoundStatus(int sound) { in(); int ret = _target->getSoundStatus(sound, true); out(); return ret; }
 bool IMuse::get_sound_active(int sound) { in(); bool ret = _target->getSoundStatus(sound, false) ? 1 : 0; out(); return ret; }
+int IMuse::getMusicTimer() { in(); int ret = _target->getMusicTimer(); out(); return ret; }
 int32 IMuse::doCommand (int a, int b, int c, int d, int e, int f, int g, int h) { in(); int32 ret = _target->doCommand(a,b,c,d,e,f,g,h); out(); return ret; }
 int32 IMuse::doCommand (int numargs, int args[]) { in(); int32 ret = _target->doCommand (numargs, args); out(); return ret; }
 int IMuse::clear_queue() { in(); int ret = _target->clear_queue(); out(); return ret; }

Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- imuse.h	12 Aug 2003 07:32:43 -0000	1.40
+++ imuse.h	16 Aug 2003 09:33:45 -0000	1.41
@@ -67,6 +67,7 @@
 	int stop_all_sounds();
 	int getSoundStatus(int sound);
 	bool get_sound_active(int sound);
+	int getMusicTimer();
 	int32 doCommand (int a, int b, int c, int d, int e, int f, int g, int h);
 	int32 doCommand (int numargs, int args[]);
 	int clear_queue();

Index: imuse_internal.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_internal.h,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -d -r2.15 -r2.16
--- imuse_internal.h	13 Aug 2003 22:43:08 -0000	2.15
+++ imuse_internal.h	16 Aug 2003 09:33:45 -0000	2.16
@@ -261,6 +261,7 @@
 	int    setTranspose(byte relative, int b);
 	int    setVolume(byte vol);
 	bool   startSound(int sound, MidiDriver *midi);
+	uint32  getMusicTimer();
 
 public:
 	// MidiDriver interface
@@ -349,7 +350,7 @@
 class IMuseInternal {
 	friend class Player;
 
-private:
+protected:
 	bool _old_adlib_instruments;
 	bool _enable_multi_midi;
 	MidiDriver *_midi_adlib;
@@ -359,7 +360,7 @@
 	
 	SoundMixer *_mixer;
 
-private:
+protected:
 	bool _paused;
 	bool _initialized;
 
@@ -392,6 +393,7 @@
 	CommandQueue _cmd_queue[64];
 	DeferredCommand _deferredCommands[4];
 
+protected:
 	byte *findStartOfSound(int sound);
 	bool isMT32(int sound);
 	bool isGM(int sound);
@@ -461,6 +463,7 @@
 	int stopSound(int sound);
 	int stop_all_sounds();
 	int getSoundStatus(int sound, bool ignoreFadeouts = true);
+	int getMusicTimer();
 	int32 doCommand (int a, int b, int c, int d, int e, int f, int g, int h);
 	int32 doCommand (int numargs, int args[]);
 	int clear_queue();

Index: imuse_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_player.cpp,v
retrieving revision 2.23
retrieving revision 2.24
diff -u -d -r2.23 -r2.24
--- imuse_player.cpp	16 Aug 2003 06:17:27 -0000	2.23
+++ imuse_player.cpp	16 Aug 2003 09:33:45 -0000	2.24
@@ -128,6 +128,10 @@
 	return true;
 }
 
+uint32 Player::getMusicTimer() {
+	return _parser ? _parser->getTime() : 0;
+}
+
 bool Player::isFadingOut() {
 	int i;
 	for (i = 0; i < ARRAYSIZE(_parameterFaders); ++i) {

Index: midiparser_ro.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/midiparser_ro.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- midiparser_ro.cpp	14 Aug 2003 08:24:13 -0000	1.1
+++ midiparser_ro.cpp	16 Aug 2003 09:33:45 -0000	1.2
@@ -33,11 +33,15 @@
 
 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 @@
 	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 @@
 	_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

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.340
retrieving revision 2.341
diff -u -d -r2.340 -r2.341
--- scummvm.cpp	16 Aug 2003 09:20:24 -0000	2.340
+++ scummvm.cpp	16 Aug 2003 09:33:45 -0000	2.341
@@ -1207,6 +1207,8 @@
 		// Covered automatically by the Sound class
 	} else if (_playerV2) {
 		VAR(VAR_MUSIC_TIMER) = _playerV2->getMusicTimer();
+	} else if (_imuse && _midiDriver != MD_ADLIB) {
+		VAR(VAR_MUSIC_TIMER) = _imuse->getMusicTimer();
 	} else if (_features & GF_SMALL_HEADER) {
 		// TODO: The music delay (given in milliseconds) might have to be tuned a little
 		// to get it correct for all games. Without the ability to watch/listen to the





More information about the Scummvm-git-logs mailing list