[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.154,1.155

James Brown ender at users.sourceforge.net
Fri Jul 4 07:11:08 CEST 2003


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

Modified Files:
	sound.cpp 
Log Message:
Insert preliminary Zak256 sound looping support. It's not perfect, as some Zak256 sounds only loop a part of the sample - which our mixer API doesn't yet support.


Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- sound.cpp	4 Jul 2003 12:35:08 -0000	1.154
+++ sound.cpp	4 Jul 2003 14:10:44 -0000	1.155
@@ -370,6 +370,8 @@
 	#endif
 			rate = 11000;
 			int type = *(ptr + 0x0D);
+			int loop_start = READ_LE_UINT32(ptr+0x26);
+			int loop_end = READ_LE_UINT32(ptr+0x2A);
 
 			// Check if it is a CD playback resource
 			if (type == 2) {
@@ -399,8 +401,15 @@
 					sound[x] = bit;
 			}
 	
-			// FIXME: Maybe something in the header signifies looping? Need to
-			// track it down and add a mixer flag or something.
+			if (loop_end > 0) {
+				flags |= SoundMixer::FLAG_LOOP;
+
+				if ((loop_end < size) || (loop_start > 0)) {
+					// FIXME: Implement partial loops
+					warning("Partial loops not implemented. Loop at 0x%X thru 0x%X", loop_start, loop_end);
+				}
+			}
+
 			_scumm->_mixer->playRaw(NULL, sound, size, 11000, flags, soundID);
 			return;
 		}
@@ -724,13 +733,15 @@
 		stopCD();
 	}
 
-	if (_scumm->_imuseDigital) {
+	if (_scumm->_gameId == GID_ZAK256) {
+		_scumm->_mixer->stopID(a);
+	} else if (_scumm->_imuseDigital) {
 		_scumm->_imuseDigital->stopSound(a);
 	} else if (_scumm->_imuse) {
 		_scumm->_imuse->stopSound(a);
 	} else if (_scumm->_playerV2) {
 		_scumm->_playerV2->stopSound (a);
-	}
+	} 
 
 	for (i = 0; i < 10; i++)
 		if (_soundQue2[i] == a)





More information about the Scummvm-git-logs mailing list