[Scummvm-cvs-logs] SF.net SVN: scummvm:[46569] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Dec 26 01:50:09 CET 2009


Revision: 46569
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46569&view=rev
Author:   thebluegr
Date:     2009-12-26 00:50:09 +0000 (Sat, 26 Dec 2009)

Log Message:
-----------
Some more work on the new music code

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/game.cpp
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/vm.h
    scummvm/trunk/engines/sci/sci.cpp
    scummvm/trunk/engines/sci/sfx/music.cpp

Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp	2009-12-26 00:22:21 UTC (rev 46568)
+++ scummvm/trunk/engines/sci/engine/game.cpp	2009-12-26 00:50:09 UTC (rev 46569)
@@ -33,12 +33,13 @@
 #include "sci/engine/state.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/kernel_types.h"
+#include "sci/engine/message.h"
 #include "sci/gui/gui.h"
-#include "sci/engine/message.h"
 #ifdef INCLUDE_OLDGFX
 #include "sci/gfx/gfx_state_internal.h"	// required for GfxPort, GfxVisual
 #include "sci/gfx/menubar.h"
 #endif
+#include "sci/sfx/music.h"
 
 namespace Sci {
 
@@ -291,17 +292,17 @@
 }
 #endif
 
+#ifdef USE_OLD_MUSIC_FUNCTIONS
 int game_init_sound(EngineState *s, int sound_flags, SciVersion soundVersion) {
-#ifdef USE_OLD_MUSIC_FUNCTIONS
 	if (getSciVersion() > SCI_VERSION_0_LATE)
 		sound_flags |= SFX_STATE_FLAG_MULTIPLAY;
 
 	s->sfx_init_flags = sound_flags;
 	s->_sound.sfx_init(s->resMan, sound_flags, soundVersion);
-#endif
 
 	return 0;
 }
+#endif
 
 // Architectural stuff: Init/Unintialize engine
 int script_init_engine(EngineState *s) {
@@ -433,13 +434,16 @@
 int game_exit(EngineState *s) {
 	s->_executionStack.clear();
 
+	if (!s->successor) {
 #ifdef USE_OLD_MUSIC_FUNCTIONS
-	if (!s->successor) {
 		s->_sound.sfx_exit();
 		// Reinit because some other code depends on having a valid state
 		game_init_sound(s, SFX_STATE_FLAG_NOSOUND, s->detectDoSoundType());
+#else
+		s->_audio->stopAllAudio();
+		s->_soundCmd->_music->stopAll();
+#endif
 	}
-#endif
 
 	// Note: It's a bad idea to delete the segment manager here
 	// when loading a game.

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-12-26 00:22:21 UTC (rev 46568)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-12-26 00:50:09 UTC (rev 46569)
@@ -148,6 +148,7 @@
 	// pMidiParser and pStreamAud will be initialized when the
 	// sound list is reconstructed in gamestate_restore()
 	if (s.isLoading()) {
+		song->soundRes = 0;
 		song->pMidiParser = 0;
 		song->pStreamAud = 0;
 	}

Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h	2009-12-26 00:22:21 UTC (rev 46568)
+++ scummvm/trunk/engines/sci/engine/vm.h	2009-12-26 00:50:09 UTC (rev 46569)
@@ -486,6 +486,7 @@
 int game_init_graphics(EngineState *s);
 #endif
 
+#ifdef USE_OLD_MUSIC_FUNCTIONS
 /**
  * Initializes the sound part of an SCI game
  * This function may only be called if game_init() did not initialize
@@ -496,6 +497,7 @@
  * @return					0 on success, 1 if an error occured
  */
 int game_init_sound(EngineState *s, int sound_flags, SciVersion soundVersion);
+#endif
 
 /**
  * Runs an SCI game

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-12-26 00:22:21 UTC (rev 46568)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-12-26 00:50:09 UTC (rev 46569)
@@ -200,10 +200,12 @@
 	}
 #endif
 
+#ifdef USE_OLD_MUSIC_FUNCTIONS
 	if (game_init_sound(_gamestate, 0, soundVersion)) {
 		warning("Game initialization failed: Error in sound subsystem. Aborting...");
 		return Common::kUnknownError;
 	}
+#endif
 
 	_gamestate->_gui->init(_gamestate->usesOldGfxFunctions());
 

Modified: scummvm/trunk/engines/sci/sfx/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.cpp	2009-12-26 00:22:21 UTC (rev 46568)
+++ scummvm/trunk/engines/sci/sfx/music.cpp	2009-12-26 00:50:09 UTC (rev 46569)
@@ -130,11 +130,12 @@
 void SciMusic::stopAll() {
 	_mutex.lock();
 	_pMixer->stopAll();
-	//audioStop();
-	for(uint i = 0; i < _playList.size(); i++){
+
+	for (uint i = 0; i < _playList.size(); i++){
 		soundStop(_playList[i]);
 		soundKill(_playList[i]);
 	}
+
 	_mutex.unlock();
 }
 //----------------------------------------
@@ -469,6 +470,7 @@
 	for (i = 0; i < sz; i++) {
 		if (_playList[i] == pSnd) {
 			delete _playList[i]->soundRes;
+			_playList[i]->soundRes = 0;
 			_playList.remove_at(i);
 			break;
 		}


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