[Scummvm-cvs-logs] CVS: scummvm/scumm debugger.cpp,1.80,1.81 dialogs.cpp,1.70,1.71 imuse.cpp,2.90,2.91 imuse.h,1.44,1.45 imuse_digi.cpp,1.45,1.46 imuse_digi.h,1.13,1.14 music.h,2.4,2.5 scummvm.cpp,2.379,2.380 sound.cpp,1.244,1.245

Max Horn fingolfin at users.sourceforge.net
Mon Sep 8 21:09:09 CEST 2003


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

Modified Files:
	debugger.cpp dialogs.cpp imuse.cpp imuse.h imuse_digi.cpp 
	imuse_digi.h music.h scummvm.cpp sound.cpp 
Log Message:
make even more use of Scumm::_musicEngine; added MusicEngine::setMasterVolume

Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- debugger.cpp	7 Sep 2003 16:16:19 -0000	1.80
+++ debugger.cpp	8 Sep 2003 17:06:44 -0000	1.81
@@ -364,76 +364,63 @@
 	return false;
 }
 
-bool ScummDebugger::Cmd_IMuse (int argc, const char **argv) {
+bool ScummDebugger::Cmd_IMuse(int argc, const char **argv) {
 	if (!_s->_imuse && !_s->_playerV2) {
-		Debug_Printf ("No iMuse engine is active.\n");
+		Debug_Printf("No iMuse engine is active.\n");
 		return true;
 	}
 
 	if (argc > 1) {
-		if (!strcmp (argv[1], "panic")) {
-			if (_s->_imuse)
-				_s->_imuse->stopAllSounds();
-			if (_s->_playerV2)
-				_s->_playerV2->stopAllSounds();
-			Debug_Printf ("AAAIIIEEEEEE!\n");
-			Debug_Printf ("Shutting down all music tracks\n");
+		if (!strcmp(argv[1], "panic")) {
+			_s->_musicEngine->stopAllSounds();
+			Debug_Printf("AAAIIIEEEEEE!\n");
+			Debug_Printf("Shutting down all music tracks\n");
 			return true;
 		} else if (!strcmp (argv[1], "multimidi")) {
-			if (argc > 2 && (!strcmp (argv[2], "on") || !strcmp (argv[2], "off"))) {
+			if (argc > 2 && (!strcmp(argv[2], "on") || !strcmp(argv[2], "off"))) {
 				if (_s->_imuse)
-					_s->_imuse->property (IMuse::PROP_MULTI_MIDI, !strcmp (argv[2], "on"));
-				Debug_Printf ("MultiMidi mode switched %s.\n", argv[2]);
+					_s->_imuse->property(IMuse::PROP_MULTI_MIDI, !strcmp(argv[2], "on"));
+				Debug_Printf("MultiMidi mode switched %s.\n", argv[2]);
 			} else {
-				Debug_Printf ("Specify \"on\" or \"off\" to switch.\n");
+				Debug_Printf("Specify \"on\" or \"off\" to switch.\n");
 			}
 			return true;
-		} else if (!strcmp (argv[1], "play")) {
-			if (argc > 2 && (!strcmp (argv[2], "random") || atoi (argv[2]) != 0)) {
-				int sound = atoi (argv[2]);
-				if (!strcmp (argv[2], "random")) {
-					Debug_Printf ("Selecting from %d songs...\n", _s->getNumSounds());
-					sound = _s->_rnd.getRandomNumber (_s->getNumSounds());
+		} else if (!strcmp(argv[1], "play")) {
+			if (argc > 2 && (!strcmp(argv[2], "random") || atoi(argv[2]) != 0)) {
+				int sound = atoi(argv[2]);
+				if (!strcmp(argv[2], "random")) {
+					Debug_Printf("Selecting from %d songs...\n", _s->getNumSounds());
+					sound = _s->_rnd.getRandomNumber(_s->getNumSounds());
 				}
 				_s->ensureResourceLoaded(rtSound, sound);
-				if (_s->_imuse)
-					_s->_imuse->startSound(sound);
-				if (_s->_playerV2) {
-					_s->_playerV2->startSound(sound);
-				}
+				_s->_musicEngine->startSound(sound);
 
-				Debug_Printf ("Attempted to start music %d.\n", sound);
+				Debug_Printf("Attempted to start music %d.\n", sound);
 			} else {
-				Debug_Printf ("Specify a music resource # from 1-255.\n");
+				Debug_Printf("Specify a music resource # from 1-255.\n");
 			}
 			return true;
-		} else if (!strcmp (argv[1], "stop")) {
-			if (argc > 2 && (!strcmp (argv[2], "all") || atoi (argv[2]) != 0)) {
-				if (!strcmp (argv[2], "all")) {
-					if (_s->_imuse)
-						_s->_imuse->stopAllSounds();
-					if (_s->_playerV2)
-						_s->_playerV2->stopAllSounds();
-					Debug_Printf ("Shutting down all music tracks.\n");
+		} else if (!strcmp(argv[1], "stop")) {
+			if (argc > 2 && (!strcmp(argv[2], "all") || atoi(argv[2]) != 0)) {
+				if (!strcmp(argv[2], "all")) {
+					_s->_musicEngine->stopAllSounds();
+					Debug_Printf("Shutting down all music tracks.\n");
 				} else {
-					if (_s->_imuse)
-						_s->_imuse->stopSound(atoi (argv[2]));
-					if (_s->_playerV2)
-						_s->_playerV2->stopSound(atoi (argv[2]));
-					Debug_Printf ("Attempted to stop music %d.\n", atoi (argv[2]));
+					_s->_musicEngine->stopSound(atoi(argv[2]));
+					Debug_Printf("Attempted to stop music %d.\n", atoi(argv[2]));
 				}
 			} else {
-				Debug_Printf ("Specify a music resource # or \"all\".\n");
+				Debug_Printf("Specify a music resource # or \"all\".\n");
 			}
 			return true;
 		}
 	}
 
-	Debug_Printf ("Available iMuse commands:\n");
-	Debug_Printf ("  panic - Stop all music tracks\n");
-	Debug_Printf ("  multimidi on/off - Toggle dual MIDI drivers\n");
-	Debug_Printf ("  play # - Play a music resource\n");
-	Debug_Printf ("  stop # - Stop a music resource\n");
+	Debug_Printf("Available iMuse commands:\n");
+	Debug_Printf("  panic - Stop all music tracks\n");
+	Debug_Printf("  multimidi on/off - Toggle dual MIDI drivers\n");
+	Debug_Printf("  play # - Play a music resource\n");
+	Debug_Printf("  stop # - Stop a music resource\n");
 	return true;
 }
 

Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- dialogs.cpp	7 Sep 2003 19:28:45 -0000	1.70
+++ dialogs.cpp	8 Sep 2003 17:06:44 -0000	1.71
@@ -536,10 +536,9 @@
 		
 		if (_scumm->_imuse) {
 			_scumm->_imuse->set_music_volume(_soundVolumeMusic);
-			_scumm->_imuse->setMasterVolume(_soundVolumeMaster);
 		}
-		if (_scumm->_playerV2) {
-			_scumm->_playerV2->setMasterVolume(_soundVolumeMaster);
+		if (_scumm->_musicEngine) {
+			_scumm->_musicEngine->setMasterVolume(_soundVolumeMaster);
 		}
 
 		_scumm->_mixer->setVolume(_soundVolumeSfx * _soundVolumeMaster / 255);

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.90
retrieving revision 2.91
diff -u -d -r2.90 -r2.91
--- imuse.cpp	7 Sep 2003 19:28:45 -0000	2.90
+++ imuse.cpp	8 Sep 2003 17:06:44 -0000	2.91
@@ -1752,7 +1752,7 @@
 int IMuse::save_or_load(Serializer *ser, Scumm *scumm) { in(); int ret = _target->save_or_load(ser, scumm); out(); return ret; }
 int IMuse::set_music_volume(uint vol) { in(); int ret = _target->set_music_volume(vol); out(); return ret; }
 int IMuse::get_music_volume() { in(); int ret = _target->get_music_volume(); out(); return ret; }
-int IMuse::setMasterVolume(uint vol) { in(); int ret = _target->setMasterVolume(vol); out(); return ret; }
+void IMuse::setMasterVolume(int vol) { in(); _target->setMasterVolume(vol); out(); }
 int IMuse::get_master_volume() { in(); int ret = _target->get_master_volume(); out(); return ret; }
 void IMuse::startSound(int sound) { in(); _target->startSound(sound); out(); }
 void IMuse::stopSound(int sound) { in(); _target->stopSound(sound); out(); }

Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- imuse.h	7 Sep 2003 19:28:45 -0000	1.44
+++ imuse.h	8 Sep 2003 17:06:44 -0000	1.45
@@ -61,7 +61,7 @@
 	int save_or_load(Serializer *ser, Scumm *scumm);
 	int set_music_volume(uint vol);
 	int get_music_volume();
-	int setMasterVolume(uint vol);
+	void setMasterVolume(int vol);
 	int get_master_volume();
 	void startSound(int sound);
 	void stopSound(int sound);

Index: imuse_digi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- imuse_digi.cpp	7 Sep 2003 20:30:02 -0000	1.45
+++ imuse_digi.cpp	8 Sep 2003 17:06:44 -0000	1.46
@@ -689,11 +689,11 @@
 	return ret_sound;
 }
 
-static void imus_digital_handler(void *engine) {
+void IMuseDigital::timer_handler(void *engine) {
 	// Avoid race condition
 	Scumm *scumm = (Scumm *)engine;
 	if (scumm && scumm->_imuseDigital)
-		scumm->_imuseDigital->handler();
+		scumm->_imuseDigital->musicTimer();
 }
 
 IMuseDigital::IMuseDigital(Scumm *scumm)
@@ -702,19 +702,19 @@
 	for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 		_channel[l]._mixerChannel = 0;
 	}
-	_scumm->_timer->installProcedure(imus_digital_handler, 200000);
+	_scumm->_timer->installProcedure(timer_handler, 200000);
 	_pause = false;
 }
 
 IMuseDigital::~IMuseDigital() {
-	_scumm->_timer->releaseProcedure(imus_digital_handler);
+	_scumm->_timer->releaseProcedure(timer_handler);
 
 	for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 		_scumm->_mixer->stopChannel(_channel[l]._mixerChannel);
 	}
 }
 
-void IMuseDigital::handler() {
+void IMuseDigital::musicTimer() {
 	int l = 0;
 
 	if (_pause)

Index: imuse_digi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- imuse_digi.h	7 Sep 2003 19:28:45 -0000	1.13
+++ imuse_digi.h	8 Sep 2003 17:06:44 -0000	1.14
@@ -63,10 +63,15 @@
 	Scumm *_scumm;
 	bool _pause;
 
+	static void timer_handler(void *engine);
+	void musicTimer();
+
 public:
 	IMuseDigital(Scumm *scumm);
 	~IMuseDigital();
-	void handler();
+
+	void setMasterVolume(int vol) {}
+
 	void startSound(int sound);
 	void stopSound(int sound);
 	void stopAllSounds();

Index: music.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/music.h,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -d -r2.4 -r2.5
--- music.h	7 Sep 2003 19:28:45 -0000	2.4
+++ music.h	8 Sep 2003 17:06:44 -0000	2.5
@@ -30,7 +30,7 @@
 public:
 	virtual ~MusicEngine() {}
 
-//	virtual void setMasterVolume(int vol) = 0;
+	virtual void setMasterVolume(int vol) = 0;
 
 	virtual void startSound(int sound) = 0;
 	virtual void stopSound(int sound) = 0;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.379
retrieving revision 2.380
diff -u -d -r2.379 -r2.380
--- scummvm.cpp	8 Sep 2003 15:38:31 -0000	2.379
+++ scummvm.cpp	8 Sep 2003 17:06:44 -0000	2.380
@@ -700,7 +700,7 @@
 	} else if ((_features & GF_AMIGA) && (_version == 3)) {
 		_musicEngine = _playerV3A = new Player_V3A(this);
 	} else if ((_features & GF_AMIGA) && (_version < 5)) {
-		_playerV2 = NULL;
+		_musicEngine = NULL;
 	} else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && ((_version > 2) && (_version < 5))) {
 		_musicEngine = _playerV2 = new Player_V2(this);
 	} else if (_version > 2) {
@@ -787,10 +787,7 @@
 	delete _confirmExitDialog;
 
 	delete _sound;
-	delete _imuse;
-	delete _imuseDigital;
-	delete _playerV2;
-	delete _playerV3A;
+	delete _musicEngine;
 	free(_languageBuffer);
 	free(_audioNames);
 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.244
retrieving revision 1.245
diff -u -d -r1.244 -r1.245
--- sound.cpp	8 Sep 2003 11:41:28 -0000	1.244
+++ sound.cpp	8 Sep 2003 17:06:44 -0000	1.245
@@ -672,17 +672,8 @@
 	if (!_scumm->isResourceLoaded(rtSound, sound))
 		return 0;
 
-	if (_scumm->_imuseDigital)
-		return _scumm->_imuseDigital->getSoundStatus(sound);
-
-	if (_scumm->_imuse)
-		return _scumm->_imuse->getSoundStatus(sound);
-
-	if (_scumm->_playerV2)
-		return _scumm->_playerV2->getSoundStatus(sound);
-
-	if (_scumm->_playerV3A)
-		return _scumm->_playerV3A->getSoundStatus(sound);
+	if (_scumm->_musicEngine)
+		return _scumm->_musicEngine->getSoundStatus(sound);
 
 	return 0;
 }
@@ -770,23 +761,21 @@
 		stopCD();
 	}
 
-	if (_scumm->_imuse) {
-		_scumm->_imuse->stopAllSounds();
-		_scumm->_imuse->clear_queue();
-	} else if (_scumm->_playerV2) {
-		_scumm->_playerV2->stopAllSounds();
-	} else 	if (_scumm->_playerV3A) {
-		_scumm->_playerV3A->stopAllSounds();
-	}
-
 	// Clear the (secondary) sound queue
 	_soundQue2Pos = 0;
 	memset(_soundQue2, 0, sizeof(_soundQue2));
 
+	if (_scumm->_musicEngine) {
+		_scumm->_musicEngine->stopAllSounds();
+	}
+	if (_scumm->_imuse) {
+		// FIXME: Maybe we could merge this call to clear_queue()
+		// into IMuse::stopAllSounds() ?
+		_scumm->_imuse->clear_queue();
+	}
+
 	// Stop all SFX
-	if (_scumm->_imuseDigital) {
-		_scumm->_imuseDigital->stopAllSounds();
-	} else {
+	if (!_scumm->_imuseDigital) {
 		_scumm->_mixer->stopAll();
 	}
 }





More information about the Scummvm-git-logs mailing list