[Scummvm-cvs-logs] SF.net SVN: scummvm: [32855] scummvm/branches/gsoc2008-rtl/engines

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Tue Jul 1 00:41:55 CEST 2008


Revision: 32855
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32855&view=rev
Author:   cpage88
Date:     2008-06-30 15:41:55 -0700 (Mon, 30 Jun 2008)

Log Message:
-----------
Sound settings for Lure can be modified through the GMM

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/engines/engine.h
    scummvm/branches/gsoc2008-rtl/engines/lure/lure.cpp
    scummvm/branches/gsoc2008-rtl/engines/lure/lure.h
    scummvm/branches/gsoc2008-rtl/engines/lure/sound.cpp
    scummvm/branches/gsoc2008-rtl/engines/lure/sound.h

Modified: scummvm/branches/gsoc2008-rtl/engines/engine.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/engine.h	2008-06-30 21:55:08 UTC (rev 32854)
+++ scummvm/branches/gsoc2008-rtl/engines/engine.h	2008-06-30 22:41:55 UTC (rev 32855)
@@ -128,7 +128,7 @@
 
 	/** Run the Global Main Menu Dialog
 	 */
-	void mainMenuDialog();
+	virtual void mainMenuDialog();
 
 	/** Sync the engine's sound settings with the config manager
 	 */

Modified: scummvm/branches/gsoc2008-rtl/engines/lure/lure.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/lure/lure.cpp	2008-06-30 21:55:08 UTC (rev 32854)
+++ scummvm/branches/gsoc2008-rtl/engines/lure/lure.cpp	2008-06-30 22:41:55 UTC (rev 32855)
@@ -246,6 +246,10 @@
 	Engine::GUIErrorMessage(buffer);
 }
 
+void LureEngine::syncSoundSettings() {	
+	Sound.syncSounds(ConfMan.getInt("music_volume"), ConfMan.getInt("sfx_volume"));
+}
+
 Common::String *LureEngine::detectSave(int slotNumber) {
 	Common::ReadStream *f = this->_saveFileMan->openForLoading(
 		generateSaveName(slotNumber));

Modified: scummvm/branches/gsoc2008-rtl/engines/lure/lure.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/lure/lure.h	2008-06-30 21:55:08 UTC (rev 32854)
+++ scummvm/branches/gsoc2008-rtl/engines/lure/lure.h	2008-06-30 22:41:55 UTC (rev 32855)
@@ -70,6 +70,7 @@
 	virtual int init();
 	virtual int go();
 	virtual void pauseEngineIntern(bool pause);
+	virtual void syncSoundSettings();
 
 	Disk &disk() { return *_disk; }
 

Modified: scummvm/branches/gsoc2008-rtl/engines/lure/sound.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/lure/sound.cpp	2008-06-30 21:55:08 UTC (rev 32854)
+++ scummvm/branches/gsoc2008-rtl/engines/lure/sound.cpp	2008-06-30 22:41:55 UTC (rev 32855)
@@ -220,10 +220,12 @@
 	newEntry->channel = channelCtr;
 	newEntry->numChannels = numChannels;
 	newEntry->flags = rec.flags;
-	if (_isRoland)
-		newEntry->volume = rec.volume;
-	else /* resource volumes do not seem to work well with our adlib emu */
-		newEntry->volume = 240; /* 255 causes clipping with adlib */
+
+	if (newEntry->soundNumber & 0x80)	
+		newEntry->volume = ConfMan.getInt("music_volume");
+	else
+		newEntry->volume = ConfMan.getInt("sfx_volume");
+
 	_activeSounds.push_back(SoundList::value_type(newEntry));
 
 	musicInterface_Play(rec.soundNumber, channelCtr, numChannels);
@@ -280,6 +282,21 @@
 	return 0xff;   // Couldn't find entry
 }
 
+// Used to sync the volume for all channels with the Config Manager
+//
+void SoundManager::syncSounds(uint8 musicVol, uint8 sfxVol) {
+	MusicListIterator i;
+
+	musicInterface_TidySounds();
+
+	for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
+		if ((*i)->isMusic())
+			(*i)->setVolume(musicVol);
+		else
+			(*i)->setVolume(sfxVol);
+	}
+}
+
 SoundDescResource *SoundManager::findSound(uint8 soundNumber) {
 	debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::findSound soundNumber=%d", soundNumber);
 	SoundListIterator i;
@@ -402,9 +419,8 @@
 		return;
 
 	bool isMusic = (soundNumber & 0x80) != 0;
-	uint8 volume = isMusic ? game.musicVolume() : game.sfxVolume();
-
-	if (!game.soundFlag() || (volume == 0))
+	
+	if (!game.soundFlag())
 		// Don't play sounds if sound is turned off
 		return;
 
@@ -576,8 +592,12 @@
 		/* 90 is power on default for midi compliant devices */
 		_channels[_channelNumber + i].volume = 90;
 	}
-	setVolume(240); /* 255 causes clipping with mastervol 192 and adlib */
 
+	if (isMusic)
+		setVolume(ConfMan.getInt("music_volume"));
+	else
+		setVolume(ConfMan.getInt("sfx_volume"));		
+
 	_passThrough = false;
 
 	_parser = MidiParser::createParser_SMF();
@@ -634,14 +654,9 @@
 
 	_volume = volume;
 
-	Game &game = Game::getReference();
-	volume *= _isMusic ? game.musicVolume() : game.sfxVolume();
-
 	for (int i = 0; i < _numChannels; ++i) {
 		if (_channels[_channelNumber + i].midiChannel != NULL)
-			_channels[_channelNumber + i].midiChannel->volume(
-				_channels[_channelNumber + i].volume *
-				volume / 65025);
+			_channels[_channelNumber + i].midiChannel->volume(volume);
 	}
 }
 

Modified: scummvm/branches/gsoc2008-rtl/engines/lure/sound.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/lure/sound.h	2008-06-30 21:55:08 UTC (rev 32854)
+++ scummvm/branches/gsoc2008-rtl/engines/lure/sound.h	2008-06-30 22:41:55 UTC (rev 32855)
@@ -98,6 +98,7 @@
 	uint8 channelNumber() { return _channelNumber; }
 	uint8 soundNumber() { return _soundNumber; }
 	bool isPlaying() { return _isPlaying; }
+	bool isMusic() {return _isMusic; }
 };
 
 class SoundManager: public Common::Singleton<SoundManager> {
@@ -142,6 +143,7 @@
 	void stopSound(uint8 soundIndex);
 	void killSound(uint8 soundNumber);
 	void setVolume(uint8 soundNumber, uint8 volume);
+	void syncSounds(uint8 musicVol, uint8 sfxVol);
 	void tidySounds();
 	uint8 descIndexOf(uint8 soundNumber);
 	SoundDescResource *findSound(uint8 soundNumber);


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