aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/savegame.cpp2
-rw-r--r--engines/sci/sfx/music.cpp3
-rw-r--r--engines/sci/sfx/music.h1
-rw-r--r--engines/sci/sfx/soundcmd.cpp4
4 files changed, 6 insertions, 4 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 315b264ddd..9ec79dd2c0 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -120,7 +120,7 @@ void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint32LE(hold);
// volume and dataInc will be synced from the sound objects
// when the sound list is reconstructed in gamestate_restore()
- volume = MUSIC_VOLUME_FOR_SCI0;
+ volume = MUSIC_VOLUME_MAX;
dataInc = 0;
// No fading info
fadeTo = 0;
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp
index beba2699f8..509e3b6535 100644
--- a/engines/sci/sfx/music.cpp
+++ b/engines/sci/sfx/music.cpp
@@ -411,8 +411,9 @@ void SciMusic::soundStop(MusicEntry *pSnd) {
}
void SciMusic::soundSetVolume(MusicEntry *pSnd, byte volume) {
+ assert(volume <= MUSIC_VOLUME_MAX);
if (pSnd->pStreamAud) {
- _pMixer->setChannelVolume(pSnd->hCurrentAud, volume);
+ _pMixer->setChannelVolume(pSnd->hCurrentAud, volume * 2); // Mixer is 0-255, SCI is 0-127
} else if (pSnd->pMidiParser) {
_mutex.lock();
pSnd->pMidiParser->setVolume(volume);
diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h
index fe025f18a7..f1202ab822 100644
--- a/engines/sci/sfx/music.h
+++ b/engines/sci/sfx/music.h
@@ -57,6 +57,7 @@ enum SoundStatus {
};
#define MUSIC_VOLUME_FOR_SCI0 127
+#define MUSIC_VOLUME_MAX 127
class MidiParser_SCI;
class SegManager;
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index cd781ce7c4..f4b06c5fb5 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -280,7 +280,7 @@ void SoundCommandParser::cmdInitHandle(reg_t obj, int16 value) {
newSound->soundObj = obj;
newSound->loop = GET_SEL32V(_segMan, obj, loop);
newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF;
- newSound->volume = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, Audio::Mixer::kMaxChannelVolume);
+ newSound->volume = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, MUSIC_VOLUME_MAX);
// Check if a track with the same sound object is already playing
MusicEntry *oldSound = _music->getSlot(obj);
@@ -895,7 +895,7 @@ void SoundCommandParser::cmdSetHandleVolume(reg_t obj, int16 value) {
debugC(2, kDebugLevelSound, "cmdSetHandleVolume: %d", value);
- value = CLIP<int>(value, 0, Audio::Mixer::kMaxChannelVolume);
+ value = CLIP<int>(value, 0, MUSIC_VOLUME_MAX);
if (musicSlot->volume != value) {
musicSlot->volume = value;