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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri Dec 21 10:28:27 CET 2007


Revision: 29939
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29939&view=rev
Author:   lordhoto
Date:     2007-12-21 01:28:27 -0800 (Fri, 21 Dec 2007)

Log Message:
-----------
Reverted too complicated (and unneeded) volume settings code for towns driver.

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

Modified: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp	2007-12-21 09:20:31 UTC (rev 29938)
+++ scummvm/trunk/engines/kyra/kyra.cpp	2007-12-21 09:28:27 UTC (rev 29939)
@@ -96,27 +96,10 @@
 		// TODO: currently we don't support the PC98 sound data,
 		// but since it has the FM-Towns data files, we just use the
 		// FM-Towns driver
-
-		// Since we handle the volume internally for our FM-Towns driver we set the global
-		// volume for those sound types to the maximum.
-		_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, Audio::Mixer::kMaxMixerVolume);
-		_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume);
-
-		if (_flags.gameID == GI_KYRA1) {
-			SoundTowns *snd = new SoundTowns(this, _mixer);
-
-			snd->setMusicVolume(ConfMan.getInt("music_volume"));
-			snd->setSoundEffectsVolume(ConfMan.getInt("sfx_volume"));
-
-			_sound = snd;
-		} else {
-			SoundTowns_v2 *snd = new SoundTowns_v2(this, _mixer);
-
-			snd->setMusicVolume(ConfMan.getInt("music_volume"));
-			snd->setSoundEffectsVolume(ConfMan.getInt("sfx_volume"));
-
-			_sound = snd;
-		}
+		if (_flags.gameID == GI_KYRA1)
+			_sound = new SoundTowns(this, _mixer);
+		else
+			_sound = new SoundTowns_v2(this, _mixer);
 	} else if (midiDriver == MD_ADLIB) {
 		_sound = new SoundAdlibPC(this, _mixer);
 		assert(_sound);

Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h	2007-12-21 09:20:31 UTC (rev 29938)
+++ scummvm/trunk/engines/kyra/sound.h	2007-12-21 09:28:27 UTC (rev 29939)
@@ -370,12 +370,6 @@
 	void setVolume(int) {}
 	int getVolume() { return 255; }
 
-	// TODO: this should be moved to Sound or at least
-	// supplied by Sound as a pure virtual method.
-	// TODO: define ranges for those two functions
-	void setMusicVolume(int volume);
-	void setSoundEffectsVolume(int volume) { _sfxVolume = CLIP(volume, 0, 255); }
-
 	void loadSoundFile(uint file);
 
 	void playTrack(uint8 track);
@@ -412,7 +406,6 @@
 
 	uint _sfxFileIndex;
 	uint8 *_sfxFileData;
-	uint8 _sfxVolume;
 
 	SoundTowns_EuphonyDriver * _driver;
 	MidiParser * _parser;
@@ -435,12 +428,6 @@
 	void setVolume(int) {}
 	int getVolume() { return 255; }
 
-	// TODO: this should be moved to Sound or at least
-	// supplied by Sound as a pure virtual method.
-	// TODO: define ranges for those two functions
-	void setMusicVolume(int volume);
-	void setSoundEffectsVolume(int volume) { _sfxVolume = CLIP(volume, 0, 255); }
-
 	void loadSoundFile(uint file) {}
 
 	void playTrack(uint8 track);
@@ -455,7 +442,6 @@
 
 	Audio::AudioStream *_currentSFX;
 	Audio::SoundHandle _sfxHandle;
-	uint8 _sfxVolume;
 
 	//SoundTowns_v2_TwnDriver * _driver;
 	uint8 * _twnTrackData;

Modified: scummvm/trunk/engines/kyra/sound_towns.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_towns.cpp	2007-12-21 09:20:31 UTC (rev 29938)
+++ scummvm/trunk/engines/kyra/sound_towns.cpp	2007-12-21 09:28:27 UTC (rev 29939)
@@ -1084,14 +1084,14 @@
 	_driver->send(0x79B0);
 }
 
-SoundTowns::SoundTowns(KyraEngine *vm, Audio::Mixer *mixer) : Sound(vm, mixer), _lastTrack(-1),
-	 _currentSFX(0), _sfxFileData(0), _sfxFileIndex((uint)-1), _sfxWDTable(0), _parser(0), _sfxVolume(255) {
+SoundTowns::SoundTowns(KyraEngine *vm, Audio::Mixer *mixer)
+	: Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), _sfxFileData(0),
+	_sfxFileIndex((uint)-1), _sfxWDTable(0), _parser(0) {
 
 	_driver = new SoundTowns_EuphonyDriver(_mixer);
 	int ret = open();
-	if (ret != MERR_ALREADY_OPEN && ret != 0) {
+	if (ret != MERR_ALREADY_OPEN && ret != 0)
 		error("couldn't open midi driver");
-	}
 }
 
 SoundTowns::~SoundTowns() {
@@ -1190,13 +1190,6 @@
 	_driver->queue()->release();
 }
 
-void SoundTowns::setMusicVolume(int volume) {
-	volume = CLIP<int>(volume, 0, Audio::Mixer::kMaxMixerVolume);
-
-	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
-	_driver->setVolume(255);
-}
-
 void SoundTowns::loadSoundFile(uint file) {
 	if (_sfxFileIndex == file)
 		return;
@@ -1293,7 +1286,7 @@
 
 	_currentSFX = Audio::makeLinearInputStream(sfxPlaybackBuffer, playbackBufferSize,
 		outputRate, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LITTLE_ENDIAN | Audio::Mixer::FLAG_AUTOFREE, 0, 0);
-	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX, -1, _sfxVolume);
+	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX);
 }
 
 void SoundTowns::beginFadeOut() {
@@ -1422,9 +1415,9 @@
 
 //	KYRA 2
 
-SoundTowns_v2::SoundTowns_v2(KyraEngine *vm, Audio::Mixer *mixer) :
-	 Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), /*_driver(0),*/
-	 _twnTrackData(0), _sfxVolume(255) {
+SoundTowns_v2::SoundTowns_v2(KyraEngine *vm, Audio::Mixer *mixer)
+	: Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), /*_driver(0),*/
+	 _twnTrackData(0) {
 }
 
 SoundTowns_v2::~SoundTowns_v2() {
@@ -1448,10 +1441,6 @@
 	AudioCD.updateCD();
 }
 
-void SoundTowns_v2::setMusicVolume(int volume) {
-	/* TODO */
-}
-
 void SoundTowns_v2::playTrack(uint8 track) {
 	if (track == _lastTrack && _musicEnabled)
 		return;
@@ -1541,7 +1530,7 @@
 
 	_currentSFX = Audio::makeLinearInputStream(sfx, outsize, outputRate,
 		Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LITTLE_ENDIAN | Audio::Mixer::FLAG_AUTOFREE, 0, 0);
-	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX, -1, _sfxVolume);
+	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX);
 
 	delete [] data;
 }


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