[Scummvm-cvs-logs] SF.net SVN: scummvm:[51101] scummvm/trunk/engines/lure

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Jul 21 22:12:35 CEST 2010


Revision: 51101
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51101&view=rev
Author:   lordhoto
Date:     2010-07-21 20:12:35 +0000 (Wed, 21 Jul 2010)

Log Message:
-----------
LURE: Make LURE respect the mute settings.

Modified Paths:
--------------
    scummvm/trunk/engines/lure/game.cpp
    scummvm/trunk/engines/lure/game.h
    scummvm/trunk/engines/lure/sound.cpp
    scummvm/trunk/engines/lure/sound.h

Modified: scummvm/trunk/engines/lure/game.cpp
===================================================================
--- scummvm/trunk/engines/lure/game.cpp	2010-07-21 20:12:09 UTC (rev 51100)
+++ scummvm/trunk/engines/lure/game.cpp	2010-07-21 20:12:35 UTC (rev 51101)
@@ -56,8 +56,6 @@
 	_debugFlag = gDebugLevel >= ERROR_BASIC;
 
 	_soundFlag = true;
-	_musicVolume = ConfMan.getBool("music_mute") ? 0 : MIN(255, ConfMan.getInt("music_volume"));
-	_sfxVolume = ConfMan.getBool("sfx_mute") ? 0 : MIN(255, ConfMan.getInt("sfx_volume"));
 }
 
 Game::~Game() {

Modified: scummvm/trunk/engines/lure/game.h
===================================================================
--- scummvm/trunk/engines/lure/game.h	2010-07-21 20:12:09 UTC (rev 51100)
+++ scummvm/trunk/engines/lure/game.h	2010-07-21 20:12:35 UTC (rev 51101)
@@ -48,8 +48,6 @@
 private:
 	Debugger *_debugger;
 	bool _fastTextFlag, _soundFlag;
-	uint8 _sfxVolume;
-	uint8 _musicVolume;
 	uint8 _state;
 	uint16 _tellCommands[MAX_TELL_COMMANDS * 3 + 1];
 	int _numTellCommands;
@@ -87,8 +85,6 @@
 	bool &debugFlag() { return _debugFlag; }
 	bool fastTextFlag() { return _fastTextFlag; }
 	bool soundFlag() { return _soundFlag; }
-	uint8 sfxVolume() { return ConfMan.getInt("sfx_volume"); }
-	uint8 musicVolume() { return ConfMan.getInt("music_volume"); }
 	Debugger &debugger() { return *_debugger; }
 
 	// Menu item support methods

Modified: scummvm/trunk/engines/lure/sound.cpp
===================================================================
--- scummvm/trunk/engines/lure/sound.cpp	2010-07-21 20:12:09 UTC (rev 51100)
+++ scummvm/trunk/engines/lure/sound.cpp	2010-07-21 20:12:35 UTC (rev 51101)
@@ -72,6 +72,8 @@
 			_channelsInner[index].volume = 90;
 		}
 	}
+
+	syncSounds();
 }
 
 SoundManager::~SoundManager() {
@@ -288,16 +290,21 @@
 // Used to sync the volume for all channels with the Config Manager
 //
 void SoundManager::syncSounds() {
-	Game &game = Game::getReference();
 	musicInterface_TidySounds();
 
+	bool mute = false;
+	if (ConfMan.hasKey("mute"))
+		mute = ConfMan.getBool("mute");
+	_musicVolume = mute ? 0 : MIN(255, ConfMan.getInt("music_volume"));
+	_sfxVolume = mute ? 0 : MIN(255, ConfMan.getInt("sfx_volume"));
+
 	g_system->lockMutex(_soundMutex);
 	MusicListIterator i;
 	for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
 		if ((*i)->isMusic())
-			(*i)->setVolume(game.musicVolume());
+			(*i)->setVolume(_musicVolume);
 		else
-			(*i)->setVolume(game.sfxVolume());
+			(*i)->setVolume(_sfxVolume);
 	}
 	g_system->unlockMutex(_soundMutex);
 }
@@ -599,9 +606,9 @@
 	}
 
 	if (_isMusic)
-		setVolume(ConfMan.getInt("music_volume"));
+		setVolume(Sound.musicVolume());
 	else
-		setVolume(ConfMan.getInt("sfx_volume"));
+		setVolume(Sound.sfxVolume());
 
 	_passThrough = false;
 
@@ -658,8 +665,7 @@
 
 	_volume = volume;
 
-	Game &game = Game::getReference();
-	volume *= _isMusic ? game.musicVolume() : game.sfxVolume();
+	volume *= _isMusic ? Sound.musicVolume() : Sound.sfxVolume();
 
 	for (int i = 0; i < _numChannels; ++i) {
 		if (_channels[_channelNumber + i].midiChannel != NULL)
@@ -707,8 +713,7 @@
 		// Adjust volume changes by song and master volume
 		byte volume = (byte)((b >> 16) & 0x7F);
 		_channels[channel].volume = volume;
-		Game &game = Game::getReference();
-		int master_volume = _isMusic ? game.musicVolume() : game.sfxVolume();
+		int master_volume = _isMusic ? Sound.musicVolume() : Sound.sfxVolume();
 		volume = volume * _volume * master_volume / 65025;
 		b = (b & 0xFF00FFFF) | (volume << 16);
 	} else if ((b & 0xF0) == 0xC0) {

Modified: scummvm/trunk/engines/lure/sound.h
===================================================================
--- scummvm/trunk/engines/lure/sound.h	2010-07-21 20:12:09 UTC (rev 51100)
+++ scummvm/trunk/engines/lure/sound.h	2010-07-21 20:12:35 UTC (rev 51101)
@@ -105,7 +105,7 @@
 	bool isMusic() {return _isMusic; }
 };
 
-class SoundManager: public Common::Singleton<SoundManager> {
+class SoundManager : public Common::Singleton<SoundManager> {
 private:
 	// Outer sound interface properties
 	MemoryBlock *_descs;
@@ -128,11 +128,15 @@
 	Common::MutexRef _soundMutex;
 	bool _paused;
 
+	uint _musicVolume;
+	uint _sfxVolume;
+
 	// Internal support methods
 	void bellsBodge();
 	void musicInterface_TidySounds();
 	static void onTimer(void *data);
 	void doTimer();
+
 public:
 	SoundManager();
 	~SoundManager();
@@ -156,9 +160,11 @@
 	void fadeOut();
 	void pause() { _paused = true; }
 	void resume() { _paused = false; }
-	bool getPaused() { return _paused; }
-	bool hasNativeMT32() { return _nativeMT32; }
-	bool isRoland() { return _isRoland; }
+	bool getPaused() const { return _paused; }
+	bool hasNativeMT32() const { return _nativeMT32; }
+	bool isRoland() const { return _isRoland; }
+	uint musicVolume() const { return _musicVolume; }
+	uint sfxVolume() const { return _sfxVolume; }
 
 	// The following methods implement the external sound player module
 	void musicInterface_Initialise();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list