[Scummvm-cvs-logs] SF.net SVN: scummvm:[49605] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Jun 12 13:41:22 CEST 2010


Revision: 49605
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49605&view=rev
Author:   thebluegr
Date:     2010-06-12 11:41:22 +0000 (Sat, 12 Jun 2010)

Log Message:
-----------
Added debug output to kDoAudio and some music commands. Also added a warning when an audio stream can't be created. Finally, the debug level of the MIDI parser debug output has been raised to 4, as it's too verbose

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/ksound.cpp
    scummvm/trunk/engines/sci/sound/audio.cpp
    scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
    scummvm/trunk/engines/sci/sound/soundcmd.cpp

Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp	2010-06-12 11:32:28 UTC (rev 49604)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp	2010-06-12 11:41:22 UTC (rev 49605)
@@ -119,6 +119,8 @@
 			return NULL_REG;
 		}
 
+		debugC(2, kDebugLevelSound, "kDoAudio: play sample %d, module %d", number, module);
+
 		// return sample length in ticks
 		if (argv[0].toUint16() == kSciAudioWPlay)
 			return make_reg(0, g_sci->_audio->wPlayAudio(module, number));
@@ -126,31 +128,39 @@
 			return make_reg(0, g_sci->_audio->startAudio(module, number));
 	}
 	case kSciAudioStop:
+		debugC(2, kDebugLevelSound, "kDoAudio: stop");
 		g_sci->_audio->stopAudio();
 		break;
 	case kSciAudioPause:
+		debugC(2, kDebugLevelSound, "kDoAudio: pause");
 		g_sci->_audio->pauseAudio();
 		break;
 	case kSciAudioResume:
+		debugC(2, kDebugLevelSound, "kDoAudio: resume");
 		g_sci->_audio->resumeAudio();
 		break;
 	case kSciAudioPosition:
+		//debugC(2, kDebugLevelSound, "kDoAudio: get position");	// too verbose
 		return make_reg(0, g_sci->_audio->getAudioPosition());
 	case kSciAudioRate:
+		debugC(2, kDebugLevelSound, "kDoAudio: set audio rate to %d", argv[1].toUint16());
 		g_sci->_audio->setAudioRate(argv[1].toUint16());
 		break;
 	case kSciAudioVolume: {
 		int16 volume = argv[1].toUint16();
 		volume = CLIP<int16>(volume, 0, AUDIO_VOLUME_MAX);
+		debugC(2, kDebugLevelSound, "kDoAudio: set volume to %d", volume);
 		mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume * 2);
 		break;
 	}
 	case kSciAudioLanguage:
 		// In SCI1.1: tests for digital audio support
-		if (getSciVersion() == SCI_VERSION_1_1)
+		if (getSciVersion() == SCI_VERSION_1_1) {
+			debugC(2, kDebugLevelSound, "kDoAudio: audio capability test");
 			return make_reg(0, 1);
-		else {
+		} else {
 			int16 language = argv[1].toSint16();
+			debugC(2, kDebugLevelSound, "kDoAudio: set language to %d", language);
 
 			if (language != -1)
 				g_sci->getResMan()->setAudioLanguage(language);
@@ -162,6 +172,7 @@
 		}
 		break;
 	case kSciAudioCD:
+		debugC(2, kDebugLevelSound, "kDoAudio: CD audio subop");
 		return kDoCdAudio(s, argc - 1, argv + 1);
 	// TODO: There are 3 more functions used in Freddy Pharkas (11, 12 and 13) and new within sierra sci
 	//			Details currently unknown

Modified: scummvm/trunk/engines/sci/sound/audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/audio.cpp	2010-06-12 11:32:28 UTC (rev 49604)
+++ scummvm/trunk/engines/sci/sound/audio.cpp	2010-06-12 11:41:22 UTC (rev 49605)
@@ -69,6 +69,8 @@
 		_wPlayFlag = false;
 		_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_audioHandle, audioStream);
 		return sampleLen;
+	} else {
+		warning("startAudio: unable to create stream for audio number %d, module %d", number, module);
 	}
 
 	return 0;
@@ -81,6 +83,8 @@
 
 	int sampleLen = 0;
 	Audio::AudioStream *audioStream = getAudioStream(module, tuple, &sampleLen);
+	if (!audioStream)
+		warning("wPlayAudio: unable to create stream for audio tuple %d, module %d", tuple, module);
 	delete audioStream;
 	_wPlayFlag = true;
 	return sampleLen;

Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-06-12 11:32:28 UTC (rev 49604)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-06-12 11:41:22 UTC (rev 49605)
@@ -148,12 +148,12 @@
 		_dataincAdd = false;
 		_pSnd->dataInc += _dataincToAdd;
 		_pSnd->signal = 0x7f + _pSnd->dataInc;
-		debugC(2, kDebugLevelSound, "datainc %04x", _dataincToAdd);
+		debugC(4, kDebugLevelSound, "datainc %04x", _dataincToAdd);
 	}
 	if (_signalSet) {
 		_signalSet = false;
 		_pSnd->signal = _signalToSet;
-		debugC(2, kDebugLevelSound, "signal %04x", _signalToSet);
+		debugC(4, kDebugLevelSound, "signal %04x", _signalToSet);
 	}
 
 	info.start = _position._play_pos;
@@ -313,7 +313,7 @@
 					_pSnd->status = kSoundStopped;
 					_pSnd->signal = SIGNAL_OFFSET;
 
-					debugC(2, kDebugLevelSound, "signal EOT");
+					debugC(4, kDebugLevelSound, "signal EOT");
 				}
 			}
 			break;
@@ -376,21 +376,21 @@
 
 		command = *channel->data++;
 		if (command != kEndOfTrack) {
-			debugC(2, kDebugLevelSound, "\nDELTA ");
+			debugC(4, kDebugLevelSound, "\nDELTA ");
 			// Write delta
 			while (new_delta > 240) {
 				*outData++ = 0xF8;
-				debugC(2, kDebugLevelSound, "F8 ");
+				debugC(4, kDebugLevelSound, "F8 ");
 				new_delta -= 240;
 			}
 			*outData++ = (byte)new_delta;
-			debugC(2, kDebugLevelSound, "%02X ", (uint32)new_delta);
+			debugC(4, kDebugLevelSound, "%02X ", (uint32)new_delta);
 		}
 		// Write command
 		switch (command) {
 		case 0xF0: // sysEx
 			*outData++ = command;
-			debugC(2, kDebugLevelSound, "%02X ", command);
+			debugC(4, kDebugLevelSound, "%02X ", command);
 			do {
 				par1 = *channel->data++;
 				*outData++ = par1; // out
@@ -478,22 +478,22 @@
 		}
 		if ((1 << curChannel) & channelMask) {
 			if (command != kEndOfTrack) {
-				debugC(2, kDebugLevelSound, "\nDELTA ");
+				debugC(4, kDebugLevelSound, "\nDELTA ");
 				// Write delta
 				while (delta > 240) {
 					*outData++ = 0xF8;
-					debugC(2, kDebugLevelSound, "F8 ");
+					debugC(4, kDebugLevelSound, "F8 ");
 					delta -= 240;
 				}
 				*outData++ = (byte)delta;
-				debugC(2, kDebugLevelSound, "%02X ", delta);
+				debugC(4, kDebugLevelSound, "%02X ", delta);
 				delta = 0;
 			}
 			// Write command
 			switch (command) {
 			case 0xF0: // sysEx
 				*outData++ = command;
-				debugC(2, kDebugLevelSound, "%02X ", command);
+				debugC(4, kDebugLevelSound, "%02X ", command);
 				do {
 					curByte = *channelData++;
 					*outData++ = curByte; // out
@@ -507,20 +507,20 @@
 			default: // MIDI command
 				if (lastCommand != command) {
 					*outData++ = command;
-					debugC(2, kDebugLevelSound, "%02X ", command);
+					debugC(4, kDebugLevelSound, "%02X ", command);
 					lastCommand = command;
 				}
 				if (midiParamCount > 0) {
 					if (curByte & 0x80) {
-						debugC(2, kDebugLevelSound, "%02X ", *channelData);
+						debugC(4, kDebugLevelSound, "%02X ", *channelData);
 						*outData++ = *channelData++;
 					} else {
-						debugC(2, kDebugLevelSound, "%02X ", curByte);
+						debugC(4, kDebugLevelSound, "%02X ", curByte);
 						*outData++ = curByte;
 					}
 				}
 				if (midiParamCount > 1) {
-					debugC(2, kDebugLevelSound, "%02X ", *channelData);
+					debugC(4, kDebugLevelSound, "%02X ", *channelData);
 					*outData++ = *channelData++;
 				}
 			}

Modified: scummvm/trunk/engines/sci/sound/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-06-12 11:32:28 UTC (rev 49604)
+++ scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-06-12 11:41:22 UTC (rev 49605)
@@ -307,6 +307,9 @@
 	if (_soundVersion >= SCI_VERSION_1_EARLY)
 		newSound->volume = CLIP<int>(readSelectorValue(_segMan, obj, SELECTOR(vol)), 0, MUSIC_VOLUME_MAX);
 
+	debugC(2, kDebugLevelSound, "cmdInitSound, number %d, loop %d, prio %d, vol %d", resourceId, 
+			newSound->loop, newSound->priority, newSound->volume);
+
 	// In SCI1.1 games, sound effects are started from here. If we can find
 	// a relevant audio resource, play it, otherwise switch to synthesized
 	// effects. If the resource exists, play it using map 65535 (sound
@@ -423,8 +426,6 @@
 		// Find slot again :)
 		musicSlot = _music->getSlot(obj);
 	}
-	int16 loop = readSelectorValue(_segMan, obj, SELECTOR(loop));
-	debugC(2, kDebugLevelSound, "cmdPlaySound: resource number %d, loop %d", resourceId, loop);
 
 	writeSelector(_segMan, obj, SELECTOR(handle), obj);
 
@@ -442,6 +443,10 @@
 	musicSlot->priority = readSelectorValue(_segMan, obj, SELECTOR(priority));
 	if (_soundVersion >= SCI_VERSION_1_EARLY)
 		musicSlot->volume = readSelectorValue(_segMan, obj, SELECTOR(vol));
+
+	debugC(2, kDebugLevelSound, "cmdPlaySound, number %d, loop %d, prio %d, vol %d", resourceId, 
+			musicSlot->loop, musicSlot->priority, musicSlot->volume);
+
 	_music->soundPlay(musicSlot);
 
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list