From cedd9d3c40503ec74575ea133a60c569a57238c4 Mon Sep 17 00:00:00 2001 From: Ruud Klaver Date: Sun, 18 Sep 2016 20:32:47 +0200 Subject: SCI: Play MIDI version of SCI0 sound resource if user prefers it If the user has "Prefer digital sound effects" disabled for a SCI0 game, do not play the digital sample version of a sound resource, if such data is present. When the resource has only digital sample data and no MIDI information, play the sample instead. Closes gh-1022. --- engines/sci/sound/music.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 647f588d1e..5530952dcf 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -350,8 +350,27 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { pSnd->time = ++_timeCounter; if (track) { + bool playSample; + + if (_soundVersion <= SCI_VERSION_0_LATE && !_useDigitalSFX) { + // For SCI0 the digital sample is present in the same track as the + // MIDI. If the user specifically requests not to use the digital + // samples, play the MIDI data instead. If the MIDI portion of the + // track is empty however, play the digital sample anyway. This is + // necessary for e.g. the "Where am I?" sample in the SQ3 intro. + playSample = false; + + if (track->channelCount == 2) { + SoundResource::Channel &chan = track->channels[0]; + if (chan.data.size() < 2 || chan.data[1] == SCI_MIDI_EOT) { + playSample = true; + } + } + } else + playSample = (track->digitalChannelNr != -1); + // Play digital sample - if (track->digitalChannelNr != -1) { + if (playSample) { const SciSpan &channelData = track->channels[track->digitalChannelNr].data; delete pSnd->pStreamAud; byte flags = Audio::FLAG_UNSIGNED; -- cgit v1.2.3