[Scummvm-cvs-logs] CVS: scummvm/sword1 music.cpp,1.15,1.16 music.h,1.6,1.7 sound.cpp,1.20,1.21 sound.h,1.9,1.10 sword1.cpp,1.29,1.30

Robert G?ffringmann lavosspawn at users.sourceforge.net
Tue Jan 6 03:49:00 CET 2004


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv4036/sword1

Modified Files:
	music.cpp music.h sound.cpp sound.h sword1.cpp 
Log Message:
get volume from gamedetector

Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/music.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- music.cpp	4 Jan 2004 16:19:15 -0000	1.15
+++ music.cpp	6 Jan 2004 11:48:30 -0000	1.16
@@ -116,6 +116,7 @@
 	_mutex = _system->create_mutex();
 	_converter[0] = NULL;
 	_converter[1] = NULL;
+	_volume = 192;
 }
 
 SwordMusic::~SwordMusic() {
@@ -132,12 +133,13 @@
 
 void SwordMusic::mixer(int16 *buf, uint32 len) {
 	Common::StackLock lock(_mutex);
-	for (int i = 0; i < ARRAYSIZE(_handles); i++) {
-		if (_handles[i].streaming() && _converter[i]) {
-			st_volume_t vol = 255;
-			_converter[i]->flow(_handles[i], buf, len, vol, vol);
-		}
-	}
+	for (int i = 0; i < ARRAYSIZE(_handles); i++)
+		if (_handles[i].streaming() && _converter[i])
+			_converter[i]->flow(_handles[i], buf, len, _volume, _volume);
+}
+
+void SwordMusic::setVolume(uint8 vol) {
+	_volume = (st_volume_t)vol;
 }
 
 void SwordMusic::startMusic(int32 tuneId, int32 loopFlag) {

Index: music.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/music.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- music.h	3 Jan 2004 14:10:13 -0000	1.6
+++ music.h	6 Jan 2004 11:48:30 -0000	1.7
@@ -64,7 +64,9 @@
 	~SwordMusic();
 	void startMusic(int32 tuneId, int32 loopFlag);
 	void fadeDown();
+	void setVolume(uint8 vol);
 private:
+	st_volume_t _volume;
 	SwordMusicHandle _handles[2];
 	RateConverter *_converter[2];
 	OSystem *_system;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sound.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- sound.cpp	29 Dec 2003 14:04:57 -0000	1.20
+++ sound.cpp	6 Jan 2004 11:48:30 -0000	1.21
@@ -36,6 +36,12 @@
 	_cowHeader = NULL;
 	_endOfQueue = 0;
 	_currentCowFile = 0;
+	_speechVol = _sfxVol = 192;
+}
+
+void SwordSound::setVolume(uint8 sfxVol, uint8 speechVol) {
+	_sfxVol = sfxVol;
+	_speechVol = speechVol;
 }
 
 int SwordSound::addToQueue(int32 fxNo) {
@@ -138,6 +144,7 @@
 					uint8 volR = _fxList[elem->id].roomVolList[cnt].rightVol * 10;
 					int8 pan = (volR - volL) / 2;
 					uint8 volume = (volR + volL) / 2;
+					volume = (volume * _sfxVol) >> 8;
 					uint32 size = READ_LE_UINT32(sampleData + 0x28);
 					uint8 flags;
 					if (READ_LE_UINT16(sampleData + 0x22) == 16)
@@ -167,7 +174,7 @@
 		uint32 size;
 		int16 *data = uncompressSpeech(index + _cowHeaderSize, sampleSize, &size);
 		if (data)
-			_mixer->playRaw(&_speechHandle, data, size, 11025, SPEECH_FLAGS, SOUND_SPEECH_ID);
+			_mixer->playRaw(&_speechHandle, data, size, 11025, SPEECH_FLAGS, SOUND_SPEECH_ID, _speechVol);
 		return true;
 	} else
 		return false;

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sound.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- sound.h	30 Dec 2003 22:57:52 -0000	1.9
+++ sound.h	6 Jan 2004 11:48:30 -0000	1.10
@@ -59,6 +59,7 @@
 public:
 	SwordSound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan);
 	~SwordSound(void);
+	void setVolume(uint8 sfxVol, uint8 speechVol);
 	void newScreen(uint32 screen);
 	void quitScreen(void);
 	void closeCowSystem(void);
@@ -74,6 +75,7 @@
 	void engine(void);
 
 private:
+	uint8 _sfxVol, _speechVol;
 	void playSample(QueueElement *elem);
 	void initCowSystem(void);
 

Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- sword1.cpp	4 Jan 2004 17:19:17 -0000	1.29
+++ sword1.cpp	6 Jan 2004 11:48:30 -0000	1.30
@@ -109,6 +109,12 @@
 	_logic = new SwordLogic(_objectMan, _resMan, _screen, _mouse, _sound, _music, _menu);
 	_mouse->useLogicAndMenu(_logic, _menu);
 
+	_music->setVolume((uint8)ConfMan.getInt("music_volume"));
+	uint8 speechVol = (uint8)ConfMan.getInt("speech_volume");
+	if (!speechVol)
+		speechVol = 192;
+	_sound->setVolume((uint8)ConfMan.getInt("sfx_volume"), speechVol);
+
 	_systemVars.justRestoredGame = _systemVars.currentCD = 
 		_systemVars.gamePaused = 0;
 	_systemVars.deathScreenFlag = 3;





More information about the Scummvm-git-logs mailing list