[Scummvm-cvs-logs] CVS: scummvm/sword1 music.cpp,1.23,1.23.2.1
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Sat Mar 13 04:10:00 CET 2004
Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv739
Modified Files:
Tag: branch-0-6-0
music.cpp
Log Message:
When both music channels are playing, and a third piece of music starts,
silence the channel that appears to be closest to silence already. Not
simply the one that happens to be fading down.
This is the same method as I used in BS2, and it might fix some music
glitches I heard at Club Alamut.
Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/music.cpp,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -u -d -r1.23 -r1.23.2.1
--- music.cpp 14 Jan 2004 18:39:24 -0000 1.23
+++ music.cpp 13 Mar 2004 12:00:24 -0000 1.23.2.1
@@ -154,12 +154,27 @@
if (strlen(_tuneList[tuneId]) > 0) {
int newStream = 0;
if (_handles[0].streaming() && _handles[1].streaming()) {
- // If both handles are playing, stop the one that's
- // fading down.
- if (_handles[0].fading() > 0)
- _handles[0].stop();
- else
- _handles[1].stop();
+ int streamToStop;
+ // Both streams playing - one must be forced to stop.
+ if (!_handles[0].fading() && !_handles[1].fading()) {
+ // None of them are fading. Shouldn't happen,
+ // so it doesn't matter which one we pick.
+ streamToStop = 0;
+ } else if (_handles[0].fading() && !_handles[1].fading()) {
+ // Stream 0 is fading, so pick that one.
+ streamToStop = 0;
+ } else if (!_handles[0].fading() && _handles[1].fading()) {
+ // Stream 1 is fading, so pick that one.
+ streamToStop = 1;
+ } else {
+ // Both streams are fading. Pick the one that
+ // is closest to silent.
+ if (ABS(_handles[0].fading()) < ABS(_handles[1].fading()))
+ streamToStop = 0;
+ else
+ streamToStop = 1;
+ }
+ _handles[streamToStop].stop();
}
if (_handles[0].streaming()) {
_handles[0].fadeDown();
More information about the Scummvm-git-logs
mailing list