[Scummvm-git-logs] scummvm master -> 6814ee9ba54582f5b5adcffab49efbbd8f589edd
bluegr
noreply at scummvm.org
Sun Sep 6 14:22:45 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
6814ee9ba5 KINGDOM: Play stereo music in stereo mode
Commit: 6814ee9ba54582f5b5adcffab49efbbd8f589edd
https://github.com/scummvm/scummvm/commit/6814ee9ba54582f5b5adcffab49efbbd8f589edd
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2026-09-06T17:22:40+03:00
Commit Message:
KINGDOM: Play stereo music in stereo mode
Fixes music playback in DOS (tested with GOG) version
In DOS version there are two folders for sound (music) files. One is "SOUNDM" with MSD files (mono) and the other is "SOUNDS" with SSD files (stereo). Before the fix, the engine would use the stereo version of a sound resource, but would play it in MONO which resulted in bad sound, eg. in the menu screen after the intro cutscenes.
This PR introduces a GUI option to opt in for the mono music, but by default will use the stereo music files and fixes the bad sound when playing music.
Note that the PR assumes that all versions of the game have available the stereo version of the music.
Changed paths:
engines/kingdom/detection.cpp
engines/kingdom/kingdom.cpp
engines/kingdom/kingdom.h
engines/kingdom/metaengine.cpp
diff --git a/engines/kingdom/detection.cpp b/engines/kingdom/detection.cpp
index 31069d2bef2..5f0cd20f139 100644
--- a/engines/kingdom/detection.cpp
+++ b/engines/kingdom/detection.cpp
@@ -54,7 +54,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO1(GUIO_GAMEOPTIONS1)
},
// Kingdom 3DO, provided by Strangerke
diff --git a/engines/kingdom/kingdom.cpp b/engines/kingdom/kingdom.cpp
index 038ac44af95..7f4a4add0fa 100644
--- a/engines/kingdom/kingdom.cpp
+++ b/engines/kingdom/kingdom.cpp
@@ -63,6 +63,8 @@ KingdomGame::KingdomGame(OSystem *syst, const ADGameDescription *gameDesc) : Eng
_showHotspots = false;
+ _monoSound = false;
+
const Common::FSNode gameDataDir(ConfMan.getPath("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "MAPS");
SearchMan.addSubDirectoryMatching(gameDataDir, "PICS");
@@ -170,6 +172,8 @@ Common::Error KingdomGame::run() {
_logic = new Logic(this);
+ _monoSound = ConfMan.getBool("mono_sound");
+
setupPics();
initTools();
titlePage();
@@ -926,10 +930,22 @@ void KingdomGame::playSound(int idx) {
return;
int realIdx = _soundNumber + 200; // Or +250, depending in the original on the sound card
+ byte audioFlags = Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN;
+ if (_monoSound)
+ realIdx += 50;
+ else
+ audioFlags |= Audio::FLAG_STEREO;
+
+ if (realIdx <= 200 || realIdx > 300) {
+ warning("Invalid sound index %d", realIdx);
+ return;
+ }
+
debug("PlaySound %d : %s", idx, _rezNames[realIdx]);
Common::SeekableReadStream *soundStream = loadAResource(realIdx);
- Audio::RewindableAudioStream *rewindableStream = Audio::makeRawStream(soundStream, 22050, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN, DisposeAfterUse::YES);
+ Audio::RewindableAudioStream *rewindableStream = Audio::makeRawStream(soundStream, 22050, audioFlags, DisposeAfterUse::YES);
+
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume);
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, rewindableStream);
// In the original, there's an array describing whether a sound should loop or not.
diff --git a/engines/kingdom/kingdom.h b/engines/kingdom/kingdom.h
index 720d46e8831..122ad622be6 100644
--- a/engines/kingdom/kingdom.h
+++ b/engines/kingdom/kingdom.h
@@ -160,6 +160,7 @@ namespace Kingdom {
int _mouseValue;
int _cursorDef; // TODO: Could be removed by using the return value of CursorTypeExit()
int _oldCursorDef; // CHECKME: Unused in our implementation?
+ bool _monoSound;
Common::Point _cursorPos;
Common::Point _oldCursorPos; // CHECKME: Unused in out implementation?
diff --git a/engines/kingdom/metaengine.cpp b/engines/kingdom/metaengine.cpp
index b209cac2e62..e1693db8ebd 100644
--- a/engines/kingdom/metaengine.cpp
+++ b/engines/kingdom/metaengine.cpp
@@ -24,6 +24,7 @@
#include "common/savefile.h"
#include "engines/advancedDetector.h"
#include "common/file.h"
+#include "common/translation.h"
#include "kingdom/kingdom.h"
@@ -34,6 +35,21 @@ namespace Kingdom {
const char *KingdomGame::getGameId() const { return _gameDescription->gameId; }
Common::Platform KingdomGame::getPlatform() const { return _gameDescription->platform; }
+static const ADExtraGuiOptionsMap optionsList[] = {
+ {
+ GUIO_GAMEOPTIONS1,
+ {
+ _s("Mono music"),
+ _s("Use monophonic music"),
+ "mono_sound",
+ false,
+ 0,
+ 0
+ }
+ },
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
} // End of namespace Kingdom
@@ -43,6 +59,10 @@ public:
return "kingdom";
}
+ const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override {
+ return Kingdom::optionsList;
+ }
+
bool hasFeature(MetaEngineFeature f) const override;
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
More information about the Scummvm-git-logs
mailing list