[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.24,1.25 mixer.h,1.13,1.14

Oliver Kiehl olki at users.sourceforge.net
Sun Nov 10 08:24:02 CET 2002


Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv24443

Modified Files:
	mixer.cpp mixer.h 
Log Message:
added looping support to playRaw


Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- mixer.cpp	28 Oct 2002 12:56:42 -0000	1.24
+++ mixer.cpp	10 Nov 2002 16:23:01 -0000	1.25
@@ -293,6 +293,11 @@
 		_size = _size >> 1;
 	if (_flags & FLAG_STEREO)
 		_size = _size >> 1;
+
+	if (flags & FLAG_LOOP) {
+		_loop_ptr = sound;
+		_loop_size = size;
+	}
 }
 
 
@@ -623,8 +628,16 @@
 		free(s_org);
 	}
 
-	if (_size < 1)
-		realDestroy();
+	if (_size < 1) {
+		if (_flags & FLAG_LOOP) {
+			_ptr = _loop_ptr;
+			_size = _loop_size;
+			_pos = 0;
+			_fpPos = 0;
+		} else {
+			realDestroy();
+		}
+	}
 
 }
 

Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- mixer.h	28 Oct 2002 12:56:42 -0000	1.13
+++ mixer.h	10 Nov 2002 16:23:02 -0000	1.14
@@ -64,6 +64,8 @@
 		uint32 _fpPos;
 		uint32 _realSize, _rate;
 		byte _flags;
+		void *_loop_ptr;
+		uint32 _loop_size;
 
 	public:
 		ChannelRaw(SoundMixer * mixer, void * sound, uint32 size, uint rate, byte flags, int id);
@@ -200,6 +202,7 @@
 		FLAG_AUTOFREE = 8,					/* sound buffer is freed automagically at the end of playing */
 		FLAG_FILE = 16,							/* sound is a FILE * that's read from */
 		FLAG_REVERSE_STEREO = 32,		/* sound should be reverse stereo */
+		FLAG_LOOP = 64,				/* loop the audio */
 	};
 	int playRaw(PlayingSoundHandle * handle, void * sound, uint32 size, uint rate, byte flags);
 	int playRaw(PlayingSoundHandle * handle, void * sound, uint32 size, uint rate, byte flags, int id);





More information about the Scummvm-git-logs mailing list