SCI: Handle master volume inside music drivers

svn-id: r47261
This commit is contained in:
Walter van Niftrik 2010-01-12 00:51:37 +00:00
parent dc45c729a9
commit 1a570df5dc
9 changed files with 53 additions and 18 deletions

View file

@ -178,6 +178,8 @@ Common::Error SciEngine::run() {
}
#endif
syncSoundSettings();
_gamestate->_gui->init(_gamestate->usesOldGfxFunctions());
debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()).c_str());
@ -187,6 +189,8 @@ Common::Error SciEngine::run() {
game_exit(_gamestate);
script_free_breakpoints(_gamestate);
ConfMan.flushToDisk();
delete _gamestate->_soundCmd;
delete _gamestate->_gui;
delete _gamestate->_event;
@ -281,4 +285,21 @@ void SciEngine::pauseEngineIntern(bool pause) {
_mixer->pauseAll(pause);
}
void SciEngine::syncSoundSettings() {
Engine::syncSoundSettings();
#ifndef USE_OLD_MUSIC_FUNCTIONS
bool mute = false;
if (ConfMan.hasKey("mute"))
mute = ConfMan.getBool("mute");
int soundVolumeMusic = (mute ? 0 : ConfMan.getInt("music_volume"));
if (_gamestate && _gamestate->_soundCmd) {
int vol = (soundVolumeMusic + 1) * SoundCommandParser::kMaxSciVolume / Audio::Mixer::kMaxMixerVolume;
_gamestate->_soundCmd->setMasterVolume(vol);
}
#endif
}
} // End of namespace Sci