[Scummvm-cvs-logs] CVS: scummvm/bs2/driver d_sound.cpp,1.61,1.62 d_sound.h,1.18,1.19

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Fri Sep 26 07:20:09 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv21479

Modified Files:
	d_sound.cpp d_sound.h 
Log Message:
cleanup


Index: d_sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/d_sound.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- d_sound.cpp	26 Sep 2003 06:26:18 -0000	1.61
+++ d_sound.cpp	26 Sep 2003 14:19:02 -0000	1.62
@@ -151,6 +151,21 @@
 //
 //=============================================================================
 
+// FIXME: One feature still missing is the original's DipMusic() function
+// which, as far as I can understand, softened the music volume when someone
+// was speaking, but only if the music was playing loudly at the time.
+//
+// I'm not sure if we can implement this in any sensible fashion - I don't
+// think we have that fine-grained control over the mixer - or if we really
+// want it anyway.
+//
+// Simply adjusting the volume paramters to flow() is not enough. If you
+// only adjust them a little you won't hear the difference anyway, and if you
+// adjust them a lot it will sound really bad.
+//
+// Does anyone who can run the original interpreter have any
+// opinions on this?
+
 #include "stdafx.h"
 #include "driver96.h"
 #include "d_sound.h"
@@ -170,13 +185,16 @@
 #define GetCompressedAmplitude(n)  ((n) & 7)
 
 int32 panTable[33] = {
-	-127, -119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7,
-	0,
-	7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127
+	-127, -119, -111, -103,  -95,  -87,  -79,  -71,
+	 -63,  -55,  -47,  -39,  -31,  -23,  -15,   -7,
+	   0,
+	   7,   15,   23,   31,   39,   47,   55,   63,
+          71,   79,   87,   95,  103,  111,  119,  127
 };
 
 int32 musicVolTable[17] = {
-	0, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255
+	  0,  15,  31,  47,  63,  79,  95, 111, 127,
+	143, 159, 175, 191, 207, 223, 239, 255
 };
 
 int16 MusicHandle::read() {
@@ -252,8 +270,6 @@
 	fxVol = 14;
 	speechMuted = 0;
 	fxMuted = 0;
-	compressedMusic = 0;
-
 	musicVol = 16;
 
 	musicMuted = 0;
@@ -262,7 +278,6 @@
 	memset(fx, 0, sizeof(fx));
 
 	soundHandleSpeech = 0;
-
 	soundOn = 1;
 
 	_converter = makeRateConverter(music[0].getRate(), _mixer->getOutputRate(), music[0].isStereo(), false);
@@ -325,10 +340,7 @@
 	if (!soundOn)
 		return;
 
-	if (!music[0]._paused && !music[1]._paused) {
-		if (compressedMusic == 1)
-			UpdateCompSampleStreaming(data, len);
-	}
+	UpdateCompSampleStreaming(data, len);
 
 	if (!music[0]._streaming && !music[1]._streaming && fpMus.isOpen())
 		fpMus.close();
@@ -494,7 +506,6 @@
 		speechStatus = 1;
 	}
 
-	// FIXME: See comment in UpdateCompSampleStreaming()
 	// DipMusic();
 
 	return RD_OK;
@@ -901,8 +912,6 @@
 	int32 primaryStream = -1;
 	int32 secondaryStream = -1;
 
-	compressedMusic = 1;
-
 	// If both music streams are playing, that should mean one of them is
 	// fading out. Pick that one.
 
@@ -930,8 +939,6 @@
 	} else
 		primaryStream = 0;
 
-	strcpy(music[primaryStream]._fileName, filename);
-
 	// Save looping info and tune id
 	music[primaryStream]._looping = looping;
 	music[primaryStream]._id = musicId;
@@ -940,8 +947,9 @@
 	if (IsMusicMute())
 		return RD_OK;
 
-	// Always use fpMus[0] (all music in one cluster)
-	// musFilePos[primaryStream] for different pieces of music.
+	// The assumption here is that we are never playing music from two
+	// different files at the same time.
+
 	if (!fpMus.isOpen())
 		fpMus.open(filename);
 
@@ -969,19 +977,14 @@
 
 void Sword2Sound::UpdateCompSampleStreaming(int16 *data, uint len) {
 	for (int i = 0; i < MAXMUS; i++) {
-		if (!music[i]._streaming)
+		if (!music[i]._streaming || music[i]._paused)
 			continue;
 
-		byte volume = musicMuted ? 0 : musicVolTable[musicVol];
+		st_sample_t volume = musicMuted ? 0 : musicVolTable[musicVol];
 
 		fpMus.seek(music[i]._filePos, SEEK_SET);
 		_converter->flow(music[i], data, len, volume, volume);
 	}
-
-	// FIXME: We need to implement DipMusic()'s functionality, but since
-	// our sound buffer is much shorter than the original's it should be
-	// enough to simply modify the channel volume in this function instead
-	// of using a separate function to modify part of the sound buffer.
 
 	// DipMusic();
 }

Index: d_sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/d_sound.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- d_sound.h	26 Sep 2003 06:26:18 -0000	1.18
+++ d_sound.h	26 Sep 2003 14:19:03 -0000	1.19
@@ -55,7 +55,6 @@
 class MusicHandle : public MusicStream {
 public:
 	uint32 _id;
-	char _fileName[256];
 	bool _firstTime;
 	bool _streaming;
 	bool _paused;
@@ -75,9 +74,7 @@
 	MusicHandle() : MusicStream(), _firstTime(false), _streaming(false),
 			_paused(false), _looping(false), _fading(0),
 			_fileStart(0), _filePos(0), _fileEnd(0),
-			_lastSample(0) {
-		_fileName[0] = 0;
-	}
+			_lastSample(0) {}
 };
 
 class Sword2Sound {
@@ -147,7 +144,6 @@
 		uint8 fxVol;
 		uint8 speechMuted;
 		uint8 fxMuted;
-		uint8 compressedMusic;
 
 		PlayingSoundHandle soundHandleSpeech;
 		uint8 musicMuted;





More information about the Scummvm-git-logs mailing list