[Scummvm-cvs-logs] CVS: scummvm/scumm/smush smush_mixer.cpp,1.34,1.35 smush_mixer.h,1.9,1.10 smush_player.cpp,1.137,1.138 smush_player.h,1.36,1.37

Max Horn fingolfin at users.sourceforge.net
Sat Nov 27 12:11:05 CET 2004


Update of /cvsroot/scummvm/scummvm/scumm/smush
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10249/scumm/smush

Modified Files:
	smush_mixer.cpp smush_mixer.h smush_player.cpp smush_player.h 
Log Message:
Removed the (highly SCUMM specific) 'appendable stream' API from SoundMixer; SCUMM now uses the appendable stream directly

Index: smush_mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_mixer.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- smush_mixer.cpp	22 Aug 2004 09:14:19 -0000	1.34
+++ smush_mixer.cpp	27 Nov 2004 17:09:05 -0000	1.35
@@ -93,7 +93,8 @@
 				delete _channels[i].chan;
 				_channels[i].id = -1;
 				_channels[i].chan = NULL;
-				_mixer->endStream(_channels[i].handle);
+				_channels[i].stream->finish();
+				_channels[i].stream = 0;
 			} else {
 				int32 rate, vol, pan;
 				bool stereo, is_16bit;
@@ -119,11 +120,13 @@
 				}
 
 				if (_mixer->isReady()) {
-					if (!_channels[i].handle.isActive())
-						_mixer->newStream(&_channels[i].handle, rate, flags, 500000);
+					if (!_channels[i].handle.isActive()) {
+						_channels[i].stream = makeAppendableAudioStream(rate, flags, 500000);
+						_mixer->playInputStream(&_channels[i].handle, _channels[i].stream, false);
+					}
 					_mixer->setChannelVolume(_channels[i].handle, vol);
 					_mixer->setChannelBalance(_channels[i].handle, pan);
-					_mixer->appendStream(_channels[i].handle, data, size);
+					_channels[i].stream->append((byte *)data, size);
 				}
 				free(data);
 			}
@@ -139,7 +142,8 @@
 			delete _channels[i].chan;
 			_channels[i].id = -1;
 			_channels[i].chan = NULL;
-			_mixer->endStream(_channels[i].handle);
+			_channels[i].stream->finish();
+			_channels[i].stream = 0;
 		}
 	}
 	return true;

Index: smush_mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_mixer.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- smush_mixer.h	6 Jan 2004 12:45:31 -0000	1.9
+++ smush_mixer.h	27 Nov 2004 17:09:05 -0000	1.10
@@ -23,6 +23,7 @@
 #define SMUSH_MIXER_H
 
 #include "stdafx.h"
+#include "sound/audiostream.h"
 #include "sound/mixer.h"
 
 namespace Scumm {
@@ -40,6 +41,7 @@
 		int id;
 		SmushChannel *chan;
 		PlayingSoundHandle handle;
+		AppendableAudioStream *stream;
 	} _channels[NUM_CHANNELS];
 
 	int _soundFrequency;

Index: smush_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- smush_player.cpp	27 Nov 2004 15:58:08 -0000	1.137
+++ smush_player.cpp	27 Nov 2004 17:09:05 -0000	1.138
@@ -314,6 +314,7 @@
 	_vm->_mixer->stopHandle(_compressedFileSoundHandle);
 
 	_vm->_mixer->stopHandle(_IACTchannel);
+	_IACTstream = 0;
 
 	_vm->_fullRedraw = true;
 
@@ -494,9 +495,11 @@
 						}
 					} while (--count);
 
-					if (!_IACTchannel.isActive())
-						_vm->_mixer->newStream(&_IACTchannel, 22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000);
-					_vm->_mixer->appendStream(_IACTchannel, output_data, 0x1000);
+					if (!_IACTchannel.isActive()) {
+						_IACTstream = makeAppendableAudioStream(22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000);
+						_vm->_mixer->playInputStream(&_IACTchannel, _IACTstream, false);
+					}
+					_IACTstream->append(output_data, 0x1000);
 
 					bsize -= len;
 					d_src += len;

Index: smush_player.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- smush_player.h	8 Oct 2004 18:30:14 -0000	1.36
+++ smush_player.h	27 Nov 2004 17:09:05 -0000	1.37
@@ -26,6 +26,7 @@
 #include "scumm/smush/chunk.h"
 #include "scumm/smush/codec37.h"
 #include "scumm/smush/codec47.h"
+#include "sound/audiostream.h"
 #include "sound/mixer.h"
 
 namespace Scumm {
@@ -57,6 +58,8 @@
 	int32 _frame;
 
 	PlayingSoundHandle _IACTchannel;
+	AppendableAudioStream *_IACTstream;
+
 	PlayingSoundHandle _compressedFileSoundHandle;
 	bool _compressedFileMode;
 	File _compressedFile;





More information about the Scummvm-git-logs mailing list