[Scummvm-cvs-logs] CVS: scummvm insane.cpp,1.34,1.35

Lionel Ulmer bbrox at users.sourceforge.net
Sun Jun 2 13:31:03 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv15720

Modified Files:
	insane.cpp 
Log Message:
Fix the streaming used in the movies in TheDig (warning, did not test
Full Throttle).

This should be less buggy (ie crash less often, maybe not better
quality) than the previous code.

NOTE: the '1024 *' is here for testing purposes and will need to be
      severely reduced :-/



Index: insane.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/insane.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- insane.cpp	24 May 2002 12:38:45 -0000	1.34
+++ insane.cpp	2 Jun 2002 20:30:21 -0000	1.35
@@ -133,6 +133,7 @@
 
 void SmushPlayer::parseIACT() {
 	unsigned int pos, bpos, tag, sublen, subpos, trk, idx, flags;
+	bool new_mixer = false;
 	byte * buf;
 
 	flags = SoundMixer::FLAG_AUTOFREE;
@@ -156,13 +157,14 @@
 			    g_scumm->_mixer->_channels[idx] == NULL) {
 				_imusTrk[idx] = trk;
 				_imusSize[idx] = 0;
+				new_mixer = true;
 				break;
 			}
 		}
 	}
 
 	if (idx == 8) {
-		warning("iMUS table full\n");
+		warning("iMUS table full ");
 		return;
 	}
 
@@ -256,8 +258,11 @@
 			debug(3, "trk %d: iMUSE play part, len 0x%x rate %d remain 0x%x",
 			      trk, bpos, _imusRate[idx], _imusSubSize[idx]);
 
-			g_scumm->_mixer->append(idx, buf, bpos,
-						_imusRate[idx], flags);
+			if (new_mixer) {
+				g_scumm->_mixer->play_stream(NULL, idx, buf, bpos, _imusRate[idx], flags);
+			} else {
+				g_scumm->_mixer->append(idx, buf, bpos, _imusRate[idx], flags);
+			}
 
 			/* FIXME: append with re-used idx may cause problems
 			   with signed/unsigned issues */
@@ -785,6 +790,7 @@
 void SmushPlayer::parsePSAD()	// FIXME: Needs to append to
 {								//		  a sound buffer
 	unsigned int pos, sublen, tag, idx, trk;
+	bool new_mixer = false;
 	byte * buf;	
 	pos = 0;
 	
@@ -802,9 +808,10 @@
 		for (idx = 0; idx < 8; idx++) {
 			if (_psadTrk[idx] == 0 &&
 			    g_scumm->_mixer->_channels[idx] == NULL) {
-					_psadTrk[idx] = trk;
-					_saudSize[idx] = 0;
-					break;
+				_psadTrk[idx] = trk;
+				_saudSize[idx] = 0;
+				new_mixer = true;
+				break;
 			}
 		}
 	}
@@ -852,9 +859,13 @@
 
 			debug(3, "trk %d: SDAT part len 0x%x rate %d",
 			      trk, sublen, _strkRate[idx]);
-
-			g_scumm->_mixer->append(idx, buf, sublen, 
-				_strkRate[idx], SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+			
+			if (new_mixer) {
+				g_scumm->_mixer->play_stream(NULL, idx, buf, sublen, _strkRate[idx], SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+			} else {
+				g_scumm->_mixer->append(idx, buf, sublen, 
+				                        _strkRate[idx], SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+			}
 			break;
 		case 'SMRK' :
 			_psadTrk[idx] = 0;





More information about the Scummvm-git-logs mailing list