aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2009-07-06 12:44:55 +0000
committerFilippos Karapetis2009-07-06 12:44:55 +0000
commitb38c5f8c5c1f08db12e84d65a32be6462c38d232 (patch)
treea60c51ab0851af6952f28eb4a974a2b605924796 /engines/sci/engine
parent3abc1e8375989b21d47f383f9184d74ca504951c (diff)
downloadscummvm-rg350-b38c5f8c5c1f08db12e84d65a32be6462c38d232.tar.gz
scummvm-rg350-b38c5f8c5c1f08db12e84d65a32be6462c38d232.tar.bz2
scummvm-rg350-b38c5f8c5c1f08db12e84d65a32be6462c38d232.zip
Proper handling of sound effects marked as music resources
svn-id: r42174
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/ksound.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 17f085028f..1e35efffaf 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -808,10 +808,18 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (!GET_SEL32V(obj, nodePtr) && obj.segment) {
if (!s->resmgr->testResource(ResourceId(kResourceTypeSound, number))) {
- warning("Could not open song number %d", number);
- // Send a "stop handle" event so that the engine won't wait forever here
- s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
- PUT_SEL32V(obj, signal, -1);
+ // Check if the resource exists as an audio resource - this can happen
+ // in SQ4CD and perhaps other games as well. If the resource exists, play
+ // it using map 65535 (sound effects map).
+ if (s->resmgr->testResource(ResourceId(kResourceTypeAudio, number))) {
+ // Found a relevant audio resource, play it
+ PUT_SEL32V(obj, signal, s->_sound.startAudio(65535, number));
+ } else {
+ warning("Could not open song number %d", number);
+ // Send a "stop handle" event so that the engine won't wait forever here
+ s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
+ PUT_SEL32V(obj, signal, -1);
+ }
return s->r_acc;
}
@@ -966,6 +974,9 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return s->r_acc;
}
+/**
+ * Used for synthesized music playback
+ */
reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (s->_kernel->_selectorMap.setVol != -1)
return kDoSound_SCI1(s, funct_nr, argc, argv);
@@ -975,7 +986,9 @@ reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return kDoSound_SCI0(s, funct_nr, argc, argv);
}
-// Used for speech playback in CD games
+/**
+ * Used for speech playback and digital soundtracks in CD games
+ */
reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) {
Audio::Mixer *mixer = g_system->getMixer();