aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound/soundcmd.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2011-09-26 19:57:50 +0300
committerFilippos Karapetis2011-09-26 20:02:34 +0300
commit9fd66deb43a8ba1bd7b423cb6fe2b7177af74166 (patch)
tree0a71718e0b474c94c86521e58167f1cdbed02a67 /engines/sci/sound/soundcmd.cpp
parent43fb9d32b52d3db7530ba5afac1bfe8e11decde3 (diff)
downloadscummvm-rg350-9fd66deb43a8ba1bd7b423cb6fe2b7177af74166.tar.gz
scummvm-rg350-9fd66deb43a8ba1bd7b423cb6fe2b7177af74166.tar.bz2
scummvm-rg350-9fd66deb43a8ba1bd7b423cb6fe2b7177af74166.zip
SCI: Changes to the sound resource initialization code
- Unified the sound resource initialization code in processInitSound() and reconstructPlayList() - Now checking the "Mixed Adlib/MIDI" mode checkbox for SCI1.1 digital audio sound effects, like it's done for SCI0 - SCI1 sound effects. If it's unchecked, their MIDI counterparts will play instead, if available
Diffstat (limited to 'engines/sci/sound/soundcmd.cpp')
-rw-r--r--engines/sci/sound/soundcmd.cpp55
1 files changed, 31 insertions, 24 deletions
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index b723117811..a91b103214 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -37,6 +37,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM
_music = new SciMusic(_soundVersion);
_music->init();
+ _bMultiMidi = ConfMan.getBool("multi_midi");
}
SoundCommandParser::~SoundCommandParser() {
@@ -63,6 +64,35 @@ int SoundCommandParser::getSoundResourceId(reg_t obj) {
return resourceId;
}
+void SoundCommandParser::initSoundResource(MusicEntry *newSound) {
+ if (newSound->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, newSound->resourceId)))
+ newSound->soundRes = new SoundResource(newSound->resourceId, _resMan, _soundVersion);
+ else
+ newSound->soundRes = 0;
+
+ // In SCI1.1 games, sound effects are started from here. If we can find
+ // a relevant audio resource, play it, otherwise switch to synthesized
+ // effects. If the resource exists, play it using map 65535 (sound
+ // effects map)
+ bool checkAudioResource = getSciVersion() >= SCI_VERSION_1_1;
+ if (g_sci->getGameId() == GID_HOYLE4)
+ checkAudioResource = false; // hoyle 4 has garbled audio resources in place of the sound resources
+ // if we play those, we will only make the user deaf and break speakers. Sierra SCI doesn't play anything
+ // on soundblaster. FIXME: check, why this is
+
+ if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, newSound->resourceId))) {
+ // Found a relevant audio resource, create an audio stream
+ if (_bMultiMidi || !newSound->soundRes) {
+ int sampleLen;
+ newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen);
+ newSound->soundType = Audio::Mixer::kSpeechSoundType;
+ }
+ }
+
+ if (!newSound->pStreamAud && newSound->soundRes)
+ _music->soundInitSnd(newSound);
+}
+
void SoundCommandParser::processInitSound(reg_t obj) {
int resourceId = getSoundResourceId(obj);
@@ -73,11 +103,6 @@ void SoundCommandParser::processInitSound(reg_t obj) {
MusicEntry *newSound = new MusicEntry();
newSound->resourceId = resourceId;
- if (resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, resourceId)))
- newSound->soundRes = new SoundResource(resourceId, _resMan, _soundVersion);
- else
- newSound->soundRes = 0;
-
newSound->soundObj = obj;
newSound->loop = readSelectorValue(_segMan, obj, SELECTOR(loop));
newSound->priority = readSelectorValue(_segMan, obj, SELECTOR(pri)) & 0xFF;
@@ -88,25 +113,7 @@ void SoundCommandParser::processInitSound(reg_t obj) {
debugC(kDebugLevelSound, "kDoSound(init): %04x:%04x number %d, loop %d, prio %d, vol %d", PRINT_REG(obj),
resourceId, newSound->loop, newSound->priority, newSound->volume);
- // In SCI1.1 games, sound effects are started from here. If we can find
- // a relevant audio resource, play it, otherwise switch to synthesized
- // effects. If the resource exists, play it using map 65535 (sound
- // effects map)
- bool checkAudioResource = getSciVersion() >= SCI_VERSION_1_1;
- if (g_sci->getGameId() == GID_HOYLE4)
- checkAudioResource = false; // hoyle 4 has garbled audio resources in place of the sound resources
- // if we play those, we will only make the user deaf and break speakers. Sierra SCI doesn't play anything
- // on soundblaster. FIXME: check, why this is
-
- if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, resourceId))) {
- // Found a relevant audio resource, play it
- int sampleLen;
- newSound->pStreamAud = _audio->getAudioStream(resourceId, 65535, &sampleLen);
- newSound->soundType = Audio::Mixer::kSpeechSoundType;
- } else {
- if (newSound->soundRes)
- _music->soundInitSnd(newSound);
- }
+ initSoundResource(newSound);
_music->pushBackSlot(newSound);