[Scummvm-cvs-logs] SF.net SVN: scummvm:[33263] scummvm/trunk/engines/tinsel

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Jul 24 12:31:37 CEST 2008


Revision: 33263
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33263&view=rev
Author:   fingolfin
Date:     2008-07-24 10:31:37 +0000 (Thu, 24 Jul 2008)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/music.cpp
    scummvm/trunk/engines/tinsel/sound.cpp
    scummvm/trunk/engines/tinsel/sound.h
    scummvm/trunk/engines/tinsel/tinsel.cpp

Modified: scummvm/trunk/engines/tinsel/music.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/music.cpp	2008-07-24 10:00:56 UTC (rev 33262)
+++ scummvm/trunk/engines/tinsel/music.cpp	2008-07-24 10:31:37 UTC (rev 33263)
@@ -58,8 +58,8 @@
 // MIDI buffer
 static SOUND_BUFFER midiBuffer = { 0, 0 };
 
-static SCNHANDLE	currentMidi;
-static bool		currentLoop;
+static SCNHANDLE	currentMidi = 0;
+static bool		currentLoop = false;
 
 const SCNHANDLE midiOffsetsGRAVersion[] = {
 		 4,	  4534,	 14298,	 18828,	 23358,	 38888,	 54418,	 57172,	 59926,	 62450,
@@ -149,7 +149,6 @@
  * @param dwFileOffset		File offset of MIDI sequence data
  * @param bLoop				Whether to loop the sequence
  */
-
 bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
 	currentMidi = dwFileOffset;
 	currentLoop = bLoop;
@@ -234,7 +233,6 @@
 /**
  * Returns TRUE if a Midi tune is currently playing.
  */
-
 bool MidiPlaying(void) {
 	if (AudioCD.isPlaying()) return true;
 	return _vm->_music->isPlaying();
@@ -243,7 +241,6 @@
 /**
  * Stops any currently playing midi.
  */
-
 bool StopMidi(void) {
 	currentMidi = 0;
 	currentLoop = false;

Modified: scummvm/trunk/engines/tinsel/sound.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/sound.cpp	2008-07-24 10:00:56 UTC (rev 33262)
+++ scummvm/trunk/engines/tinsel/sound.cpp	2008-07-24 10:31:37 UTC (rev 33263)
@@ -43,9 +43,6 @@
 
 //--------------------------- General data ----------------------------------
 
-// get set when music/sample driver is installed
-static bool bInstalled = false;
-
 SoundManager::SoundManager(TinselEngine *vm) :
 	//_vm(vm),	// TODO: Enable this once global _vm var is gone
 	_sampleIndex(0), _sampleIndexLen(0) {
@@ -211,47 +208,4 @@
 */
 }
 
-/**
- * Initialises the sound driver.
- */
-
-bool SoundInit(void) {
-	if (!bInstalled) {
-//		if (mDriver != NULL) {
-		if (true) {		// TODO: Check that a MIDI music output device is available
-			// open MIDI files
-			OpenMidiFiles();
-		}
-
-		if (_vm->_mixer->isReady()) {
-			// open sample files
-			_vm->_sound->openSampleFiles();
-		}
-		bInstalled = true;
-		return true;
-	} else {
-		// already installed
-		return false;
-	}
-}
-
-
-/**
- * De-initialises the sound driver.
- */
-
-bool SoundDeinit(void) {
-	if (bInstalled) {
-		bInstalled = false;
-		AudioCD.stop();
-		StopMidi();
-		_vm->_sound->stopAllSamples();
-		DeleteMidiBuffer();
-		return true;
-	} else {
-		// not installed
-		return false;
-	}
-}
-
 } // end of namespace Tinsel

Modified: scummvm/trunk/engines/tinsel/sound.h
===================================================================
--- scummvm/trunk/engines/tinsel/sound.h	2008-07-24 10:00:56 UTC (rev 33262)
+++ scummvm/trunk/engines/tinsel/sound.h	2008-07-24 10:31:37 UTC (rev 33263)
@@ -75,9 +75,6 @@
 	void openSampleFiles(void);
 };
 
-bool SoundInit(void);		// Initialises the sound driver
-bool SoundDeinit(void);		// De-initialises the sound driver
-
 } // end of namespace Tinsel
 
 #endif	// TINSEL_SOUND_H

Modified: scummvm/trunk/engines/tinsel/tinsel.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.cpp	2008-07-24 10:00:56 UTC (rev 33262)
+++ scummvm/trunk/engines/tinsel/tinsel.cpp	2008-07-24 10:31:37 UTC (rev 33263)
@@ -914,9 +914,14 @@
 	pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0);	
 	pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0);	
 
-	// install sound driver
-	SoundInit();
+	// open MIDI files
+	OpenMidiFiles();
 
+	// open sample files (only if mixer is ready)
+	if (_mixer->isReady()) {
+		_sound->openSampleFiles();
+	}
+
 	// Set midi volume
 	SetMidiVolume(volMidi);
 }
@@ -927,7 +932,9 @@
 
 void TinselEngine::ChopDrivers(void) {
 	// remove sound driver
-	SoundDeinit();
+	StopMidi();
+	_sound->stopAllSamples();
+	DeleteMidiBuffer();
 
 	// remove event drivers
 	_scheduler->killProcess(pMouseProcess);


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