diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/savegame.cpp | 8 | ||||
-rw-r--r-- | engines/sci/sound/soundcmd.cpp | 55 | ||||
-rw-r--r-- | engines/sci/sound/soundcmd.h | 3 |
3 files changed, 36 insertions, 30 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index e43c7097ed..c30518ab42 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -626,12 +626,8 @@ void SoundCommandParser::reconstructPlayList() { const MusicList::iterator end = _music->getPlayListEnd(); for (MusicList::iterator i = _music->getPlayListStart(); i != end; ++i) { - if ((*i)->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, (*i)->resourceId))) { - (*i)->soundRes = new SoundResource((*i)->resourceId, _resMan, _soundVersion); - _music->soundInitSnd(*i); - } else { - (*i)->soundRes = 0; - } + initSoundResource(*i); + if ((*i)->status == kSoundPlaying) { // Sync the sound object's selectors related to playing with the stored // ones in the playlist, as they may have been invalidated when loading. 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); diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h index 7f6e2a0fe8..c1dce014d2 100644 --- a/engines/sci/sound/soundcmd.h +++ b/engines/sci/sound/soundcmd.h @@ -32,6 +32,7 @@ namespace Sci { class Console; class SciMusic; class SoundCommandParser; +class MusicEntry; //typedef void (SoundCommandParser::*SoundCommand)(reg_t obj, int16 value); //struct MusicEntryCommand { @@ -64,6 +65,7 @@ public: void processPlaySound(reg_t obj); void processStopSound(reg_t obj, bool sampleFinishedPlaying); + void initSoundResource(MusicEntry *newSound); MusicType getMusicType() const; @@ -109,6 +111,7 @@ private: SciMusic *_music; AudioPlayer *_audio; SciVersion _soundVersion; + bool _bMultiMidi; void processInitSound(reg_t obj); void processDisposeSound(reg_t obj); |