[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,1.91,1.91.2.1 imuse.h,1.19,1.19.2.1 resource.cpp,1.27,1.27.2.1 sound.cpp,1.53,1.53.2.1 sound.h,1.18,1.18.2.1
Max Horn
fingolfin at users.sourceforge.net
Thu Dec 5 14:18:07 CET 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,1.91,1.92 imuse.h,1.19,1.20 resource.cpp,1.28,1.29 sound.h,1.18,1.19 sound.cpp,1.53,1.54
- Next message: [Scummvm-cvs-logs] CVS: scummvm/simon items.cpp,1.32,1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv780/scumm
Modified Files:
Tag: branch-0-3-0
imuse.cpp imuse.h resource.cpp sound.cpp sound.h
Log Message:
Jamieson's fix from the trunk
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 1.91
retrieving revision 1.91.2.1
diff -u -d -r1.91 -r1.91.2.1
--- imuse.cpp 3 Dec 2002 17:54:25 -0000 1.91
+++ imuse.cpp 5 Dec 2002 22:17:53 -0000 1.91.2.1
@@ -103,6 +103,7 @@
int stop_sound(int sound) { in(); int ret = _target->stop_sound (sound); out(); return ret; }
int stop_all_sounds() { in(); int ret = _target->stop_all_sounds(); out(); return ret; }
int get_sound_status(int sound) { in(); int ret = _target->get_sound_status (sound); out(); return ret; }
+ bool get_sound_active(int sound) { in(); bool ret = _target->get_sound_active (sound); out(); return ret; }
int32 do_command(int a, int b, int c, int d, int e, int f, int g, int h) { in(); int32 ret = _target->do_command (a,b,c,d,e,f,g,h); out(); return ret; }
int clear_queue() { in(); int ret = _target->clear_queue(); out(); return ret; }
void setBase(byte **base) { in(); _target->setBase (base); out(); }
@@ -487,6 +488,7 @@
int stop_sound(int sound);
int stop_all_sounds();
int get_sound_status(int sound);
+ bool get_sound_active(int sound);
int32 do_command(int a, int b, int c, int d, int e, int f, int g, int h);
int clear_queue();
void setBase(byte **base);
@@ -715,14 +717,14 @@
int32 size, pos;
if (_base_sounds) {
- // FIXME: This is a hack to make certain parts of Sam & Max work.
- // It's a NASTY HACK because it has to specifically skip sound 1.
- // For some reason (maybe a script parse bug?), sound 1 is being
- // played at the very beginning (opening logo). Until this "fix",
- // the sound was never found and thus never played. It SHOULDN'T
- // be played.
- if (!_base_sounds[sound] && (sound > 1 || g_scumm->_gameId != GID_SAMNMAX))
- g_scumm->ensureResourceLoaded (rtSound, sound);
+ // The following hack was commented out because calling
+ // ensureResourceLoaded() is not safe from within this
+ // function. TODO: Make sure all Sam & Max music still works
+ // without this hack. It's very likely that changes to the
+ // resource expiration process solved whatever S&M problem
+ // this hack was originally intended to address.
+// if (!_base_sounds[sound] && (sound > 1 || g_scumm->_gameId != GID_SAMNMAX))
+// g_scumm->ensureResourceLoaded (rtSound, sound);
ptr = _base_sounds[sound];
}
@@ -1162,6 +1164,21 @@
return get_queue_sound_status(sound);
}
+// This is exactly the same as get_sound_status except that
+// it treats sounds that are fading out just the same as
+// other sounds. This is the method to use when determining
+// what resources to expire from memory.
+bool IMuseInternal::get_sound_active(int sound)
+{
+ int i;
+ Player *player;
+ for (i = ARRAYSIZE(_players), player = _players; i != 0; i--, player++) {
+ if (player->_active && player->_id == (uint16)sound)
+ return 1;
+ }
+ return (get_queue_sound_status(sound) != 0);
+}
+
int IMuseInternal::get_queue_sound_status(int sound)
{
uint16 *a;
@@ -2266,11 +2283,11 @@
return;
}
}
- warning ("Could not find appropriate MT-32 program for GM program %d", (int) a);
+ warning ("Could not map MT-32 \"%s\" to GM %d", buf, (int) a);
return;
}
}
- warning ("Could not find appropriate GM program for MT-32 custom instrument \"%s\"", buf);
+ warning ("MT-32 instrument \"%s\" not supported yet", buf);
}
} else {
warning ("Unknown SysEx manufacturer 0x%02X", (int) a);
@@ -2334,7 +2351,10 @@
break;
maybe_jump (p[0], p[1] - 1, (read_word (p + 2) - 1) * 4 + p[4], ((p[5] * _ticks_per_beat) >> 2) + p[6]);
break;
-
+
+ case 2: // Start of song. Ignore for now.
+ break;
+
case 16: /* set instrument in part */
a = *p++ & 0x0F;
if (_se->_hardware_type != *p++ && false)
Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.h,v
retrieving revision 1.19
retrieving revision 1.19.2.1
diff -u -d -r1.19 -r1.19.2.1
--- imuse.h 7 Nov 2002 07:03:37 -0000 1.19
+++ imuse.h 5 Dec 2002 22:17:53 -0000 1.19.2.1
@@ -50,6 +50,7 @@
virtual int stop_sound(int sound) = 0;
virtual int stop_all_sounds() = 0;
virtual int get_sound_status(int sound) = 0;
+ virtual bool get_sound_active(int sound) = 0;
virtual int32 do_command(int a, int b, int c, int d, int e, int f, int g, int h) = 0;
virtual int clear_queue() = 0;
virtual void setBase(byte **base) = 0;
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.27
retrieving revision 1.27.2.1
diff -u -d -r1.27 -r1.27.2.1
--- resource.cpp 29 Nov 2002 15:13:23 -0000 1.27
+++ resource.cpp 5 Dec 2002 22:17:54 -0000 1.27.2.1
@@ -1354,7 +1354,7 @@
case rtCostume:
return isCostumeInUse(i);
case rtSound:
- return _sound->isSoundRunning(i) != 0;
+ return _sound->isSoundActive(i);
default:
return false;
}
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.53
retrieving revision 1.53.2.1
diff -u -d -r1.53 -r1.53.2.1
--- sound.cpp 19 Nov 2002 01:52:22 -0000 1.53
+++ sound.cpp 5 Dec 2002 22:17:54 -0000 1.53.2.1
@@ -587,6 +587,39 @@
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];
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -d -r1.18 -r1.18.2.1
--- sound.h 5 Nov 2002 13:56:31 -0000 1.18
+++ sound.h 5 Dec 2002 22:17:54 -0000 1.18.2.1
@@ -144,6 +144,7 @@
void stopTalkSound();
bool isMouthSyncOff(uint pos);
int isSoundRunning(int sound);
+ bool isSoundActive(int sound);
bool isSoundInQueue(int sound);
void stopSound(int a);
void stopAllSounds();
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,1.91,1.92 imuse.h,1.19,1.20 resource.cpp,1.28,1.29 sound.h,1.18,1.19 sound.cpp,1.53,1.54
- Next message: [Scummvm-cvs-logs] CVS: scummvm/simon items.cpp,1.32,1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list