[Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.75,1.76

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat Apr 24 13:42:02 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13951

Modified Files:
	dimuse.cpp 
Log Message:
few corrections, more debug

Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- dimuse.cpp	24 Apr 2004 20:02:17 -0000	1.75
+++ dimuse.cpp	24 Apr 2004 20:41:02 -0000	1.76
@@ -87,8 +87,18 @@
 
 int IMuseDigital::pullProc(CustomProcInputStream *stream, byte *mixerBuffer, int pullSize) {
 	Common::StackLock lock(_mutex, "IMuseDigital::pullProc()");
+	debug(5, "pullProc() pullSize:%d", pullSize);
 	for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
 		if ((_track[l]->used) && (_track[l]->stream == stream)) {
+			if (_track[l]->toBeRemoved) {
+				debug(5, "IMuseDigital::pullProc() stopped sound: %d", _track[l]->soundId);
+				_track[l]->stream->finish();
+				_track[l]->stream = NULL;
+				_sound->closeSound(_track[l]->soundHandle);
+				_track[l]->soundHandle = NULL;
+				_track[l]->used = false;
+				return 0;
+			}
 			_vm->_mixer->setChannelVolume(_track[l]->handle, _track[l]->mixerVol);
 			_vm->_mixer->setChannelBalance(_track[l]->handle, _track[l]->mixerPan);
 			int32 mixer_size = pullSize;
@@ -97,11 +107,19 @@
 
 			if (_track[l]->curRegion == -1) {
 				switchToNextRegion(l);
-				if (_track[l]->toBeRemoved)
-					continue;
+				if (_track[l]->toBeRemoved) {
+					return 0;
+				}
 			}
 
 			int bits = _sound->getBits(_track[l]->soundHandle);
+			int channels = _sound->getChannels(_track[l]->soundHandle);
+
+			if ((bits == 16) && (channels == 2))
+				assert((pullSize & 3) == 0);
+			else if ((bits == 16) || (channels == 2))
+				assert((pullSize & 1) == 0);
+
 			do {
 				if (bits == 12) {
 					byte *ptr = NULL;
@@ -175,16 +193,6 @@
 					_track[l]->used = false;
 					continue;
 				}
-			} else if (_track[l]->stream) {
-				if (_track[l]->toBeRemoved) {
-					debug(5, "IMuseDigital::callback() B: stopped sound: %d", _track[l]->soundId);
-					_track[l]->stream->finish();
-					_track[l]->stream = NULL;
-					_sound->closeSound(_track[l]->soundHandle);
-					_track[l]->soundHandle = NULL;
-					_track[l]->used = false;
-					continue;
-				}
 			}
 
 			if (_track[l]->volFadeUsed) {
@@ -390,8 +398,11 @@
 #endif
 
 void IMuseDigital::switchToNextRegion(int track) {
+	debug(5, "switchToNextRegion(track:%d)", track);
+
 	if (track >= MAX_DIGITAL_TRACKS) {
 		_track[track]->toBeRemoved = true;
+		debug(5, "exit (fadetrack can't go next region) switchToNextRegion(track:%d)", track);
 		return;
 	}
 
@@ -399,6 +410,7 @@
 
 	if (++_track[track]->curRegion == num_regions) {
 		_track[track]->toBeRemoved = true;
+		debug(5, "exit (end of regions) switchToNextRegion(track:%d)", track);
 		return;
 	}
 





More information about the Scummvm-git-logs mailing list