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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Dec 25 19:15:16 CET 2009


Revision: 46560
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46560&view=rev
Author:   thebluegr
Date:     2009-12-25 18:15:16 +0000 (Fri, 25 Dec 2009)

Log Message:
-----------
- Introduced a new version in the sound version detection routine, as SCI0 early games had different sound than SCI0 late ones
- Changed sound-related debug output from printf's into debugC calls

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/resource.cpp
    scummvm/trunk/engines/sci/sfx/music.cpp
    scummvm/trunk/engines/sci/sfx/soundcmd.cpp

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2009-12-25 16:29:16 UTC (rev 46559)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2009-12-25 18:15:16 UTC (rev 46560)
@@ -479,10 +479,13 @@
 
 SciVersion EngineState::detectDoSoundType() {
 	if (_doSoundType == SCI_VERSION_AUTODETECT) {
-		if (_kernel->_selectorCache.nodePtr == -1) {
-			// No nodePtr selector, so this game is definitely using
-			// SCI0 sound code (i.e. SCI_VERSION_0_EARLY)
+		if (getSciVersion() == SCI_VERSION_0_EARLY) {
+			// This game is using early SCI0 sound code (different headers than SCI0 late)
 			_doSoundType = SCI_VERSION_0_EARLY;
+		} else if (_kernel->_selectorCache.nodePtr == -1) {
+			// No nodePtr selector, so this game is definitely using newer
+			// SCI0 sound code (i.e. SCI_VERSION_0_LATE)
+			_doSoundType = SCI_VERSION_0_LATE;
 		} else {
 			if (getSciVersion() >= SCI_VERSION_1_LATE) {
 				// All SCI1 late games use the newer doSound semantics

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2009-12-25 16:29:16 UTC (rev 46559)
+++ scummvm/trunk/engines/sci/engine/state.h	2009-12-25 18:15:16 UTC (rev 46560)
@@ -239,7 +239,8 @@
 
 	/**
 	 * Autodetects the DoSound type
-	 * @return DoSound type, SCI_VERSION_0_EARLY / SCI_VERSION_1_EARLY / SCI_VERSION_1_LATE
+	 * @return DoSound type, SCI_VERSION_0_EARLY / SCI_VERSION_0_LATE / 
+	 *                       SCI_VERSION_1_EARLY / SCI_VERSION_1_LATE
 	 */
 	SciVersion detectDoSoundType();
 

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2009-12-25 16:29:16 UTC (rev 46559)
+++ scummvm/trunk/engines/sci/resource.cpp	2009-12-25 18:15:16 UTC (rev 46560)
@@ -1821,6 +1821,7 @@
 
 	switch (_soundVersion) {
 	case SCI_VERSION_0_EARLY:
+	case SCI_VERSION_0_LATE:
 		_trackCount = 1;
 		_tracks = new Track[_trackCount];
 		_tracks->nDigital = 0xFF;
@@ -1907,7 +1908,7 @@
 }
 //----------------------------------------------------
 SoundResource::Track* SoundResource::getTrackByNumber(uint16 number) {
-	if (_soundVersion == SCI_VERSION_0_EARLY)
+	if (_soundVersion <= SCI_VERSION_0_LATE)
 		return &_tracks[0];
 
 	if (/*number >= 0 &&*/number < _trackCount)
@@ -1916,7 +1917,7 @@
 }
 
 SoundResource::Track* SoundResource::getTrackByType(TrackType type) {
-	if (_soundVersion == SCI_VERSION_0_EARLY)
+	if (_soundVersion <= SCI_VERSION_0_LATE)
 		return &_tracks[0];
 
 	for (int trackNr = 0; trackNr < _trackCount; trackNr++) {
@@ -1931,7 +1932,7 @@
 	byte *data = _innerResource->data;
 	int channelMask = 0;
 
-	if (_soundVersion == SCI_VERSION_0_EARLY) {
+	if (_soundVersion <= SCI_VERSION_0_LATE) {
 		data++; // Skip over digital sample flag
 		for (int channelNr = 0; channelNr < 16; channelNr++) {
 			data++;

Modified: scummvm/trunk/engines/sci/sfx/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.cpp	2009-12-25 16:29:16 UTC (rev 46559)
+++ scummvm/trunk/engines/sci/sfx/music.cpp	2009-12-25 18:15:16 UTC (rev 46560)
@@ -611,6 +611,7 @@
 			if (info.basic.param1 == 0x60) {
 				switch (_soundVersion) {
 				case SCI_VERSION_0_EARLY:
+				case SCI_VERSION_0_LATE:
 					_pSnd->dataInc += info.basic.param2;
 					_signalSet = true;
 					_signalToSet = 0x7f + _pSnd->dataInc;
@@ -835,22 +836,22 @@
 		}
 		if ((1 << curChannel) & channelMask) {
 			if (command != 0xFC) {
-				printf("\nDELTA ");
+				debugC(2, kDebugLevelSound, "\nDELTA ");
 				// Write delta
 				while (delta > 240) {
 					*filterData++ = 0xF8;
-					printf("F8 ");
+					debugC(2, kDebugLevelSound, "F8 ");
 					delta -= 240;
 				}
 				*filterData++ = (byte)delta;
-				printf("%02X ", delta);
+				debugC(2, kDebugLevelSound, "%02X ", delta);
 				delta = 0;
 			}
 			// Write command
 			switch (command) {
 			case 0xF0: // sysEx
 				*filterData++ = command;
-				printf("%02X ", command);
+				debugC(2, kDebugLevelSound, "%02X ", command);
 				do {
 					curByte = *channelData++;
 					*filterData++ = curByte; // out
@@ -864,20 +865,20 @@
 			default: // MIDI command
 				if (lastCommand != command) {
 					*filterData++ = command;
-					printf("%02X ", command);
+					debugC(2, kDebugLevelSound, "%02X ", command);
 					lastCommand = command;
 				}
 				if (midiParamCount > 0) {
 					if (curByte & 0x80) {
-						printf("%02X ", *channelData);
+						debugC(2, kDebugLevelSound, "%02X ", *channelData);
 						*filterData++ = *channelData++;
 					} else {
-						printf("%02X ", curByte);
+						debugC(2, kDebugLevelSound, "%02X ", curByte);
 						*filterData++ = curByte;
 					}
 				}
 				if (midiParamCount > 1) {
-					printf("%02X ", *channelData);
+					debugC(2, kDebugLevelSound, "%02X ", *channelData);
 					*filterData++ = *channelData++;
 				}
 			}

Modified: scummvm/trunk/engines/sci/sfx/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2009-12-25 16:29:16 UTC (rev 46559)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2009-12-25 18:15:16 UTC (rev 46560)
@@ -101,14 +101,14 @@
 		case SI_RELATIVE_CUE:
 			debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received relative cue %d\n",
 			          PRINT_REG(obj), cue);
-			printf("rel-signal %04X\n", cue + 0x7f);
+			debugC(2, kDebugLevelSound, "rel-signal %04X\n", cue + 0x7f);
 			PUT_SEL32V(segMan, obj, signal, cue + 0x7f);
 			break;
 
 		case SI_ABSOLUTE_CUE:
 			debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received absolute cue %d\n",
 			          PRINT_REG(obj), cue);
-			printf("abs-signal %04X\n", cue);
+			debugC(2, kDebugLevelSound, "abs-signal %04X\n", cue);
 			PUT_SEL32V(segMan, obj, signal, cue);
 			break;
 
@@ -145,6 +145,7 @@
 
 	switch (_soundVersion) {
 	case SCI_VERSION_0_EARLY:
+	case SCI_VERSION_0_LATE:
 		SOUNDCOMMAND(cmdInitHandle);
 		SOUNDCOMMAND(cmdPlayHandle);
 		SOUNDCOMMAND(cmdDummy);
@@ -415,15 +416,10 @@
 	_music->_playList[slot]->loop = GET_SEL32V(_segMan, obj, loop) == 0xFFFF ? 1 : 0;
 	_music->_playList[slot]->prio = GET_SEL32V(_segMan, obj, priority);
 	// vol selector doesnt get used before sci1late
-	switch (_soundVersion) {
-	case SCI_VERSION_0_EARLY:
-	case SCI_VERSION_1_EARLY:
+	if (_soundVersion < SCI_VERSION_1_LATE)
 		_music->_playList[slot]->volume = 100;
-		break;
-	case SCI_VERSION_1_LATE:
+	else
 		_music->_playList[slot]->volume = GET_SEL32V(_segMan, obj, vol);
-		break;
-	}
 	_music->soundPlay(_music->_playList[slot]);
 
 #endif
@@ -688,7 +684,7 @@
 	case SI_ABSOLUTE_CUE:
 		debugC(2, kDebugLevelSound, "---    [CUE] %04x:%04x Absolute Cue: %d\n",
 		          PRINT_REG(obj), signal);
-		printf("abs-signal %04X\n", signal);
+		debugC(2, kDebugLevelSound, "abs-signal %04X\n", signal);
 		PUT_SEL32V(_segMan, obj, signal, signal);
 		break;
 
@@ -700,7 +696,7 @@
 		 * below, with proper storage of dataInc and
 		 * signal in the iterator code. */
 		PUT_SEL32V(_segMan, obj, dataInc, signal);
-		printf("rel-signal %04X\n", signal);
+		debugC(2, kDebugLevelSound, "rel-signal %04X\n", signal);
 		if (_soundVersion == SCI_VERSION_1_EARLY)
 			PUT_SEL32V(_segMan, obj, signal, signal);
 		else


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