mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 09:26:26 +00:00
Limit volume range to 0 - 255
svn-id: r46554
This commit is contained in:
parent
c03e7c8586
commit
ec5c42e1f3
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user