From 1c412d3da705dabd709614c409927ce8f6fbfe05 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Jul 2019 15:32:39 -0700 Subject: GLK: Properly handle sound setup --- engines/glk/detection.cpp | 6 +++--- engines/glk/glk.cpp | 10 ++++++++++ engines/glk/glk.h | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp index 7c6de28456..b19ecde62d 100644 --- a/engines/glk/detection.cpp +++ b/engines/glk/detection.cpp @@ -58,20 +58,20 @@ namespace Glk { GlkDetectedGame::GlkDetectedGame(const char *gameId, const char *gameDesc, const Common::String &filename) : DetectedGame(gameId, gameDesc, Common::EN_ANY, Common::kPlatformUnknown) { - setGUIOptions(GUIO4(GUIO_NOSPEECH, GUIO_NOSFX, GUIO_NOMUSIC, GUIO_NOSUBTITLES)); + setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES)); addExtraEntry("filename", filename); } GlkDetectedGame::GlkDetectedGame(const char *gameId, const char *gameDesc, const Common::String &filename, Common::Language lang) : DetectedGame(gameId, gameDesc, lang, Common::kPlatformUnknown) { - setGUIOptions(GUIO4(GUIO_NOSPEECH, GUIO_NOSFX, GUIO_NOMUSIC, GUIO_NOSUBTITLES)); + setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES)); addExtraEntry("filename", filename); } GlkDetectedGame::GlkDetectedGame(const char *gameId, const char *gameDesc, const Common::String &filename, const Common::String &md5, size_t filesize) : DetectedGame(gameId, gameDesc, Common::UNK_LANG, Common::kPlatformUnknown) { - setGUIOptions(GUIO4(GUIO_NOSPEECH, GUIO_NOSFX, GUIO_NOMUSIC, GUIO_NOSUBTITLES)); + setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES)); addExtraEntry("filename", filename); canBeAdded = true; diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp index b17304d957..06ab742e74 100644 --- a/engines/glk/glk.cpp +++ b/engines/glk/glk.cpp @@ -89,6 +89,9 @@ void GlkEngine::initialize() { _sounds = new Sounds(); _streams = new Streams(); _windows = new Windows(_screen); + + // Setup mixer + syncSoundSettings(); } Screen *GlkEngine::createScreen() { @@ -248,6 +251,13 @@ Common::Error GlkEngine::saveGameState(int slot, const Common::String &desc) { return errCode; } +void GlkEngine::syncSoundSettings() { + Engine::syncSoundSettings(); + + int volume = ConfMan.getBool("sfx_mute") ? 0 : CLIP(ConfMan.getInt("sfx_volume"), 0, 255); + _mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, volume); +} + void GlkEngine::beep() { _pcSpeaker->speakerOn(50, 50); } diff --git a/engines/glk/glk.h b/engines/glk/glk.h index 739f1774d9..cc3fc10c85 100644 --- a/engines/glk/glk.h +++ b/engines/glk/glk.h @@ -208,6 +208,11 @@ public: */ virtual Common::Error writeGameData(Common::WriteStream *ws) = 0; + /** + * Updates sound settings + */ + virtual void syncSoundSettings() override; + /** * Generate a beep */ -- cgit v1.2.3