From e4588a713435a4606d5799132d602522151839fb Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sun, 10 Jul 2016 13:19:59 -0500 Subject: SCI32: Silence non-monitored channels while monitoring is active --- engines/sci/sound/audio32.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'engines/sci/sound/audio32.cpp') diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp index e7d02464d6..0cf8e3cb13 100644 --- a/engines/sci/sound/audio32.cpp +++ b/engines/sci/sound/audio32.cpp @@ -353,6 +353,16 @@ int Audio32::readBuffer(Audio::st_sample_t *buffer, const int numSamples) { maxSamplesWritten = _numMonitoredSamples; } } else if (!channel.stream->endOfStream() || channel.loop) { + if (_monitoredChannelIndex != -1) { + // Audio that is not on the monitored channel is silent + // when the monitored channel is active, but the stream still + // needs to be read in order to ensure that sound effects sync + // up once the monitored channel is turned off. The easiest + // way to guarantee this is to just do the normal channel read, + // but set the channel volume to zero so nothing is mixed in + leftVolume = rightVolume = 0; + } + const int channelSamplesWritten = writeAudioInternal(channel.stream, channel.converter, buffer, numSamples, leftVolume, rightVolume, channel.loop); if (channelSamplesWritten > maxSamplesWritten) { maxSamplesWritten = channelSamplesWritten; -- cgit v1.2.3