[Scummvm-cvs-logs] SF.net SVN: scummvm: [25923] scummvm/trunk/sound

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Mar 2 15:49:08 CET 2007


Revision: 25923
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25923&view=rev
Author:   fingolfin
Date:     2007-03-02 06:49:07 -0800 (Fri, 02 Mar 2007)

Log Message:
-----------
Added reverseStereo parameter to Mixer::playInputStream; changed Mixer::playRaw to use Mixer::playInputStream

Modified Paths:
--------------
    scummvm/trunk/sound/mixer.cpp
    scummvm/trunk/sound/mixer.h

Modified: scummvm/trunk/sound/mixer.cpp
===================================================================
--- scummvm/trunk/sound/mixer.cpp	2007-03-02 12:57:38 UTC (rev 25922)
+++ scummvm/trunk/sound/mixer.cpp	2007-03-02 14:49:07 UTC (rev 25923)
@@ -155,18 +155,7 @@
 			uint32 size, uint rate, byte flags,
 			int id, byte volume, int8 balance,
 			uint32 loopStart, uint32 loopEnd) {
-	Common::StackLock lock(_mutex);
 
-	// Prevent duplicate sounds
-	if (id != -1) {
-		for (int i = 0; i != NUM_CHANNELS; i++)
-			if (_channels[i] != 0 && _channels[i]->getId() == id) {
-				if ((flags & Mixer::FLAG_AUTOFREE) != 0)
-					free(sound);
-				return;
-			}
-	}
-
 	// Create the input stream
 	AudioStream *input;
 	if (flags & Mixer::FLAG_LOOP) {
@@ -179,12 +168,9 @@
 	} else {
 		input = makeLinearInputStream(rate, flags, (byte *)sound, size, 0, 0);
 	}
-
-	// Create the channel
-	Channel *chan = new Channel(this, type, input, true, (flags & Mixer::FLAG_REVERSE_STEREO) != 0, id);
-	chan->setVolume(volume);
-	chan->setBalance(balance);
-	insertChannel(handle, chan);
+	
+	// Play it
+	playInputStream(type, handle, input, id, volume, balance, true, false, (flags & Mixer::FLAG_REVERSE_STEREO));
 }
 
 void Mixer::playInputStream(
@@ -193,7 +179,8 @@
 			AudioStream *input,
 			int id, byte volume, int8 balance,
 			bool autofreeStream,
-			bool permanent) {
+			bool permanent,
+			bool reverseStereo) {
 	Common::StackLock lock(_mutex);
 
 	if (input == 0) {
@@ -212,7 +199,7 @@
 	}
 
 	// Create the channel
-	Channel *chan = new Channel(this, type, input, autofreeStream, false, id, permanent);
+	Channel *chan = new Channel(this, type, input, autofreeStream, reverseStereo, id, permanent);
 	chan->setVolume(volume);
 	chan->setBalance(balance);
 	insertChannel(handle, chan);

Modified: scummvm/trunk/sound/mixer.h
===================================================================
--- scummvm/trunk/sound/mixer.h	2007-03-02 12:57:38 UTC (rev 25922)
+++ scummvm/trunk/sound/mixer.h	2007-03-02 14:49:07 UTC (rev 25923)
@@ -158,13 +158,16 @@
 	 *                          freed after playback finished
 	 * @param permanent	a flag indicating whether a plain stopAll call should
 	 *                  not stop this particular stream
+	 * @param reverseStereo	a flag indicating whether left and right channels shall be swapped
 	 */
 	void playInputStream(
 		SoundType type,
 		SoundHandle *handle,
 		AudioStream *input,
 		int id = -1, byte volume = 255, int8 balance = 0,
-		bool autofreeStream = true, bool permanent = false);
+		bool autofreeStream = true,
+		bool permanent = false,
+		bool reverseStereo = false);
 
 
 


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