From e5056cab91843ec0de9b2c9d1b6d91ed49189da9 Mon Sep 17 00:00:00 2001 From: dhewg Date: Sat, 19 Mar 2011 14:51:28 +0100 Subject: CINE: Init volume levels on startup Add syncSoundSettings() to set the volume for kPlainSoundType and respect the global mute setting --- engines/cine/cine.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'engines/cine/cine.cpp') diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index d80ab70660..54d113d69c 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -50,20 +50,15 @@ Sound *g_sound = 0; CineEngine *g_cine = 0; CineEngine::CineEngine(OSystem *syst, const CINEGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { + // Setup mixer + syncSoundSettings(); + DebugMan.addDebugChannel(kCineDebugScript, "Script", "Script debug level"); DebugMan.addDebugChannel(kCineDebugPart, "Part", "Part debug level"); DebugMan.addDebugChannel(kCineDebugSound, "Sound", "Sound debug level"); DebugMan.addDebugChannel(kCineDebugCollision, "Collision", "Collision debug level"); _console = new CineConsole(this); - // Setup mixer - _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); - // Use music volume for plain sound types (At least the AdLib player uses a plain sound type - // so previously the music and sfx volume controls didn't affect it at all). - // FIXME: Make AdLib player differentiate between playing sound effects and music and remove this. - _mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, ConfMan.getInt("music_volume")); - g_cine = this; g_eventRec.registerRandomSource(_rnd, "cine"); @@ -78,6 +73,20 @@ CineEngine::~CineEngine() { delete _console; } +void CineEngine::syncSoundSettings() { + Engine::syncSoundSettings(); + + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); + + // Use music volume for plain sound types (At least the AdLib player uses a plain sound type + // so previously the music and sfx volume controls didn't affect it at all). + // FIXME: Make AdLib player differentiate between playing sound effects and music and remove this. + _mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, + mute ? 0 : ConfMan.getInt("music_volume")); +} + Common::Error CineEngine::run() { // Initialize backend initGraphics(320, 200, false); -- cgit v1.2.3