diff options
author | Colin Snover | 2017-09-24 22:20:14 -0500 |
---|---|---|
committer | Colin Snover | 2017-09-27 20:27:33 -0500 |
commit | 7feccaaa98378eb586501c9de8c2d4ca1bb00aa4 (patch) | |
tree | 231e5f12f05dfdf4489532225f548f9ef1348da3 /engines/sci/sound/soundcmd.cpp | |
parent | b98d44ca0ba913c11f03fd45c4fdd99261f294fb (diff) | |
download | scummvm-rg350-7feccaaa98378eb586501c9de8c2d4ca1bb00aa4.tar.gz scummvm-rg350-7feccaaa98378eb586501c9de8c2d4ca1bb00aa4.tar.bz2 scummvm-rg350-7feccaaa98378eb586501c9de8c2d4ca1bb00aa4.zip |
SCI32: Implement SCI3-variant volume handling
Trying to find differences in Lighthouse's audio sample playback,
I discovered that SCI3 had its own variant of handling volumes and
sending this volume information back to game scripts. It is not
known if this fixes any sound bug.
Diffstat (limited to 'engines/sci/sound/soundcmd.cpp')
-rw-r--r-- | engines/sci/sound/soundcmd.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index e8fd20d2e5..0bb295d41e 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -514,8 +514,19 @@ void SoundCommandParser::processUpdateCues(reg_t obj) { if (musicSlot->isSample) { #ifdef ENABLE_SCI32 if (_soundVersion >= SCI_VERSION_2) { - const int position = g_sci->_audio32->getPosition(ResourceId(kResourceTypeAudio, musicSlot->resourceId), musicSlot->soundObj); + const ResourceId audioId = ResourceId(kResourceTypeAudio, musicSlot->resourceId); + + if (getSciVersion() == SCI_VERSION_3) { + // In SSCI the volume is first set to -1 and then reset later if + // a sample is playing in the audio player, but since our audio + // code returns -1 for not-found samples, the extra check is not + // needed and we can just always set it to the return value of + // the getVolume call + const int16 volume = g_sci->_audio32->getVolume(audioId, musicSlot->soundObj); + writeSelectorValue(_segMan, musicSlot->soundObj, SELECTOR(vol), volume); + } + const int16 position = g_sci->_audio32->getPosition(audioId, musicSlot->soundObj); if (position == -1) { processStopSound(musicSlot->soundObj, true); } |