[Scummvm-cvs-logs] CVS: scummvm/scumm imuse_digi.cpp,1.31,1.32 sound.cpp,1.151,1.152

Max Horn fingolfin at users.sourceforge.net
Wed Jul 2 04:05:17 CEST 2003


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

Modified Files:
	imuse_digi.cpp sound.cpp 
Log Message:
more cleanup

Index: imuse_digi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- imuse_digi.cpp	2 Jul 2003 00:51:25 -0000	1.31
+++ imuse_digi.cpp	2 Jul 2003 11:04:48 -0000	1.32
@@ -870,8 +870,10 @@
 
 			if (READ_UINT32(ptr) == MKID('Crea')) {
 				_channel[l]._bits = 8;
+				// Always output stereo, because in IMuseDigital::handler the data is expected to be in stereo, and
+				// different volumes for the left and right channel are being applied.
+				// That might also be the justification for specifying FLAG_REVERSE_STEREO here. Not sure.
 				_channel[l]._channels = 2;
-				_channel[l]._mixerSize = (22050 / 5) * 2;
 				_channel[l]._mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO | SoundMixer::FLAG_UNSIGNED;
 				byte * t_ptr= readCreativeVocFile(ptr, size, _channel[l]._freq, _channel[l]._numLoops);
 
@@ -880,10 +882,8 @@
 				} else if (_channel[l]._freq == 10989) {
 					_channel[l]._freq = 11025;
 				}
-				
-				if (_channel[l]._freq == 11025) {
-					_channel[l]._mixerSize /= 2;
-				}
+				_channel[l]._mixerSize = (_channel[l]._freq / 5) * 2;
+
 				size *= 2;
 				_channel[l]._data = (byte *)malloc(size);
 				for (t = 0; t < size / 2; t++) {
@@ -971,14 +971,17 @@
 						}
 					}
 				}
-				_channel[l]._mixerSize = (22050 / 5) * 2;
+
+				// Always output stereo, because in IMuseDigital::handler the data is expected to be in stereo, and
+				// different volumes for the left and right channel are being applied.
+				// That might also be the justification for specifying FLAG_REVERSE_STEREO here. Not sure.
 				_channel[l]._mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO;
+				_channel[l]._mixerSize = (_channel[l]._freq / 5) * 2;
 				if (_channel[l]._bits == 12) {
 					_channel[l]._mixerSize *= 2;
 					_channel[l]._mixerFlags |= SoundMixer::FLAG_16BITS;
 					_channel[l]._size = _scumm->_sound->decode12BitsSample(ptr, &_channel[l]._data, size, (_channel[l]._channels == 2) ? false : true);
-				}
-				if (_channel[l]._bits == 8) {
+				} else if (_channel[l]._bits == 8) {
 					_channel[l]._mixerFlags |= SoundMixer::FLAG_UNSIGNED;
 					if (_channel[l]._channels == 1) {
 						size *= 2;
@@ -993,10 +996,8 @@
 						memcpy(_channel[l]._data, ptr, size);
 					}
 					_channel[l]._size = size;
-				}
-				if (_channel[l]._freq == 11025) {
-					_channel[l]._mixerSize /= 2;
-				}
+				} else
+					error("Can't handle %d bit samples in iMuseDigital", _channel[l]._bits);
 			}
 			_channel[l]._toBeRemoved = false;
 			_channel[l]._used = true;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- sound.cpp	2 Jul 2003 00:46:24 -0000	1.151
+++ sound.cpp	2 Jul 2003 11:04:48 -0000	1.152
@@ -975,7 +975,7 @@
 	return !_scumm->_mixer->hasActiveSFXChannel();
 }
 
-uint32 Sound::decode12BitsSample(byte *src, byte **dst, uint32 size, bool stereo = false) {
+uint32 Sound::decode12BitsSample(byte *src, byte **dst, uint32 size, bool stereo) {
 	uint32 s_size = (size / 3) * 4;
 	uint32 loop_size = s_size / 4;
 	if (stereo) {
@@ -1178,7 +1178,7 @@
 	byte *buffer = NULL;
 	uint32 final_size;
 	if (_bundleMusicSampleBits == 12) {
-		final_size = decode12BitsSample(ptr, &buffer, _outputMixerSize);
+		final_size = decode12BitsSample(ptr, &buffer, _outputMixerSize, false);
 	} else if (_bundleMusicSampleBits == 16) {
 		buffer = (byte *)malloc(_outputMixerSize);
 		final_size = _outputMixerSize;





More information about the Scummvm-git-logs mailing list