From 7feccaaa98378eb586501c9de8c2d4ca1bb00aa4 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sun, 24 Sep 2017 22:20:14 -0500 Subject: 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. --- engines/sci/sound/soundcmd.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'engines/sci/sound/soundcmd.cpp') 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); } -- cgit v1.2.3