aboutsummaryrefslogtreecommitdiff
path: root/scumm/sound.cpp
diff options
context:
space:
mode:
authorJamieson Christian2002-12-05 21:45:55 +0000
committerJamieson Christian2002-12-05 21:45:55 +0000
commit50b69cb2dbbffb0e067416aa7aca84833381b1a7 (patch)
treeaf92da7cf5eedafae1f15cf0be1c4745ee13bf9f /scumm/sound.cpp
parent632f44a1a41a9da360dd1cac3e8cb3ff315527ca (diff)
downloadscummvm-rg350-50b69cb2dbbffb0e067416aa7aca84833381b1a7.tar.gz
scummvm-rg350-50b69cb2dbbffb0e067416aa7aca84833381b1a7.tar.bz2
scummvm-rg350-50b69cb2dbbffb0e067416aa7aca84833381b1a7.zip
Fixed inappropriate expiration of sound resources,
which fixes concurrency issues esp. in PocketPC and MorphOS. Stubbed SysEx command 2 (start of song) to get rid of annoying warning. Changed MT-32 instrument warnings to fit on one (80-char) line. svn-id: r5842
Diffstat (limited to 'scumm/sound.cpp')
-rw-r--r--scumm/sound.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index dec8eb0aff..3e1c24aac7 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -587,6 +587,39 @@ int Sound::isSoundRunning(int sound) {
return se->get_sound_status(sound);
}
+// This is exactly the same as isSoundRunning except that it
+// calls IMuse::get_sound_active() instead of IMuse::get_sound_status().
+// This is necessary when determining what resources to
+// expire from memory.
+bool Sound::isSoundActive(int sound) {
+ IMuse *se;
+ int i;
+
+ if (sound == _scumm->current_cd_sound)
+ return pollCD() != 0;
+
+ i = _soundQue2Pos;
+ while (i--) {
+ if (_soundQue2[i] == sound)
+ return true;
+ }
+
+ if (isSoundInQueue(sound))
+ return true;
+
+ if (!_scumm->isResourceLoaded(rtSound, sound))
+ return false;
+
+ if (_scumm->_imuseDigital) {
+ return _scumm->_imuseDigital->getSoundStatus(sound) != 0;
+ }
+
+ se = _scumm->_imuse;
+ if (!se)
+ return false;
+ return se->get_sound_active(sound);
+}
+
bool Sound::isSoundInQueue(int sound) {
int i = 0, j, num;
int16 table[16];