[Scummvm-cvs-logs] CVS: scummvm/scumm imuse_digi.cpp,1.63,1.64 imuse_digi.h,1.17,1.18 sound.cpp,1.282,1.283

Max Horn fingolfin at users.sourceforge.net
Sat Dec 20 17:18:01 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv26526/scumm

Modified Files:
	imuse_digi.cpp imuse_digi.h sound.cpp 
Log Message:
Cleaned up SoundMixer::newStream() a bit (I plan to replace all usages of this by playInputStream(), this cleanup eases this a bit)

Index: imuse_digi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- imuse_digi.cpp	21 Dec 2003 00:40:42 -0000	1.63
+++ imuse_digi.cpp	21 Dec 2003 01:17:02 -0000	1.64
@@ -693,7 +693,7 @@
 	: _scumm(scumm) {
 	memset(_channel, 0, sizeof(Channel) * MAX_DIGITAL_CHANNELS);
 	for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
-		_channel[l]._mixerChannel = 0;
+		_channel[l]._handle = 0;
 	}
 	_scumm->_timer->installTimerProc(timer_handler, 200000, this);
 	_pause = false;
@@ -703,7 +703,7 @@
 	_scumm->_timer->removeTimerProc(timer_handler);
 
 	for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
-		_scumm->_mixer->stopHandle(_channel[l]._mixerChannel);
+		_scumm->_mixer->stopHandle(_channel[l]._handle);
 	}
 }
 
@@ -716,7 +716,7 @@
 	for (l = 0; l < MAX_DIGITAL_CHANNELS;l ++) {
 		if (_channel[l]._used) {
 			if (_channel[l]._toBeRemoved) {
-				_scumm->_mixer->endStream(_channel[l]._mixerChannel);
+				_scumm->_mixer->endStream(_channel[l]._handle);
 
 				free(_channel[l]._data);
 				_channel[l]._used = false;
@@ -760,7 +760,7 @@
 			int32 new_size = _channel[l]._mixerSize;
 			int32 mixer_size = new_size;
 
-			if (_channel[l]._mixerChannel == 0) {
+			if (_channel[l]._handle == 0) {
 				mixer_size *= 2;
 				new_size *= 2;
 			}
@@ -780,15 +780,13 @@
 			_channel[l]._offset += mixer_size;
 
 			if (_scumm->_silentDigitalImuse == false) {
-				int8	pan = _channel[l]._volumeRight - _channel[l]._volume;
-				if (_channel[l]._mixerChannel == 0) {
-					_scumm->_mixer->newStream(&_channel[l]._mixerChannel, buf, mixer_size,
-											_channel[l]._freq, _channel[l]._mixerFlags, 100000, _channel[l]._volume, pan);
-				} else {
-					_scumm->_mixer->appendStream(_channel[l]._mixerChannel, buf, mixer_size);
-					_scumm->_mixer->setChannelVolume(_channel[l]._mixerChannel, _channel[l]._volume);
-					_scumm->_mixer->setChannelPan(_channel[l]._mixerChannel, pan);
-				}
+				if (_channel[l]._handle == 0)
+					_scumm->_mixer->newStream(&_channel[l]._handle,
+											_channel[l]._freq, _channel[l]._mixerFlags, 100000);
+
+				_scumm->_mixer->setChannelVolume(_channel[l]._handle, _channel[l]._volume);
+				_scumm->_mixer->setChannelPan(_channel[l]._handle, _channel[l]._volumeRight - _channel[l]._volume);
+				_scumm->_mixer->appendStream(_channel[l]._handle, buf, mixer_size);
 			}
 			free(buf);
 		}

Index: imuse_digi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- imuse_digi.h	3 Oct 2003 23:32:34 -0000	1.17
+++ imuse_digi.h	21 Dec 2003 01:17:02 -0000	1.18
@@ -58,7 +58,7 @@
 		int _idSound;
 		int32 _mixerSize;
 		int _mixerFlags;
-		PlayingSoundHandle _mixerChannel;
+		PlayingSoundHandle _handle;
 		bool _used;
 		bool _toBeRemoved;
 	};

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.282
retrieving revision 1.283
diff -u -d -r1.282 -r1.283
--- sound.cpp	21 Dec 2003 00:40:42 -0000	1.282
+++ sound.cpp	21 Dec 2003 01:17:02 -0000	1.283
@@ -1193,12 +1193,9 @@
 
 	_bundleSongPosInMs = (_bundleMusicPosition * 5) / (_outputMixerSize / 200);
 	_bundleMusicPosition += final_size;
-	if (_bundleMusicTrack == 0) {
-		_scumm->_mixer->newStream(&_bundleMusicTrack, buffer, final_size, rate,
-															SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, 300000);
-	} else {
-		_scumm->_mixer->appendStream(_bundleMusicTrack, buffer, final_size);
-	}
+	if (_bundleMusicTrack == 0)
+		_scumm->_mixer->newStream(&_bundleMusicTrack, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, 300000);
+	_scumm->_mixer->appendStream(_bundleMusicTrack, buffer, final_size);
 	free(buffer);
 }
 





More information about the Scummvm-git-logs mailing list