[Scummvm-cvs-logs] CVS: scummvm/scumm player_v2.cpp,2.7,2.8 player_v2.h,2.2,2.3 scummvm.cpp,2.199,2.200

Jochen Hoenicke hoenicke at users.sourceforge.net
Sun Jun 1 09:43:05 CEST 2003


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

Modified Files:
	player_v2.cpp player_v2.h scummvm.cpp 
Log Message:
Added VAR_MUSIC_TIMER support to playerV2. Now Zak intro is synchronized.

Index: player_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2.cpp,v
retrieving revision 2.7
retrieving revision 2.8
diff -u -d -r2.7 -r2.8
--- player_v2.cpp	1 Jun 2003 15:56:40 -0000	2.7
+++ player_v2.cpp	1 Jun 2003 16:42:29 -0000	2.8
@@ -21,6 +21,7 @@
 #include "stdafx.h"
 #include "common/engine.h"
 #include "player_v2.h"
+#include "scumm.h"
 
 #define FREQ_HZ 236 // Don't change!
 
@@ -326,13 +327,13 @@
 ////////////////////////////////////////
 
 
-Player_V2::Player_V2() {
+Player_V2::Player_V2(Scumm *scumm) : _scumm(scumm) {
 	int i;
 	
 	// This simulates the pc speaker sound, which is driven
 	// by the 8253 (square wave generator) and a low-band filter.
 	
-	_system = g_system;
+	_system = scumm->_system;
 	_sample_rate = _system->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
 	_mutex = _system->create_mutex();
 
@@ -355,14 +356,13 @@
 	set_pcjr(true);
 	set_master_volume(255);
 
-	_mixer = g_mixer;
-	_mixer->setupPremix(this, premix_proc);
+	scumm->_mixer->setupPremix(this, premix_proc);
 }
 
 Player_V2::~Player_V2() {
 	mutex_up();
 	// Detach the premix callback handler
-	_mixer->setupPremix (0, 0);
+	_scumm->_mixer->setupPremix (0, 0);
 	mutex_down();
 	_system->delete_mutex (_mutex);
 }
@@ -548,6 +548,10 @@
 	channel->d.freqmod_modulo = 0;
 }
 
+int Player_V2::getMusicTimer() {
+	return channels[0].d.music_timer;
+}
+
 void Player_V2::execute_cmd(ChannelInfo *channel) {
 	uint16 value;
 	int16 offset;
@@ -810,8 +814,8 @@
 
 void Player_V2::lowPassFilter(int16 *sample, int len) {
 	for (int i = 0; i < len; i++) {
-		_level = ((int)_level * _decay
-			 + (int)sample[i] * (0x10000-_decay)) >> 16;
+		_level = (_level * _decay
+			 + (unsigned int)sample[i] * (0x10000-_decay)) >> 16;
 		sample[i] = _level;
 	}
 }

Index: player_v2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2.h,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -d -r2.2 -r2.3
--- player_v2.h	31 May 2003 16:54:46 -0000	2.2
+++ player_v2.h	1 Jun 2003 16:42:29 -0000	2.3
@@ -25,6 +25,7 @@
 
 #include "common/scummsys.h"
 #include "sound/mixer.h"
+class Scumm;
 
 struct channel_data {
 	uint16 time_left;          // 00
@@ -46,7 +47,8 @@
 	uint16 freqmod_incr;       // 32
 	uint16 freqmod_multiplier; // 34
 	uint16 freqmod_modulo;     // 36
-	uint16 unknown[5];         // 38 - 46
+	uint16 unknown[4];         // 38 - 44
+	uint16 music_timer;        // 46
 	uint16 music_script_nr;    // 48
 } GCC_PACK;
 
@@ -59,7 +61,7 @@
 
 class Player_V2 {
 public:
-	Player_V2();
+	Player_V2(Scumm *scumm);
 	~Player_V2();
 
 	void set_pcjr(bool pcjr);
@@ -69,9 +71,11 @@
 	void stopSound(int nr);
 	void stopAllSounds();
 	int  getSoundStatus(int nr);
+	int  getMusicTimer();
 
 private:
 	SoundMixer *_mixer;
+	Scumm *_scumm;
 
 
 	bool _pcjr;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.199
retrieving revision 2.200
diff -u -d -r2.199 -r2.200
--- scummvm.cpp	1 Jun 2003 04:03:40 -0000	2.199
+++ scummvm.cpp	1 Jun 2003 16:42:29 -0000	2.200
@@ -602,10 +602,10 @@
 		_imuseDigital = new IMuseDigital(this);
 		_imuse = NULL;
 		_playerV2 = NULL;
-	} else if (_features & GF_OLD_BUNDLE && !(_features & GF_AMIGA)) {
+	} else if ((_features & GF_OLD_BUNDLE) && !(_features & GF_AMIGA)) {
 		_playerV2 = NULL;
 		if (!(_features & GF_AMIGA))
-			_playerV2 = new Player_V2();
+			_playerV2 = new Player_V2(this);
 		_imuse = NULL;
 		_imuseDigital = NULL;
 	} else {
@@ -923,6 +923,8 @@
 
 	if (_features & GF_AUDIOTRACKS) {
 		// Covered automatically by the Sound class
+	} else if (_playerV2) {
+		VAR(VAR_MUSIC_TIMER) = _playerV2->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