[Scummvm-cvs-logs] SF.net SVN: scummvm: [30257] scummvm/trunk/engines/scumm/imuse_digi

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jan 5 21:49:19 CET 2008


Revision: 30257
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30257&view=rev
Author:   fingolfin
Date:     2008-01-05 12:49:18 -0800 (Sat, 05 Jan 2008)

Log Message:
-----------
Use souStreamUsed to distinguish between 'stream' and 'streamSou' usage

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/imuse_digi/dimuse.cpp
    scummvm/trunk/engines/scumm/imuse_digi/dimuse_script.cpp
    scummvm/trunk/engines/scumm/imuse_digi/dimuse_track.cpp

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse.cpp	2008-01-05 20:43:26 UTC (rev 30256)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse.cpp	2008-01-05 20:49:18 UTC (rev 30257)
@@ -277,7 +277,8 @@
 			if (track->volGroupId == 3)
 				type = Audio::Mixer::kMusicSoundType;
 
-			if (track->stream) {
+			if (!track->souStreamUsed) {
+				assert(track->stream);
 				byte *tmpSndBufferPtr = NULL;
 				int32 curFeedSize = 0;
 
@@ -357,7 +358,8 @@
 					feedSize -= curFeedSize;
 					assert(feedSize >= 0);
 				} while (feedSize != 0);
-			} else if (track->streamSou) {
+			} else {
+				assert(track->streamSou);
 				if (_mixer->isReady()) {
 					// FIXME: Can't we replace track->mixerStreamRunning by
 					// _mixer->isSoundHandleActive(track->mixChanHandle) ?

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_script.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_script.cpp	2008-01-05 20:43:26 UTC (rev 30256)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_script.cpp	2008-01-05 20:49:18 UTC (rev 30257)
@@ -165,7 +165,8 @@
 
 void IMuseDigital::flushTrack(Track *track) {
 	track->toBeRemoved = true;
-	if (track->stream) {
+	if (!track->souStreamUsed) {
+		assert(track->stream);
 		// Finalize the appendable stream
 		track->stream->finish();
 		// There might still be some data left in the buffers of the
@@ -179,7 +180,8 @@
 			track->soundDesc = NULL;
 			track->used = false;
 		}
-	} else if (track->streamSou) {
+	} else {
+		assert(track->streamSou);
 		_mixer->stopHandle(track->mixChanHandle);
 		delete track->streamSou;
 		track->streamSou = NULL;
@@ -397,13 +399,15 @@
 			// Stop the sound output, *now*. No need to use toBeRemoved etc.
 			// as we are protected by a mutex, and this method is never called
 			// from IMuseDigital::callback either.
-			if (track->stream) {
+			if (!track->souStreamUsed) {
+				assert(track->stream);
 				_mixer->stopHandle(track->mixChanHandle);
 				delete track->stream;
 				track->stream = NULL;
 				_sound->closeSound(track->soundDesc);
 				track->soundDesc = NULL;
 			} else if (track->streamSou) {
+				assert(track->streamSou);
 				_mixer->stopHandle(track->mixChanHandle);
 				delete track->streamSou;
 				track->streamSou = NULL;

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_track.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_track.cpp	2008-01-05 20:43:26 UTC (rev 30256)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_track.cpp	2008-01-05 20:49:18 UTC (rev 30257)
@@ -114,13 +114,16 @@
 
 	int bits = 0, freq = 0, channels = 0;
 
-	if (input) {
+	track->souStreamUsed = (input != 0);
+
+	if (track->souStreamUsed) {
 		track->feedSize = 0;
-		track->souStreamUsed = true;
 		track->soundName[0] = 0;
 		track->soundDesc = NULL;
+		track->streamSou = input;
+		track->stream = NULL;
+		track->mixerStreamRunning = false;
 	} else {
-		track->souStreamUsed = false;
 		strcpy(track->soundName, soundName);
 		track->soundDesc = _sound->openSound(soundId, soundName, soundType, volGroupId, -1);
 
@@ -162,13 +165,7 @@
 		if (track->sndDataExtComp)
 			track->mixerFlags |= kFlagLittleEndian;
 #endif
-	}
 
-	if (input) {
-		track->streamSou = input;
-		track->stream = NULL;
-		track->mixerStreamRunning = false;
-	} else {
 		const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0;
 		const int vol = track->vol / 1000;
 		Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType;


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