[Scummvm-cvs-logs] SF.net SVN: scummvm: [28598] scummvm/trunk/engines/agi

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Mon Aug 13 23:15:27 CEST 2007


Revision: 28598
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28598&view=rev
Author:   buddha_
Date:     2007-08-13 14:15:27 -0700 (Mon, 13 Aug 2007)

Log Message:
-----------
Added a couple of simple AgiSound stop, play, isPlaying-functions.

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

Modified: scummvm/trunk/engines/agi/sound.cpp
===================================================================
--- scummvm/trunk/engines/agi/sound.cpp	2007-08-13 16:05:46 UTC (rev 28597)
+++ scummvm/trunk/engines/agi/sound.cpp	2007-08-13 21:15:27 UTC (rev 28598)
@@ -389,8 +389,8 @@
 
 void SoundMgr::unloadSound(int resnum) {
 	if (_vm->_game.dirSound[resnum].flags & RES_LOADED) {
-		if (_vm->_game.sounds[resnum].flags & SOUND_PLAYING) {
-			/* FIXME: Stop playing */
+		if (_vm->_game.sounds[resnum].isPlaying()) {
+			_vm->_game.sounds[resnum].stop();
 		}	
 
 		/* Release RAW data for sound */
@@ -431,7 +431,7 @@
 	struct SoundIIgsSample *smp;
 #endif
 
-	if (_vm->_game.sounds[resnum].flags & SOUND_PLAYING)
+	if (_vm->_game.sounds[resnum].isPlaying())
 		return;
 
 	stopSound();
@@ -444,7 +444,7 @@
 	if (type != AGI_SOUND_SAMPLE && type != AGI_SOUND_MIDI && type != AGI_SOUND_4CHN)
 		return;
 
-	_vm->_game.sounds[resnum].flags |= SOUND_PLAYING;
+	_vm->_game.sounds[resnum].play();
 	_vm->_game.sounds[resnum].type = type;
 	playingSound = resnum;
 	song = (uint8 *)_vm->_game.sounds[resnum].rdata;
@@ -516,7 +516,7 @@
 		stopNote(i);
 
 	if (playingSound != -1) {
-		_vm->_game.sounds[playingSound].flags &= ~SOUND_PLAYING;
+		_vm->_game.sounds[playingSound].stop();
 		playingSound = -1;
 	}
 }
@@ -734,7 +734,7 @@
 			_vm->setflag(endflag, true);
 
 		if (playingSound != -1)
-			_vm->_game.sounds[playingSound].flags &= ~SOUND_PLAYING;
+			_vm->_game.sounds[playingSound].stop();
 		playingSound = -1;
 		endflag = -1;
 	}

Modified: scummvm/trunk/engines/agi/sound.h
===================================================================
--- scummvm/trunk/engines/agi/sound.h	2007-08-13 16:05:46 UTC (rev 28597)
+++ scummvm/trunk/engines/agi/sound.h	2007-08-13 21:15:27 UTC (rev 28598)
@@ -39,7 +39,6 @@
 #define SOUND_EMU_MAC	3
 #define SOUND_EMU_AMIGA	4
 
-#define SOUND_PLAYING   0x01
 #define WAVEFORM_SIZE   64
 #define ENV_ATTACK	10000		/**< envelope attack rate */
 #define ENV_DECAY       1000		/**< envelope decay rate */
@@ -53,8 +52,22 @@
 struct AgiSound {
 	uint32 flen;		/**< size of raw data */
 	uint8 *rdata;		/**< raw sound data */
-	uint8 flags;		/**< sound flags */
 	uint16 type;		/**< sound resource type */
+
+	void play() {
+		_isPlaying = true;
+	}
+	
+	void stop() {
+		_isPlaying = false;
+	}
+	
+	bool isPlaying() {
+		return _isPlaying;
+	}
+
+private:
+	bool _isPlaying; ///< Is the sound playing?
 };
 
 #include "common/pack-start.h"


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