diff options
author | Eugene Sandulenko | 2011-06-09 00:58:39 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2011-06-10 11:27:27 +0300 |
commit | ca825e1dba5dedabd3505892a1001be7e13cf6ca (patch) | |
tree | 4fa4693527f97eb5ff7736412f702ef2b04f47c3 /engines | |
parent | f13143ef7db6ca572652f8febb062f348b314175 (diff) | |
download | scummvm-rg350-ca825e1dba5dedabd3505892a1001be7e13cf6ca.tar.gz scummvm-rg350-ca825e1dba5dedabd3505892a1001be7e13cf6ca.tar.bz2 scummvm-rg350-ca825e1dba5dedabd3505892a1001be7e13cf6ca.zip |
SWORD25: Unstub SoundEngine::set/getVolume
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sword25/sfx/soundengine.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp index 20622b2098..13ee3fd1d0 100644 --- a/engines/sword25/sfx/soundengine.cpp +++ b/engines/sword25/sfx/soundengine.cpp @@ -37,6 +37,7 @@ #include "audio/decoders/vorbis.h" #include "common/system.h" +#include "common/config-manager.h" namespace Sword25 { @@ -65,8 +66,6 @@ SoundEngine::SoundEngine(Kernel *pKernel) : ResourceService(pKernel) { } bool SoundEngine::init(uint sampleRate, uint channels) { - warning("STUB: SoundEngine::init(%d, %d)", sampleRate, channels); - return true; } @@ -74,12 +73,44 @@ void SoundEngine::update() { } void SoundEngine::setVolume(float volume, SOUND_TYPES type) { - warning("STUB: SoundEngine::setVolume(%f, %d)", volume, type); + int val = 255 * volume; + + switch (type) { + case SoundEngine::MUSIC: + ConfMan.setInt("music_volume", val); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, val); + break; + case SoundEngine::SPEECH: + ConfMan.setInt("speech_volume", val); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, val); + break; + case SoundEngine::SFX: + ConfMan.setInt("sfx_volume", val); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, val); + break; + default: + error("Unknown SOUND_TYPE"); + } } float SoundEngine::getVolume(SOUND_TYPES type) { - warning("STUB: SoundEngine::getVolume(%d)", type); - return 0; + int val = 0; + + switch (type) { + case SoundEngine::MUSIC: + val = ConfMan.getInt("music_volume"); + break; + case SoundEngine::SPEECH: + val = ConfMan.getInt("speech_volume"); + break; + case SoundEngine::SFX: + val = ConfMan.getInt("sfx_volume"); + break; + default: + error("Unknown SOUND_TYPE"); + } + + return (float)val / 255.0; } void SoundEngine::pauseAll() { |