diff options
author | Filippos Karapetis | 2009-12-25 14:02:28 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-12-25 14:02:28 +0000 |
commit | ec5c42e1f303973e48afcfe4509a1d053e6154ae (patch) | |
tree | 047888dd4a2ba157494153a983bceb855078eef4 | |
parent | c03e7c8586429a8f65cf815c13024a38b1557377 (diff) | |
download | scummvm-rg350-ec5c42e1f303973e48afcfe4509a1d053e6154ae.tar.gz scummvm-rg350-ec5c42e1f303973e48afcfe4509a1d053e6154ae.tar.bz2 scummvm-rg350-ec5c42e1f303973e48afcfe4509a1d053e6154ae.zip |
Limit volume range to 0 - 255
svn-id: r46554
-rw-r--r-- | engines/sci/sfx/music.cpp | 2 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index d4bca294c1..b47c65bd4c 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -472,7 +472,7 @@ uint16 SciMusic::soundGetMasterVolume() { //--------------------------------------------- void SciMusic::soundSetMasterVolume(uint16 vol) { vol = vol & 0xF; // 0..15 - vol = vol * Audio::Mixer::kMaxMixerVolume / 0xF; + vol = (vol * Audio::Mixer::kMaxMixerVolume / 0xF) & 0xFF; // 0...255 // TODO:balance volume to prevent music to be too loud _pMixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol); _pMixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, vol); diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index 9227bb275c..c41857ca9f 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -659,7 +659,7 @@ void SoundCommandParser::cmdUpdateHandle(reg_t obj, int16 value) { } _music->_playList[slot]->loop = (GET_SEL32V(_segMan, obj, loop) == 0xFFFF ? 1 : 0); - uint32 objVol = GET_SEL32V(_segMan, obj, vol); + uint32 objVol = GET_SEL32V(_segMan, obj, vol) & 0xFF; if (objVol != _music->_playList[slot]->volume) _music->soundSetVolume(_music->_playList[slot], objVol); uint32 objPrio = GET_SEL32V(_segMan, obj, vol); @@ -821,6 +821,8 @@ void SoundCommandParser::cmdSetHandleVolume(reg_t obj, int16 value) { return; } + value = value & 0xFF; // 0...255 + if (_music->_playList[slot]->volume != value) { _music->_playList[slot]->volume = value; _music->soundSetVolume(_music->_playList[slot], value); |