[Scummvm-cvs-logs] CVS: scummvm/scumm/smush channel.h,1.10,1.11 imuse_channel.cpp,1.19,1.20 smush_mixer.cpp,1.7,1.8

Max Horn fingolfin at users.sourceforge.net
Sat Jun 21 13:58:02 CEST 2003


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

Modified Files:
	channel.h imuse_channel.cpp smush_mixer.cpp 
Log Message:
get rid of 11025 Hz special case (I hope this is correct; only case I know of where 11025 Hz are used is during the Dig intro

Index: channel.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/channel.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- channel.h	17 Mar 2003 12:28:49 -0000	1.10
+++ channel.h	21 Jun 2003 20:57:00 -0000	1.11
@@ -129,7 +129,7 @@
 	void getSoundData(int8 *sound_buffer, int32 size);
 	int32 getRate() { return _rate; }
 	bool getParameters(int32 &rate, bool &stereo, bool &is_16bit) {
-		rate = _frequency;
+		rate = _rate;
 		stereo = (_channels == 2);
 		is_16bit = (_bitsize > 8);
 		return true;

Index: imuse_channel.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/imuse_channel.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- imuse_channel.cpp	21 Jun 2003 19:57:56 -0000	1.19
+++ imuse_channel.cpp	21 Jun 2003 20:57:01 -0000	1.20
@@ -322,27 +322,13 @@
 	if (_dataSize <= 0 || _bitsize <= 8) error("invalid call to imuse_channel::read_sound_data()");
 	if (_channels == 2) size *= 2;
 	byte * buf = (byte*)snd;
-	if (_rate == 11025) {
-		// TODO / FIXME: Instead of upsampling here in the worst possible way
-		// (by repeating samples), we should pass the 11khz data to the mixer,
-		// and leave the upsampling to the mixer.
-		for (int32 i = 0; i < size; i++) {
-			byte sample1 = *(_sbuffer + i * 2);
-			byte sample2 = *(_sbuffer + i * 2 + 1);
-			uint16 sample = (uint16)(((int16)((sample1 << 8) | sample2) * _volume) >> 8);
-			buf[i * 4 + 0] = (byte)(sample >> 8);
-			buf[i * 4 + 1] = (byte)(sample & 0xff);
-			buf[i * 4 + 2] = buf[i * 4 + 0];
-			buf[i * 4 + 3] = buf[i * 4 + 1];
-		}
-	} else {
-		for (int32 i = 0; i < size; i++){
-			byte sample1 = *(_sbuffer + i * 2);
-			byte sample2 = *(_sbuffer + i * 2 + 1);
-			uint16 sample = (uint16)(((int16)((sample1 << 8) | sample2) * _volume) >> 8);
-			buf[i * 2 + 0] = (byte)(sample >> 8);
-			buf[i * 2 + 1] = (byte)(sample & 0xff);
-		}
+
+	for (int32 i = 0; i < size; i++){
+		byte sample1 = *(_sbuffer + i * 2);
+		byte sample2 = *(_sbuffer + i * 2 + 1);
+		uint16 sample = (uint16)(((int16)((sample1 << 8) | sample2) * _volume) >> 8);
+		buf[i * 2 + 0] = (byte)(sample >> 8);
+		buf[i * 2 + 1] = (byte)(sample & 0xff);
 	}
 	delete []_sbuffer;
 	assert(_sbufferSize == 2 * size);
@@ -354,18 +340,9 @@
 void ImuseChannel::getSoundData(int8 *snd, int32 size) {
 	if (_dataSize <= 0 || _bitsize > 8) error("invalid call to imuse_channel::read_sound_data()");
 	if (_channels == 2) size *= 2;
-	if (_rate == 11025) {
-		// TODO / FIXME: Instead of upsampling here in the worst possible way
-		// (by repeating samples), we should pass the 11khz data to the mixer,
-		// and leave the upsampling to the mixer.
-		for (int32 i = 0; i < size; i++) {
-			snd[i * 2] = (int8)(((int8)(_sbuffer[i] ^ 0x80) * _volume) >> 8) ^ 0x80;
-			snd[i * 2 + 1] = snd[i * 2];
-		}
-	} else {
-		for (int32 i = 0; i < size; i++){
-			snd[i] = (int8)(((int8)(_sbuffer[i] ^ 0x80) * _volume) >> 8) ^ 0x80;
-		}
+
+	for (int32 i = 0; i < size; i++){
+		snd[i] = (int8)(((int8)(_sbuffer[i] ^ 0x80) * _volume) >> 8) ^ 0x80;
 	}
 	delete []_sbuffer;
 	_sbuffer = 0;

Index: smush_mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_mixer.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- smush_mixer.cpp	21 Jun 2003 20:40:34 -0000	1.7
+++ smush_mixer.cpp	21 Jun 2003 20:57:01 -0000	1.8
@@ -117,8 +117,6 @@
 				if (is_short) {
 					data = malloc(size * (stereo ? 2 : 1) * 4);
 					_channels[i].chan->getSoundData((int16 *)data, size);
-					if (_channels[i].chan->getRate() == 11025)
-						size *= 2;
 					size *= stereo ? 4 : 2;
 
 					flags |= SoundMixer::FLAG_16BITS;
@@ -126,8 +124,6 @@
 				} else {
 					data = malloc(size * (stereo ? 2 : 1) * 2);
 					_channels[i].chan->getSoundData((int8 *)data, size);
-					if (_channels[i].chan->getRate() == 11025)
-						size *= 2;
 					size *= stereo ? 2 : 1;
 
 					flags |= SoundMixer::FLAG_UNSIGNED;





More information about the Scummvm-git-logs mailing list