[Scummvm-cvs-logs] SF.net SVN: scummvm: [31385] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri Apr 4 20:09:20 CEST 2008


Revision: 31385
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31385&view=rev
Author:   lordhoto
Date:     2008-04-04 11:09:19 -0700 (Fri, 04 Apr 2008)

Log Message:
-----------
Cleaned up volume settings managment.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra.cpp
    scummvm/trunk/engines/kyra/kyra_v1.cpp
    scummvm/trunk/engines/kyra/sound.h
    scummvm/trunk/engines/kyra/sound_adlib.cpp
    scummvm/trunk/engines/kyra/sound_towns.cpp

Modified: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp	2008-04-04 18:02:50 UTC (rev 31384)
+++ scummvm/trunk/engines/kyra/kyra.cpp	2008-04-04 18:09:19 UTC (rev 31385)
@@ -129,6 +129,8 @@
 		}
 	}
 
+	if (_sound)
+		_sound->updateVolumeSettings();
 	_res = new Resource(this);
 	assert(_res);
 	_res->reset();
@@ -350,6 +352,8 @@
 	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
 	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
 	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
+	if (_sound)
+		_sound->updateVolumeSettings();
 }
 
 uint8 KyraEngine::getVolume(kVolumeEntry vol) {

Modified: scummvm/trunk/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.cpp	2008-04-04 18:02:50 UTC (rev 31384)
+++ scummvm/trunk/engines/kyra/kyra_v1.cpp	2008-04-04 18:09:19 UTC (rev 31385)
@@ -196,7 +196,6 @@
 	if (!_sound->init())
 		error("Couldn't init sound");
 
-	_sound->setVolume(255);
 	_sound->loadSoundFile(0);
 
 	setupButtonData();

Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h	2008-04-04 18:02:50 UTC (rev 31384)
+++ scummvm/trunk/engines/kyra/sound.h	2008-04-04 18:09:19 UTC (rev 31385)
@@ -82,24 +82,11 @@
 	virtual void process() {}
 
 	/**
-	 * Set the volume of the device.
-	 *
-	 * @param volume	value between 0 and 255
-	 *
-	 * @see getVolume
+	 * Updates internal volume settings according to ConfigManager
 	 */
-	virtual void setVolume(int volume) = 0;
+	virtual void updateVolumeSettings() {}
 
 	/**
-	 * Returns the current volume.
-	 *
-	 * @return volume
-	 *
-	 * @see setVolume
-	 */
-	virtual int getVolume() = 0;
-
-	/**
 	 * Sets the soundfiles the output device will use
 	 * when playing a track and/or sound effect.
 	 *
@@ -237,9 +224,6 @@
 	bool init();
 	void process();
 
-	void setVolume(int volume);
-	int getVolume();
-
 	void loadSoundFile(uint file);
 
 	void playTrack(uint8 track);
@@ -291,8 +275,7 @@
 
 	bool init() { return true; }
 
-	void setVolume(int volume);
-	int getVolume() { return _volume; }
+	void updateVolumeSettings() { /*XXX*/ }
 
 	void loadSoundFile(uint file);
 
@@ -322,6 +305,8 @@
 	bool isMT32() { return _nativeMT32; }
 
 private:
+	void setVolume(int vol);
+
 	void playMusic(uint8 *data, uint32 size);
 	void stopMusic();
 	void loadSoundEffectFile(uint file);
@@ -361,9 +346,6 @@
 	bool init();
 	void process();
 
-	void setVolume(int) {}
-	int getVolume() { return 255; }
-
 	void loadSoundFile(uint file);
 
 	void playTrack(uint8 track);
@@ -419,9 +401,6 @@
 	bool init();
 	void process();
 
-	void setVolume(int) {}
-	int getVolume() { return 255; }
-
 	void loadSoundFile(uint file) {}
 
 	void playTrack(uint8 track);
@@ -448,8 +427,7 @@
 	bool init() { return (_music->init() && _sfx->init()); }
 	void process() { _music->process(); _sfx->process(); }
 
-	void setVolume(int volume) { _music->setVolume(volume); _sfx->setVolume(volume); }
-	int getVolume() { return _music->getVolume(); }
+	void updateVolumeSettings() { _music->updateVolumeSettings(); _sfx->updateVolumeSettings(); }
 
 	void setSoundList(const AudioDataStruct * list) { _music->setSoundList(list); _sfx->setSoundList(list); }
 	void loadSoundFile(uint file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); }

Modified: scummvm/trunk/engines/kyra/sound_adlib.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_adlib.cpp	2008-04-04 18:02:50 UTC (rev 31384)
+++ scummvm/trunk/engines/kyra/sound_adlib.cpp	2008-04-04 18:09:19 UTC (rev 31385)
@@ -2253,13 +2253,6 @@
 	}
 }
 
-void SoundAdlibPC::setVolume(int volume) {
-}
-
-int SoundAdlibPC::getVolume() {
-	return 0;
-}
-
 void SoundAdlibPC::playTrack(uint8 track) {
 	if (_musicEnabled) {
 		// WORKAROUND: There is a bug in the Kyra 1 "Pool of Sorrow"

Modified: scummvm/trunk/engines/kyra/sound_towns.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_towns.cpp	2008-04-04 18:02:50 UTC (rev 31384)
+++ scummvm/trunk/engines/kyra/sound_towns.cpp	2008-04-04 18:09:19 UTC (rev 31385)
@@ -1156,7 +1156,6 @@
 		_parser->unloadMusic();
 		delete _parser;
 		_parser = 0;
-		setVolume(255);
 	}
 	_driver->queue()->release();
 }


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