aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound/audio32.cpp
diff options
context:
space:
mode:
authorColin Snover2017-06-16 16:32:16 -0500
committerColin Snover2017-06-18 21:42:58 -0500
commitd556dcc57bf50a03d81ab7a1ef59a9e5758465bf (patch)
tree977a4935fdff18a022860871475a40af25c01e95 /engines/sci/sound/audio32.cpp
parent733eaeb499bb39f75e7dd218df4c71b06b7e1610 (diff)
downloadscummvm-rg350-d556dcc57bf50a03d81ab7a1ef59a9e5758465bf.tar.gz
scummvm-rg350-d556dcc57bf50a03d81ab7a1ef59a9e5758465bf.tar.bz2
scummvm-rg350-d556dcc57bf50a03d81ab7a1ef59a9e5758465bf.zip
SCI: Switch SCI2 games to use Audio32
Upon investigation of Sound code across SCI32 games, it was determined that there are actually (at least) 3 different revisions, not just a single SCI2.1 version. This patch only changes the parts of Sound code that are relevant to the correct use of Audio32. Fixes Trac#9736, Trac#9756, Trac#9767, Trac#9791.
Diffstat (limited to 'engines/sci/sound/audio32.cpp')
-rw-r--r--engines/sci/sound/audio32.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp
index 5e75095e5a..cfbab8b055 100644
--- a/engines/sci/sound/audio32.cpp
+++ b/engines/sci/sound/audio32.cpp
@@ -114,7 +114,9 @@ Audio32::Audio32(ResourceManager *resMan) :
_monitoredBufferSize(0),
_numMonitoredSamples(0) {
- if (getSciVersion() < SCI_VERSION_3) {
+ if (getSciVersion() < SCI_VERSION_2_1_EARLY) {
+ _channels.resize(10);
+ } else if (getSciVersion() < SCI_VERSION_3) {
_channels.resize(5);
} else {
_channels.resize(8);
@@ -311,7 +313,22 @@ int Audio32::readBuffer(Audio::st_sample_t *const buffer, const int numSamples)
Audio::st_volume_t leftVolume, rightVolume;
if (channel.pan == -1 || !isStereo()) {
- leftVolume = rightVolume = channel.volume * Audio::Mixer::kMaxChannelVolume / kMaxVolume;
+ int volume = channel.volume;
+ if (getSciVersion() == SCI_VERSION_2) {
+ // NOTE: In SSCI, audio is decompressed into a temporary
+ // buffer, then the samples in that buffer are looped over,
+ // shifting each sample right 3, 2, or 1 bits to reduce the
+ // volume.
+ if (volume > 0 && volume <= 42) {
+ volume = 15;
+ } else if (volume > 42 && volume <= 84) {
+ volume = 31;
+ } else if (volume > 84 && volume < kMaxVolume) {
+ volume = 63;
+ }
+ }
+
+ leftVolume = rightVolume = volume * Audio::Mixer::kMaxChannelVolume / kMaxVolume;
} else {
// TODO: This should match the SCI3 algorithm,
// which seems to halve the volume of each