[Scummvm-git-logs] scummvm master -> b9b81a22c298a44304f260203673c5c83b1cb04b
sev-
sev at scummvm.org
Sun Sep 11 23:18:32 CEST 2016
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0046cefd4e FULLPIPE: Fix crash on mute
b9b81a22c2 FULLPIPE: Make sound controls work and persistent
Commit: 0046cefd4ec1d5cea62addfbb3a629a2cc50f243
https://github.com/scummvm/scummvm/commit/0046cefd4ec1d5cea62addfbb3a629a2cc50f243
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-09-11T23:18:25+02:00
Commit Message:
FULLPIPE: Fix crash on mute
Changed paths:
engines/fullpipe/sound.cpp
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index 57d0ac5..c9af9e8 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -521,7 +521,7 @@ void FullpipeEngine::stopAllSoundInstances(int id) {
void FullpipeEngine::updateSoundVolume() {
for (int i = 0; i < _currSoundListCount; i++)
- for (int j = 0; i < _currSoundList1[i]->getCount(); j++) {
+ for (int j = 0; j < _currSoundList1[i]->getCount(); j++) {
_currSoundList1[i]->getSoundByIndex(j)->setPanAndVolume(_sfxVolume, 0);
}
}
Commit: b9b81a22c298a44304f260203673c5c83b1cb04b
https://github.com/scummvm/scummvm/commit/b9b81a22c298a44304f260203673c5c83b1cb04b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-09-11T23:18:25+02:00
Commit Message:
FULLPIPE: Make sound controls work and persistent
Changed paths:
engines/fullpipe/fullpipe.cpp
engines/fullpipe/modal.cpp
engines/fullpipe/sound.cpp
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 82528f2..6b8f92c 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 27503d4..1d1bbd0 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 c9af9e8..e7432a6 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
More information about the Scummvm-git-logs
mailing list