[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.201,1.202

Jonathan Gray khalek at users.sourceforge.net
Thu Aug 14 18:23:05 CEST 2003


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

Modified Files:
	sound.cpp 
Log Message:
patch #788078 Improved Amiga V3 SFX support by Quietust

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.201
retrieving revision 1.202
diff -u -d -r1.201 -r1.202
--- sound.cpp	14 Aug 2003 09:27:33 -0000	1.201
+++ sound.cpp	15 Aug 2003 01:21:59 -0000	1.202
@@ -433,23 +433,22 @@
 		return;
 	}
 	
-	if ((_scumm->_features & GF_AMIGA) && (_scumm->_version == 3))
-	{
-		// experimental support for Indy3 Amiga sound effects
-		if (READ_BE_UINT16(ptr + 26) == 0x00FF)		// looped sound
-			// TODO: support looping sounds
-			// ptr + 14 seems to be looping duration
-			flags = 0;
-		else if (READ_BE_UINT16(ptr + 26) == 0x0001)	// nonlooped sound
-			flags = 0;	// 
-		else if (READ_BE_UINT16(ptr + 26) == 0x0101)	// background music
-			// TODO: support music
+	if ((_scumm->_features & GF_AMIGA) && (_scumm->_version == 3)) {
+		if (READ_BE_UINT16(ptr + 26) & 0x0100) {
+			// TODO: support Amiga music
 			return;
+		}
 		size = READ_BE_UINT16(ptr + 12);
 		rate = 11000;
 		sound = (char *)malloc(size);
-		memcpy(sound,ptr + 28,size);
-		_scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID);
+		memcpy(sound,ptr + READ_BE_UINT16(ptr + 8),size);
+		if (READ_BE_UINT16(ptr + 16) || READ_BE_UINT16(ptr + 6)) {
+			// the first check is for pitch-bending looped sounds (i.e. "pouring liquid", "biplane dive", etc.)
+			// the second check is for simple looped sounds
+			_scumm->_mixer->playRaw(NULL,sound,size,rate,SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LOOP,soundID,READ_BE_UINT16(ptr + 10) - READ_BE_UINT16(ptr + 8),READ_BE_UINT16(ptr + 14));
+		} else {
+			_scumm->_mixer->playRaw(NULL,sound,size,rate,SoundMixer::FLAG_AUTOFREE,soundID);
+		}
 		return;
 	}
 
@@ -746,7 +745,10 @@
 		_scumm->_imuse->stopSound(a);
 	} else if (_scumm->_playerV2) {
 		_scumm->_playerV2->stopSound (a);
-	} 
+	} else if ((_scumm->_features & GF_AMIGA) && (_scumm->_version == 3)) {
+		// this handles stopping looped sounds for now
+		_scumm->_mixer->stopID(a);
+	}
 
 	for (i = 0; i < 10; i++)
 		if (_soundQue2[i] == a)





More information about the Scummvm-git-logs mailing list