[Scummvm-cvs-logs] CVS: scummvm/scumm imuse_digi.cpp,1.75,1.76 imuse_digi.h,1.21,1.22 script_v6.cpp,1.220,1.221 sound.cpp,1.293,1.294

Pawel Kolodziejski aquadran at users.sourceforge.net
Thu Dec 25 05:57:00 CET 2003


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

Modified Files:
	imuse_digi.cpp imuse_digi.h script_v6.cpp sound.cpp 
Log Message:
some changes to digital imuse

Index: imuse_digi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- imuse_digi.cpp	25 Dec 2003 11:14:05 -0000	1.75
+++ imuse_digi.cpp	25 Dec 2003 13:56:22 -0000	1.76
@@ -719,7 +719,7 @@
 
 void IMuseDigital::timer_handler(void *refCon) {
 	IMuseDigital *imuseDigital = (IMuseDigital *)refCon;
-	imuseDigital->mixerCallback();
+	imuseDigital->callback();
 }
 
 IMuseDigital::IMuseDigital(ScummEngine *scumm)
@@ -746,7 +746,7 @@
 	delete _bundle;
 }
 
-void IMuseDigital::mixerCallback() {
+void IMuseDigital::callback() {
 	int l = 0;
 
 	if (_pause || !_scumm)
@@ -756,7 +756,7 @@
 		if (_channel[l].used) {
 			if (_channel[l].toBeRemoved) {
 				_scumm->_mixer->endStream(_channel[l].handle);
-				debug(5, "IMuseDigital::mixerCallback(): stop sound: %d", _channel[l].idSound);
+				debug(0, "IMuseDigital::mixerCallback(): stop sound: %d", _channel[l].idSound);
 
 				free(_channel[l].data);
 				_channel[l].used = false;
@@ -784,7 +784,7 @@
 						}
 					}
 				}
-				debug(5, "Fade: sound(%d), Vol(%d)", _channel[l].idSound, _channel[l].vol / 1000);
+				debug(0, "Fade: sound(%d), Vol(%d)", _channel[l].idSound, _channel[l].vol / 1000);
 			}
 
 			int32 mixer_size = _channel[l].mixerSize;
@@ -808,7 +808,7 @@
 }
 
 void IMuseDigital::startSound(int sound) {
-	debug(5, "IMuseDigital::startSound(%d)", sound);
+	debug(0, "IMuseDigital::startSound(%d)", sound);
 	int l, r;
 
 	for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
@@ -965,7 +965,7 @@
 }
 
 void IMuseDigital::stopSound(int sound) {
-	debug(5, "IMuseDigital::stopSound(%d)", sound);
+	debug(0, "IMuseDigital::stopSound(%d)", sound);
 	for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 		if ((_channel[l].idSound == sound) && _channel[l].used) {
 			_channel[l].toBeRemoved = true;
@@ -974,7 +974,7 @@
 }
 
 void IMuseDigital::stopAllSounds() {
-	debug(5, "IMuseDigital::stopAllSounds");
+	debug(0, "IMuseDigital::stopAllSounds");
 	for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 		if (_channel[l].used) {
 			_channel[l].toBeRemoved = true;
@@ -992,7 +992,7 @@
 	pauseBundleMusic(p);
 }
 
-void IMuseDigital::parseScriptQues(int a, int b, int c, int d, int e, int f, int g, int h) {
+void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int g, int h) {
 	int cmd = a;
 	int sample = b;
 	int sub_cmd = c;
@@ -1004,7 +1004,7 @@
 
 	switch (cmd) {
 	case 10: // ImuseStopAllSounds
-		debug(5, "ImuseStopAllSounds()");
+		debug(0, "ImuseStopAllSounds()");
 		stopAllSounds();
 		return;
 	case 12: // ImuseSetParam
@@ -1012,7 +1012,7 @@
 		case 0x500: // set priority - could be ignored
 			return;
 		case 0x600: // set volume
-			debug(5, "ImuseSetParam (%x), sample(%d), volume(%d)", sub_cmd, sample, d);
+			debug(0, "ImuseSetParam (%x), sample(%d), volume(%d)", sub_cmd, sample, d);
 			for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 				if ((_channel[l].idSound == sample) && _channel[l].used) {
 					chan = l;
@@ -1028,7 +1028,7 @@
 				_channel[chan].volFadeStep = (_channel[chan].volFadeDest - _channel[chan].vol) / (((1000 * _channel[chan].volFadeDelay) / 60) / 40);
 			return;
 		case 0x700: // set pan
-			debug(5, "ImuseSetParam (0x700), sample(%d), pan(%d)", sample, d);
+			debug(0, "ImuseSetParam (0x700), sample(%d), pan(%d)", sample, d);
 			for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 				if ((_channel[l].idSound == sample) && _channel[l].used) {
 					chan = l;
@@ -1036,7 +1036,7 @@
 				}
 			}
 			if (chan == -1) {
-				debug(5, "ImuseSetParam (0x700), sample(%d) not exist in channels", sample);
+				debug(0, "ImuseSetParam (0x700), sample(%d) not exist in channels", sample);
 				return;
 			}
 			_channel[chan].pan = d;
@@ -1048,7 +1048,7 @@
 	case 14: // ImuseFadeParam
 		switch (sub_cmd) {
 		case 0x600: // set new volume with fading
-			debug(5, "ImuseFadeParam - fade sample(%d), to volume(%d) with 60hz ticks(%d)", sample, d, e);
+			debug(0, "ImuseFadeParam - fade sample(%d), to volume(%d) with 60hz ticks(%d)", sample, d, e);
 			if ((_scumm->_gameId == GID_DIG) && (_scumm->_features & GF_DEMO)) {
 				stopSound(sample);
 				return;
@@ -1060,21 +1060,21 @@
 				}
 			}
 			if (chan == -1) {
-				debug(5, "ImuseFadeParam (0x600), sample %d not exist in channels", sample);
+				debug(0, "ImuseFadeParam (0x600), sample %d not exist in channels", sample);
 				return;
 			}
 			_channel[chan].volFadeDelay = e;
 			_channel[chan].volFadeDest = d * 1000;
 			_channel[chan].volFadeStep = (_channel[chan].volFadeDest - _channel[chan].vol) / (((1000 * e) / 60) / 40);
 			_channel[chan].volFadeUsed = true;
-			debug(5, "ImuseFadeParam: vol %d, volDest %d, step %d", _channel[chan].vol, d * 1000, _channel[chan].volFadeStep);
+			debug(0, "ImuseFadeParam: vol %d, volDest %d, step %d", _channel[chan].vol, d * 1000, _channel[chan].volFadeStep);
 			return;
 		default:
 			warning("IMuseDigital::doCommand FadeParam DEFAULT sub command %d", sub_cmd);
 			return;
 		}
 	case 0x1000: // ImuseSetState
-		debug(5, "ImuseSetState (%d)", b);
+		debug(0, "ImuseSetState (%d)", b);
 		if ((_scumm->_gameId == GID_DIG) && (_scumm->_features & GF_DEMO)) {
 			if (b == 1)
 				startSound(1);
@@ -1095,7 +1095,7 @@
 				}
 				if (_digStateMusicMap[l].room == b) {
 					int music = _digStateMusicMap[l].table_index;
-					debug(5, "Play imuse music: %s, %s, %s", _digStateMusicTable[music].name, _digStateMusicTable[music].title, _digStateMusicTable[music].filename);
+					debug(0, "Play imuse music: %s, %s, %s", _digStateMusicTable[music].name, _digStateMusicTable[music].title, _digStateMusicTable[music].filename);
 					if ((_digStateMusicTable[music].filename[0] != 0) && 
 						(strcmp(_digStateMusicTable[_digStateMusicTable[music].unk3].filename, _nameBundleMusic) != 0) ) {
 						playBundleMusic(_digStateMusicTable[music].filename);
@@ -1128,7 +1128,7 @@
 					return;
 				}
 				if ((_comiStateMusicTable[l].id == b)) {
-					debug(5, "Play imuse music: %s, %s, %s", _comiStateMusicTable[l].name, _comiStateMusicTable[l].title, _comiStateMusicTable[l].filename);
+					debug(0, "Play imuse music: %s, %s, %s", _comiStateMusicTable[l].name, _comiStateMusicTable[l].title, _comiStateMusicTable[l].filename);
 					if (_comiStateMusicTable[l].filename[0] != 0) {
 						playBundleMusic(_comiStateMusicTable[l].filename);
 					}
@@ -1141,12 +1141,12 @@
 					return;
 				}
 				if (_ftStateMusicTable[l].index == b) {
-					debug(5, "Play imuse music: %s, %s", _ftStateMusicTable[l].name, _ftStateMusicTable[l].audioname);
+					debug(0, "Play imuse music: %s, %s", _ftStateMusicTable[l].name, _ftStateMusicTable[l].audioname);
 					if (_ftStateMusicTable[l].audioname[0] != 0) {
 						for (r = 0; r < _scumm->_numAudioNames; r++) {
 							if (strcmp(_ftStateMusicTable[l].audioname, &_scumm->_audioNames[r * 9]) == 0) {
 								startSound(r);
-								parseScriptQues(12, r, 1536, _ftStateMusicTable[l].volume, 0, 0, 0, 0);
+								parseScriptCmds(12, r, 1536, _ftStateMusicTable[l].volume, 0, 0, 0, 0);
 							}
 						}
 					}
@@ -1155,14 +1155,14 @@
 		}
 		return;
 	case 0x1001: // ImuseSetSequence
-		debug(5, "ImuseSetSequence (%d)", b);
+		debug(0, "ImuseSetSequence (%d)", b);
 		if (_scumm->_gameId == GID_DIG) {
 			for (l = 0;; l++) {
 				if (_digSeqMusicTable[l].room == -1) {
 					return;
 				}
 				if ((_digSeqMusicTable[l].room == b)) {
-					debug(5, "Play imuse music: %s, %s, %s", _digSeqMusicTable[l].name, _digSeqMusicTable[l].title, _digSeqMusicTable[l].filename);
+					debug(0, "Play imuse music: %s, %s, %s", _digSeqMusicTable[l].name, _digSeqMusicTable[l].title, _digSeqMusicTable[l].filename);
 					if (_digSeqMusicTable[l].filename[0] != 0) {
 						playBundleMusic(_digSeqMusicTable[l].filename);
 					}
@@ -1175,7 +1175,7 @@
 					return;
 				}
 				if ((_comiSeqMusicTable[l].id == b)) {
-					debug(5, "Play imuse music: %s, %s, %s", _comiSeqMusicTable[l].name, _comiSeqMusicTable[l].title, _comiSeqMusicTable[l].filename);
+					debug(0, "Play imuse music: %s, %s, %s", _comiSeqMusicTable[l].name, _comiSeqMusicTable[l].title, _comiSeqMusicTable[l].filename);
 					if (_comiSeqMusicTable[l].filename[0] != 0) {
 						playBundleMusic(_comiSeqMusicTable[l].filename);
 					}
@@ -1188,12 +1188,12 @@
 					return;
 				}
 				if (_ftSeqMusicTable[l].index == b) {
-					debug(5, "Play imuse music: %s, %s", _ftSeqMusicTable[l].name, _ftSeqMusicTable[l].audioname);
+					debug(0, "Play imuse music: %s, %s", _ftSeqMusicTable[l].name, _ftSeqMusicTable[l].audioname);
 					if (_ftSeqMusicTable[l].audioname[0] != 0) {
 						for (r = 0; r < _scumm->_numAudioNames; r++) {
 							if (strcmp(_ftSeqMusicTable[l].audioname, &_scumm->_audioNames[r * 9]) == 0) {
 								startSound(r);
-								parseScriptQues(12, r, 1536, _ftSeqMusicTable[l].volume, 0, 0, 0, 0);
+								parseScriptCmds(12, r, 1536, _ftSeqMusicTable[l].volume, 0, 0, 0, 0);
 							}
 						}
 					}
@@ -1202,19 +1202,19 @@
 		}
 		return;
 	case 0x1002: // ImuseSetCuePoint
-		debug(5, "ImuseSetCuePoint (%d)", b);
+		debug(0, "ImuseSetCuePoint (%d)", b);
 		return;
 	case 0x1003: // ImuseSetAttribute
-		debug(5, "ImuseSetAttribute (%d, %d)", b, c);
+		debug(0, "ImuseSetAttribute (%d, %d)", b, c);
 		return;
 	case 0x2000: // ImuseSetMasterSFXVolume
-		debug(5, "ImuseSetMasterSFXVolume (%d)", b);
+		debug(0, "ImuseSetMasterSFXVolume (%d)", b);
 		return;
 	case 0x2001: // ImuseSetMasterVoiceVolume
-		debug(5, "ImuseSetMasterVoiceVolume (%d)", b);
+		debug(0, "ImuseSetMasterVoiceVolume (%d)", b);
 		return;
 	case 0x2002: // ImuseSetMasterMusicVolume
-		debug(5, "ImuseSetMasterMusicVolume (%d)", b);
+		debug(0, "ImuseSetMasterMusicVolume (%d)", b);
 		return;
 	default:
 		warning("IMuseDigital::doCommand DEFAULT command %d", cmd);
@@ -1222,7 +1222,7 @@
 }
 
 int IMuseDigital::getSoundStatus(int sound) const {
-	debug(5, "IMuseDigital::getSoundStatus(%d)", sound);
+	debug(0, "IMuseDigital::getSoundStatus(%d)", sound);
 	for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 		if ((_channel[l].idSound == sound) && _channel[l].used) {
 			return 1;

Index: imuse_digi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- imuse_digi.h	25 Dec 2003 11:14:05 -0000	1.21
+++ imuse_digi.h	25 Dec 2003 13:56:22 -0000	1.22
@@ -95,7 +95,7 @@
 	bool _pause;
 
 	static void timer_handler(void *refConf);
-	void mixerCallback();
+	void callback();
 
 	//
 	// Bundle music
@@ -141,7 +141,7 @@
 	void stopSound(int sound);
 	void stopAllSounds();
 	void pause(bool pause);
-	void parseScriptQues(int a, int b, int c, int d, int e, int f, int g, int h);
+	void parseScriptCmds(int a, int b, int c, int d, int e, int f, int g, int h);
 	int getSoundStatus(int sound) const;
 };
 

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.220
retrieving revision 1.221
diff -u -d -r1.220 -r1.221
--- script_v6.cpp	25 Dec 2003 11:14:05 -0000	1.220
+++ script_v6.cpp	25 Dec 2003 13:56:22 -0000	1.221
@@ -2399,9 +2399,6 @@
 			grabCursor(args[1], args[2], args[3], args[4]);
 			break;
 		case 6: {
-//				if (_imuseDigital) {
-//					_imuseDigital->stopAllSounds();
-//				}
 				uint32 speed;
 				assert(getStringAddressVar(VAR_VIDEONAME));
 				if (strcmp((char *)getStringAddressVar(VAR_VIDEONAME), "sq3.san") == 0)

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.293
retrieving revision 1.294
diff -u -d -r1.293 -r1.294
--- sound.cpp	25 Dec 2003 11:14:05 -0000	1.293
+++ sound.cpp	25 Dec 2003 13:56:22 -0000	1.294
@@ -80,7 +80,10 @@
 	int i = 0, d, num;
 	int data[16];
 
-	processSfxQueues();
+//	processSfxQueues();
+
+	if (_scumm->_features & GF_DIGI_IMUSE)
+		return;
 
 	while (_soundQue2Pos) {
 		d = _soundQue2[--_soundQue2Pos];
@@ -104,11 +107,7 @@
 						data[0] >> 8, data[0] & 0xFF,
 						data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
 
-			if (_scumm->_features & GF_DIGI_IMUSE) {
-				if (_scumm->_imuseDigital)
-					_scumm->_imuseDigital->parseScriptQues(data[0], data[1], data[2], data[3], data[4],
-																	data[5], data[6], data[7]);
-			} else if (_scumm->_imuse) {
+			if (_scumm->_imuse) {
 				_scumm->VAR(_scumm->VAR_SOUNDRESULT) = (short)_scumm->_imuse->doCommand (num, data);
 			}
 		}
@@ -129,14 +128,11 @@
 		return;
 	}
 
-	if (READ_UINT32(ptr) == MKID('iMUS')){
-		assert(_scumm->_musicEngine);
-		_scumm->_musicEngine->startSound(soundID);
-	}
-	else if (READ_UINT32(ptr) == MKID('Crea')) {
-		assert(_scumm->_musicEngine);
+	if (_scumm->_features & GF_DIGI_IMUSE) {
 		_scumm->_musicEngine->startSound(soundID);
+		return;
 	}
+
 	// Support for SFX in Monkey Island 1, Mac version
 	// This is rather hackish right now, but works OK. SFX are not sounding
 	// 100% correct, though, not sure right now what is causing this.
@@ -594,6 +590,9 @@
 
 int Sound::isSoundRunning(int sound) const {
 
+	if (_scumm->_imuseDigital)
+		return (_scumm->_imuseDigital->getSoundStatus(sound) != 0);
+
 	if (sound == _currentCDSound)
 		return pollCD();
 
@@ -636,15 +635,15 @@
 	if (sound == _currentCDSound)
 		return pollCD() != 0;
 
+	if (_scumm->_imuseDigital)
+		return (_scumm->_imuseDigital->getSoundStatus(sound) != 0);
+
 	if (isSoundInQueue(sound))
 		return true;
 
 	if (!_scumm->isResourceLoaded(rtSound, sound))
 		return false;
 
-	if (_scumm->_imuseDigital)
-		return (_scumm->_imuseDigital->getSoundStatus(sound) != 0);
-
 	if (_scumm->_imuse)
 		return _scumm->_imuse->get_sound_active(sound);
 
@@ -687,7 +686,9 @@
 		stopCDTimer();
 	}
 
-	_scumm->_mixer->stopID(a);
+	if (!(_scumm->_features & GF_DIGI_IMUSE))
+		_scumm->_mixer->stopID(a);
+
 	if (_scumm->_musicEngine)
 		_scumm->_musicEngine->stopSound(a);
 
@@ -725,19 +726,14 @@
 void Sound::soundKludge(int *list, int num) {
 	int i;
 
-	if (list[0] == -1) {
-		processSoundQues();
+	if (_scumm->_imuseDigital) {
+		_scumm->_imuseDigital->parseScriptCmds(list[0], list[1], list[2], list[3], list[4],
+												list[5], list[6], list[7]);
 		return;
 	}
 
-	if ((_soundQuePos + num) > 0x100) {
-		// FIXME: temporarily changed this to an error to help track down what
-		// is causing the sound queue overflows(in particular, to figure out
-		// the room/script/offset where the bug occurs). Please report your
-		// findings to Fingolfin.
-		// Reverting to warning for now room 11, script 2016 offset 0x7Af9 was
-		// what it error'd on here
-		warning("Sound queue buffer overflow (%d + %d = %d)", _soundQuePos, num, _soundQuePos+num);
+	if (list[0] == -1) {
+		processSoundQues();
 		return;
 	}
 





More information about the Scummvm-git-logs mailing list