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

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Mon Jul 21 21:15:28 CEST 2008


Revision: 33176
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33176&view=rev
Author:   cpage88
Date:     2008-07-21 19:15:28 +0000 (Mon, 21 Jul 2008)

Log Message:
-----------
Separated Speech from SFX in SAGA, improved configuration of SAGA sound settings through the GMM

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/common/keyboard.h
    scummvm/branches/gsoc2008-rtl/engines/saga/interface.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/saga.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/saga.h
    scummvm/branches/gsoc2008-rtl/engines/saga/sound.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/sound.h

Modified: scummvm/branches/gsoc2008-rtl/common/keyboard.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/keyboard.h	2008-07-21 18:53:55 UTC (rev 33175)
+++ scummvm/branches/gsoc2008-rtl/common/keyboard.h	2008-07-21 19:15:28 UTC (rev 33176)
@@ -181,7 +181,7 @@
 	KEYCODE_UNDO        = 322,      // Atari keyboard has Undo
 
 	// Global Main Menu key
-	KEYCODE_MAINMENU    = KEYCODE_F11
+	KEYCODE_MAINMENU    = KEYCODE_F6
 };
 
 /**

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/interface.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/interface.cpp	2008-07-21 18:53:55 UTC (rev 33175)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/interface.cpp	2008-07-21 19:15:28 UTC (rev 33176)
@@ -1631,8 +1631,8 @@
 		break;
 	case kTextSound:
 		_vm->_soundVolume = (_vm->_soundVolume + 1) % 11;
-		_vm->_sound->setVolume(_vm->_soundVolume == 10 ? 255 : _vm->_soundVolume * 25);
 		ConfMan.setInt("sfx_volume", _vm->_soundVolume * 25);
+		_vm->_sound->setVolume();
 		break;
 	case kTextVoices:
 		if (_vm->_voiceFilesExist) {
@@ -1650,6 +1650,10 @@
 			_vm->_subtitlesEnabled = true;								// Set it to "Text"
 			_vm->_voicesEnabled = false;
 		}
+		
+		_vm->_speechVolume = (_vm->_speechVolume + 1) % 11;
+		ConfMan.setInt("speech_volume", _vm->_speechVolume * 25);
+		_vm->_sound->setVolume();
 
 		ConfMan.setBool("subtitles", _vm->_subtitlesEnabled);
 		ConfMan.setBool("voices", _vm->_voicesEnabled);

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/saga.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/saga.cpp	2008-07-21 18:53:55 UTC (rev 33175)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/saga.cpp	2008-07-21 19:15:28 UTC (rev 33176)
@@ -141,8 +141,7 @@
 }
 
 int SagaEngine::init() {
-	_soundVolume = ConfMan.getInt("sfx_volume") / 25;
-	_musicVolume = ConfMan.getInt("music_volume") / 25;
+	_musicVolume = ConfMan.getInt("music_volume");
 	_subtitlesEnabled = ConfMan.getBool("subtitles");
 	_readingSpeed = getTalkspeed();
 	_copyProtection = ConfMan.getBool("copy_protection");
@@ -202,7 +201,7 @@
 	}
 
 	// Initialize system specific sound
-	_sound = new Sound(this, _mixer, _soundVolume);
+	_sound = new Sound(this, _mixer);
 	
 	_interface->converseInit();
 	_script->setVerb(_script->getVerbType(kVerbWalkTo));
@@ -224,6 +223,8 @@
 		}
 	}
 
+	syncSoundSettings();
+
 	// FIXME: This is the ugly way of reducing redraw overhead. It works
 	//        well for 320x200 but it's unclear how well it will work for
 	//        640x480.
@@ -512,17 +513,15 @@
 }
 
 void SagaEngine::syncSoundSettings() {
-	_soundVolume = ConfMan.getInt("sfx_volume");
-	_musicVolume = ConfMan.getInt("music_volume");
 	_subtitlesEnabled = ConfMan.getBool("subtitles");
 	_readingSpeed = getTalkspeed();
 
 	if (_readingSpeed > 3)
 		_readingSpeed = 0;
 
+	_musicVolume = ConfMan.getInt("music_volume");
 	_music->setVolume(_musicVolume, 1);
-	_sound->setVolume(_soundVolume);
-
+	_sound->setVolume();
 }
 
 } // End of namespace Saga

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/saga.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/saga.h	2008-07-21 18:53:55 UTC (rev 33175)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/saga.h	2008-07-21 19:15:28 UTC (rev 33176)
@@ -521,6 +521,7 @@
 
 	int _soundVolume;
 	int _musicVolume;
+	int _speechVolume;
 	bool _subtitlesEnabled;
 	bool _voicesEnabled;
 	bool _voiceFilesExist;

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/sound.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/sound.cpp	2008-07-21 18:53:55 UTC (rev 33175)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/sound.cpp	2008-07-21 19:15:28 UTC (rev 33176)
@@ -22,8 +22,10 @@
  * $Id$
  *
  */
+
+#include "common/config-manager.h"
+
 #include "saga/saga.h"
-
 #include "saga/sound.h"
 
 #include "sound/audiostream.h"
@@ -32,13 +34,13 @@
 
 namespace Saga {
 
-Sound::Sound(SagaEngine *vm, Audio::Mixer *mixer, int volume) :
+Sound::Sound(SagaEngine *vm, Audio::Mixer *mixer) :
 	_vm(vm), _mixer(mixer), _voxStream(0) {
 
 	for (int i = 0; i < SOUND_HANDLES; i++)
 		_handles[i].type = kFreeHandle;
 
-	setVolume(volume == 10 ? 255 : volume * 25);
+	setVolume();
 }
 
 Sound::~Sound() {
@@ -61,7 +63,8 @@
 	return NULL;
 }
 
-void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, bool loop) {
+void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, 
+				sndHandleType handleType, bool loop) {
 	byte flags;
 
 	flags = Audio::Mixer::FLAG_AUTOFREE;
@@ -81,7 +84,12 @@
 		flags |= Audio::Mixer::FLAG_UNSIGNED;
 
 	if (!(_vm->getFeatures() & GF_COMPRESSED_SOUNDS)) {
-		_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume);
+		if (handleType == kVoiceHandle)
+			_mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, 
+					buffer.size, buffer.frequency, flags, -1, volume);
+		else
+			_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, 
+					buffer.size, buffer.frequency, flags, -1, volume);
 	} else {
 		Audio::AudioStream *stream = NULL;
 		MemoryReadStream *tmp = NULL;
@@ -116,12 +124,23 @@
 #endif
 			default:
 				// No compression, play it as raw sound
-				_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume);
+				if (handleType == kVoiceHandle)
+					_mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, 
+							buffer.size, buffer.frequency, flags, -1, volume);
+				else
+					_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, 
+							buffer.size, buffer.frequency, flags, -1, volume);
 				break;
 		}
 
-		if (stream != NULL)
-			_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream, -1, volume, 0, true, false);
+		if (stream != NULL) {
+			if (handleType == kVoiceHandle)
+				_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, handle, stream, -1, 
+							volume, 0, true, false);
+			else
+				_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream, -1, 
+							volume, 0, true, false);
+		}
 	}
 }
 
@@ -129,7 +148,7 @@
 	SndHandle *handle = getHandle();
 
 	handle->type = kEffectHandle;
-	playSoundBuffer(&handle->handle, buffer, 2 * volume, loop);
+	playSoundBuffer(&handle->handle, buffer, 2 * volume, handle->type, loop);
 }
 
 void Sound::pauseSound() {
@@ -156,7 +175,7 @@
 	SndHandle *handle = getHandle();
 
 	handle->type = kVoiceHandle;
-	playSoundBuffer(&handle->handle, buffer, 255, false);
+	playSoundBuffer(&handle->handle, buffer, 255, handle->type, false);
 }
 
 void Sound::pauseVoice() {
@@ -184,9 +203,11 @@
 	stopSound();
 }
 
-void Sound::setVolume(int volume) {
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume);
+void Sound::setVolume() {
+	_vm->_soundVolume = ConfMan.getInt("sound_volume");
+	_vm->_speechVolume = ConfMan.getInt("speech_volume");
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, _vm->_soundVolume);
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, _vm->_speechVolume);
 }
 
 } // End of namespace Saga

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/sound.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/sound.h	2008-07-21 18:53:55 UTC (rev 33175)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/sound.h	2008-07-21 19:15:28 UTC (rev 33176)
@@ -71,7 +71,7 @@
 class Sound {
 public:
 
-	Sound(SagaEngine *vm, Audio::Mixer *mixer, int volume);
+	Sound(SagaEngine *vm, Audio::Mixer *mixer);
 	~Sound();
 
 	void playSound(SoundBuffer &buffer, int volume, bool loop);
@@ -86,11 +86,12 @@
 
 	void stopAll();
 
-	void setVolume(int volume);
+	void setVolume();
 
  private:
 
-	void playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, bool loop);
+	void playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, 
+				sndHandleType handleType, bool loop);
 
 	SndHandle *getHandle();
 


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