diff options
author | Martin Kiewitz | 2010-01-01 21:04:20 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-01 21:04:20 +0000 |
commit | 379ae6df30b1014f2c6aa772d142d007ab4edffe (patch) | |
tree | 74197af2a6b0b09b77d25669c251c9e2af59e357 | |
parent | 967853c03f03bc620ab82e1550a419d716ba3388 (diff) | |
download | scummvm-rg350-379ae6df30b1014f2c6aa772d142d007ab4edffe.tar.gz scummvm-rg350-379ae6df30b1014f2c6aa772d142d007ab4edffe.tar.bz2 scummvm-rg350-379ae6df30b1014f2c6aa772d142d007ab4edffe.zip |
SCI/newmusic: now clips volume against MUSIC_VOLUME_MAX (127) instead of the mixer max volume (which would be wrong of course), adjusts volume when setting sample channel volume
svn-id: r46850
-rw-r--r-- | engines/sci/engine/savegame.cpp | 2 | ||||
-rw-r--r-- | engines/sci/sfx/music.cpp | 3 | ||||
-rw-r--r-- | engines/sci/sfx/music.h | 1 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 4 |
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; |