diff options
author | Eugene Sandulenko | 2016-09-11 23:05:09 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-11 23:18:25 +0200 |
commit | b9b81a22c298a44304f260203673c5c83b1cb04b (patch) | |
tree | bfd8840d07e9183db65507e25cc1508d7b6f81ed | |
parent | 0046cefd4ec1d5cea62addfbb3a629a2cc50f243 (diff) | |
download | scummvm-rg350-b9b81a22c298a44304f260203673c5c83b1cb04b.tar.gz scummvm-rg350-b9b81a22c298a44304f260203673c5c83b1cb04b.tar.bz2 scummvm-rg350-b9b81a22c298a44304f260203673c5c83b1cb04b.zip |
FULLPIPE: Make sound controls work and persistent
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/modal.cpp | 2 | ||||
-rw-r--r-- | engines/fullpipe/sound.cpp | 11 |
3 files changed, 12 insertions, 9 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 82528f2886..6b8f92ccd2 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -63,8 +63,9 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) warning("Sound initialization failed."); } - _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); + syncSoundSettings(); + _sfxVolume = ConfMan.getInt("sfx_volume") * 39 - 10000; + _musicVolume = ConfMan.getInt("music_volume"); _rnd = new Common::RandomSource("fullpipe"); _console = 0; @@ -84,9 +85,6 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _soundEnabled = true; _flgSoundList = true; - _sfxVolume = 0; - _musicVolume = 0; - _inputController = 0; _inputDisabled = false; diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 27503d4cbe..1d1bbd077d 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1023,7 +1023,7 @@ bool ModalMainMenu::init(int counterdiff) { } void ModalMainMenu::updateVolume() { - if (g_fp->_soundEnabled ) { + if (g_fp->_soundEnabled) { for (int s = 0; s < g_fp->_currSoundListCount; s++) for (int i = 0; i < g_fp->_currSoundList1[s]->getCount(); i++) { updateSoundVolume(g_fp->_currSoundList1[s]->getSoundByIndex(i)); diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index c9af9e85ae..e7432a62c4 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -29,6 +29,7 @@ #include "fullpipe/messages.h" #include "fullpipe/statics.h" +#include "common/config-manager.h" #include "common/memstream.h" #include "audio/mixer.h" #include "audio/audiostream.h" @@ -214,8 +215,8 @@ void Sound::setPanAndVolumeByStaticAni() { } void Sound::setPanAndVolume(int vol, int pan) { - g_fp->_mixer->setChannelVolume(*_handle, vol / 39); // 0..10000 - g_fp->_mixer->setChannelBalance(*_handle, pan / 78); // -10000..10000 + g_fp->_mixer->setChannelVolume(*_handle, MIN((vol + 10000) / 39, 255)); // -10000..0 + g_fp->_mixer->setChannelBalance(*_handle, CLIP(pan / 78, -127, 127)); // -10000..10000 } void Sound::play(int flag) { @@ -520,6 +521,9 @@ void FullpipeEngine::stopAllSoundInstances(int id) { } void FullpipeEngine::updateSoundVolume() { + ConfMan.setInt("sfx_volume", MAX((_sfxVolume + 10000) / 39, 255)); + syncSoundSettings(); + for (int i = 0; i < _currSoundListCount; i++) for (int j = 0; j < _currSoundList1[i]->getCount(); j++) { _currSoundList1[i]->getSoundByIndex(j)->setPanAndVolume(_sfxVolume, 0); @@ -529,7 +533,8 @@ void FullpipeEngine::updateSoundVolume() { void FullpipeEngine::setMusicVolume(int vol) { _musicVolume = vol; - g_fp->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol); + ConfMan.setInt("music_volume", _musicVolume); + syncSoundSettings(); } } // End of namespace Fullpipe |