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

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Sun Mar 5 16:35:54 CET 2006


Revision: 21094
Author:   aquadran
Date:     2006-03-05 04:15:39 -0800 (Sun, 05 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=21094&view=rev

Log Message:
-----------
that should help for bug #1352486, smush sound tracks are not stopped immediately, but outside smush when sound data are depleted in sound mixer buffer.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h
    scummvm/trunk/engines/scumm/smush/smush_mixer.cpp
    scummvm/trunk/engines/scumm/smush/smush_mixer.h
    scummvm/trunk/engines/scumm/smush/smush_player.cpp
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-03-05 10:54:41 UTC (rev 21093)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-03-05 12:15:39 UTC (rev 21094)
@@ -43,6 +43,7 @@
 #include "scumm/file.h"
 #include "scumm/imuse/imuse.h"
 #include "scumm/imuse_digi/dimuse.h"
+#include "scumm/smush/smush_mixer.h"
 #include "scumm/insane/insane.h"
 #include "scumm/intern.h"
 #include "scumm/he/intern_he.h"
@@ -502,6 +503,7 @@
 	// Init all vars
 	_imuse = NULL;
 	_imuseDigital = NULL;
+	_smixer = NULL;
 	_musicEngine = NULL;
 	_verbs = NULL;
 	_objs = NULL;
@@ -932,6 +934,10 @@
 		delete _musicEngine;
 	}
 
+#ifndef DISABLE_SCUMM_7_8
+	_smixer->stop();
+	delete _smixer;
+#endif
 	_mixer->stopAll();
 
 	delete [] _actors;
@@ -1649,6 +1655,7 @@
 	if (_game.features & GF_DIGI_IMUSE) {
 #ifndef DISABLE_SCUMM_7_8
 		_musicEngine = _imuseDigital = new IMuseDigital(this, 10);
+		_smixer = new SmushMixer(_mixer);
 #endif
 	} else if (_game.platform == Common::kPlatformC64) {
 		// TODO
@@ -2076,6 +2083,9 @@
 		if ( ((_game.id == GID_DIG) && (!(_game.features & GF_DEMO))) || (_game.id == GID_CMI) )
 			_imuseDigital->refreshScripts();
 	}
+	if (_smixer) {
+		_smixer->flush();
+	}
 #endif
 
 	camera._last = camera._cur;

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2006-03-05 10:54:41 UTC (rev 21093)
+++ scummvm/trunk/engines/scumm/scumm.h	2006-03-05 12:15:39 UTC (rev 21094)
@@ -55,6 +55,7 @@
 class IMuse;
 class IMuseDigital;
 class Insane;
+class SmushMixer;
 class MusicEngine;
 class ScummEngine;
 class ScummDebugger;
@@ -429,6 +430,7 @@
 	IMuseDigital *_imuseDigital;
 	MusicEngine *_musicEngine;
 	Sound *_sound;
+	SmushMixer *_smixer;
 
 	VerbSlot *_verbs;
 	ObjectData *_objs;

Modified: scummvm/trunk/engines/scumm/smush/smush_mixer.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_mixer.cpp	2006-03-05 10:54:41 UTC (rev 21093)
+++ scummvm/trunk/engines/scumm/smush/smush_mixer.cpp	2006-03-05 12:15:39 UTC (rev 21094)
@@ -153,11 +153,30 @@
 			_channels[i].chan = NULL;
 			if (_channels[i].stream) {
 				_channels[i].stream->finish();
-				_channels[i].stream = 0;
+				_channels[i].stream = NULL;
 			}
 		}
 	}
+
 	return true;
 }
 
+bool SmushMixer::flush() {
+	Common::StackLock lock(_mutex);
+	debugC(DEBUG_SMUSH, "SmushMixer::flush()");
+	for (int i = 0; i < NUM_CHANNELS; i++) {
+		if (_channels[i].id != -1) {
+			if (_channels[i].stream->endOfStream()) {
+				_mixer->stopHandle(_channels[i].handle);
+				delete _channels[i].chan;
+				_channels[i].id = -1;
+				_channels[i].chan = NULL;
+				_channels[i].stream = NULL;
+			}
+		}
+	}
+
+	return true;
+}
+
 } // End of namespace Scumm

Modified: scummvm/trunk/engines/scumm/smush/smush_mixer.h
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_mixer.h	2006-03-05 10:54:41 UTC (rev 21093)
+++ scummvm/trunk/engines/scumm/smush/smush_mixer.h	2006-03-05 12:15:39 UTC (rev 21094)
@@ -56,6 +56,7 @@
 	void addChannel(SmushChannel *c);
 	bool handleFrame();
 	bool stop();
+	bool flush();
 	bool update();
 };
 

Modified: scummvm/trunk/engines/scumm/smush/smush_player.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_player.cpp	2006-03-05 10:54:41 UTC (rev 21093)
+++ scummvm/trunk/engines/scumm/smush/smush_player.cpp	2006-03-05 12:15:39 UTC (rev 21094)
@@ -265,6 +265,7 @@
 	_middleAudio = false;
 	_skipPalette = false;
 	_IACTstream = NULL;
+	_smixer = _vm->_smixer;
 #ifdef _WIN32_WCE
 	_inTimer = false;
 	_inTimerCount = 0;
@@ -297,7 +298,8 @@
 	_vm->virtscr[0].pitch = _vm->virtscr[0].w;
 	_vm->gdi._numStrips = _vm->virtscr[0].w / 8;
 
-	_smixer = new SmushMixer(_vm->_mixer);
+	_vm->_smixer->stop();
+
 	Common::g_timer->installTimerProc(&timerCallback, 1000000 / _speed, this);
 
 	_initDone = true;
@@ -325,12 +327,6 @@
 	delete _strings;
 	_strings = NULL;
 
-	if (_smixer)
-		_smixer->stop();
-
-	delete _smixer;
-	_smixer = NULL;
-
 	delete _base;
 	_base = NULL;
 
@@ -343,7 +339,7 @@
 	_vm->_mixer->stopHandle(_compressedFileSoundHandle);
 
 	_vm->_mixer->stopHandle(_IACTchannel);
-	_IACTstream = 0;
+	_IACTstream = NULL;
 
 	_vm->_fullRedraw = true;
 
@@ -1371,8 +1367,10 @@
 			debugC(DEBUG_SMUSH, "Smush stats: BackendUpdateScreen( %03d )", end_time - start_time);
 
 		}
-		if (_vm->_smushVideoShouldFinish || _vm->_quit || _vm->_saveLoadFlag)
+		if (_vm->_smushVideoShouldFinish || _vm->_quit || _vm->_saveLoadFlag) {
+			_smixer->stop();
 			break;
+		}
 		_vm->_system->delayMillis(10);
 	}
 







More information about the Scummvm-git-logs mailing list