[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.102,1.103

Max Horn fingolfin at users.sourceforge.net
Mon Aug 4 18:49:08 CEST 2003


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

Modified Files:
	mixer.cpp 
Log Message:
some more cleanup

Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- mixer.cpp	5 Aug 2003 01:41:29 -0000	1.102
+++ mixer.cpp	5 Aug 2003 01:47:47 -0000	1.103
@@ -91,8 +91,8 @@
 
 class ChannelRaw : public Channel {
 	byte *_ptr;
-	byte _flags;
 #ifndef NEW_MIXER_CODE
+	byte _flags;
 	uint32 _pos;
 	uint32 _size;
 	uint32 _fpSpeed;
@@ -681,7 +681,6 @@
 	: Channel(mixer, handle) {
 	_id = id;
 	_ptr = (byte *)sound;
-	_flags = flags;
 	
 #ifdef NEW_MIXER_CODE
 	// Create the input stream
@@ -695,15 +694,14 @@
 	} else {
 		_input = makeLinearInputStream(flags, _ptr, size, 0, 0);
 	}
-	// TODO: add support for SoundMixer::FLAG_REVERSE_STEREO
 
 	// Get a rate converter instance
 	_converter = makeRateConverter(rate, mixer->getOutputRate(), _input->isStereo(), (flags & SoundMixer::FLAG_REVERSE_STEREO) != 0);
-//	printf("inrate %d, outrate %d, %d bits, %s\n",
-//			rate, mixer->getOutputRate(),
-//			((flags & SoundMixer::FLAG_16BITS) ? 16 : 8),
-//			((flags & SoundMixer::FLAG_UNSIGNED) ? "unsigned" : "signed"));
+
+	if (!(flags & SoundMixer::FLAG_AUTOFREE))
+		_ptr = 0;
 #else
+	_flags = flags;
 	_pos = 0;
 	_fpPos = 0;
 	_fpSpeed = (1 << 16) * rate / mixer->getOutputRate();
@@ -728,8 +726,12 @@
 }
 
 ChannelRaw::~ChannelRaw() {
+#ifdef NEW_MIXER_CODE
+	free(_ptr);
+#else
 	if (_flags & SoundMixer::FLAG_AUTOFREE)
 		free(_ptr);
+#endif
 }
 
 #ifndef NEW_MIXER_CODE
@@ -771,14 +773,12 @@
 	
 	// Create the input stream
 	_input = makeWrappedInputStream(flags, buffer_size);
+	
+	// Append the initial data
 	((WrappedAudioInputStream *)_input)->append((const byte *)sound, size);
-	// TODO: add support for SoundMixer::FLAG_REVERSE_STEREO
 
 	// Get a rate converter instance
 	_converter = makeRateConverter(rate, mixer->getOutputRate(), _input->isStereo(), (flags & SoundMixer::FLAG_REVERSE_STEREO) != 0);
-//	printf("   data has %d bits and is %s\n",
-//			((flags & SoundMixer::FLAG_16BITS) ? 16 : 8),
-//			((flags & SoundMixer::FLAG_UNSIGNED) ? "unsigned" : "signed"));
 #else
 	_flags = flags;
 	_bufferSize = buffer_size;





More information about the Scummvm-git-logs mailing list