aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorColin Snover2016-07-10 13:19:59 -0500
committerColin Snover2016-07-11 10:39:50 -0500
commite4588a713435a4606d5799132d602522151839fb (patch)
treeb1ae20340222f049b6a3ec46f95c6fbcfce6f8d0 /engines/sci
parent60c36631425755cbb9d7b06637b129b0e9b4a9da (diff)
downloadscummvm-rg350-e4588a713435a4606d5799132d602522151839fb.tar.gz
scummvm-rg350-e4588a713435a4606d5799132d602522151839fb.tar.bz2
scummvm-rg350-e4588a713435a4606d5799132d602522151839fb.zip
SCI32: Silence non-monitored channels while monitoring is active
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/sound/audio32.cpp10
1 files changed, 10 insertions, 0 deletions
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;