[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.113,1.114 mixer.h,1.45,1.46

Pawel Kolodziejski aquadran at users.sourceforge.net
Mon Sep 1 07:03:08 CEST 2003


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv19635

Modified Files:
	mixer.cpp mixer.h 
Log Message:
forgot this

Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- mixer.cpp	1 Sep 2003 10:12:28 -0000	1.113
+++ mixer.cpp	1 Sep 2003 14:02:45 -0000	1.114
@@ -144,13 +144,23 @@
 	_syst->delete_mutex(_mutex);
 }
 
-int SoundMixer::newStream(void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan) {
+int SoundMixer::newStream(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan) {
 	StackLock lock(_mutex);
-	return insertChannel(NULL, new ChannelStream(this, 0, sound, size, rate, flags, buffer_size, volume, pan));
+	return insertChannel(handle, new ChannelStream(this, handle, sound, size, rate, flags, buffer_size, volume, pan));
 }
 
-void SoundMixer::appendStream(int index, void *sound, uint32 size) {
+void SoundMixer::appendStream(PlayingSoundHandle handle, void *sound, uint32 size) {
 	StackLock lock(_mutex);
+	
+	if (handle == 0)
+		return;
+
+	int index = handle - 1;
+
+	if ((index < 0) || (index >= NUM_CHANNELS)) {
+		warning("soundMixer::appendStream has invalid index %d", index);
+		return;
+	}
 
 	ChannelStream *chan;
 #if !defined(_WIN32_WCE) && !defined(__PALM_OS__)
@@ -159,17 +169,25 @@
 	chan = (ChannelStream*)_channels[index];
 #endif
 	if (!chan) {
-		error("Trying to append to a nonexistant stream %d", index);
+		error("Trying to append to nonexistant streamer : %d", index);
 	} else {
 		chan->append(sound, size);
 	}
 }
 
-void SoundMixer::endStream(int index) {
+void SoundMixer::endStream(PlayingSoundHandle handle) {
 	StackLock lock(_mutex);
+	
+	// Simply ignore stop requests for handles of sounds that already terminated
+	if (handle == 0)
+		return;
 
-	if (index == 0)
+	int index = handle - 1;
+
+	if ((index < 0) || (index >= NUM_CHANNELS)) {
+		warning("soundMixer::endStream has invalid index %d", index);
 		return;
+	}
 
 	ChannelStream *chan;
 #if !defined(_WIN32_WCE) && !defined(__PALM_OS__)
@@ -355,24 +373,6 @@
 
 	if (_channels[index])
 		_channels[index]->setChannelPan(pan);
-}
-
-bool SoundMixer::isChannelActive(PlayingSoundHandle handle) {
-	StackLock lock(_mutex);
-	
-	if (handle == 0)
-		return false;
-
-	int index = handle - 1;
-	if ((index < 0) || (index >= NUM_CHANNELS)) {
-		warning("soundMixer::isChannelActive has invalid index %d", index);
-		return false;
-	}
-	
-	if (_channels[index])
-		return _channels[index] != NULL;
-	else
-		return false;
 }
 
 void SoundMixer::pause(bool paused) {

Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- mixer.h	31 Aug 2003 20:36:53 -0000	1.45
+++ mixer.h	1 Sep 2003 14:02:45 -0000	1.46
@@ -113,16 +113,14 @@
 	/** changing the channel pan for the given handle (-127 ... 0 ... 127) (left ... center ... right)*/
 	void setChannelPan(PlayingSoundHandle handle, int8 pan);
 
-	bool isChannelActive(PlayingSoundHandle handle);
-
 	/** Start a new stream. */
-	int newStream(void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan);
+	int newStream(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan);
 
 	/** Append to an existing stream. */
-	void appendStream(int index, void *sound, uint32 size);
+	void appendStream(PlayingSoundHandle handle, void *sound, uint32 size);
 
 	/** Mark a stream as finished - it will play all its remaining data, then stop. */
-	void endStream(int index);
+	void endStream(PlayingSoundHandle handle);
 
 	/** Check whether any SFX channel is active.*/
 	bool hasActiveSFXChannel();





More information about the Scummvm-git-logs mailing list