[Scummvm-cvs-logs] CVS: scummvm/sword1 music.cpp,1.21,1.22

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Wed Jan 14 00:10:01 CET 2004


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv8518

Modified Files:
	music.cpp 
Log Message:
Changed the music fading so that the volume is increased when ABS(_fading)
grows larger, both when fading up and down. This fixes the problem where
the volume would "jump" when changing the fading "direction" of a stream.


Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/music.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- music.cpp	11 Jan 2004 16:53:33 -0000	1.21
+++ music.cpp	14 Jan 2004 08:09:03 -0000	1.22
@@ -45,7 +45,7 @@
 	if (_fading > 0)
 		_fading = -_fading;
 	else if (_fading == 0)
-		_fading = -(FADE_LENGTH * getRate());
+		_fading = -1;
 	_fadeSamples = FADE_LENGTH * getRate();
 }
 
@@ -74,8 +74,10 @@
 			}
 			sample = (sample * _fading) / _fadeSamples;
 		} else if (_fading < 0) {
-			_fading++;
-			sample = (sample * (_fadeSamples + _fading)) / _fadeSamples;
+			_fading--;
+			sample = -(sample * _fading) / _fadeSamples;
+			if (_fading == -_fadeSamples)
+				_fading = 0;
 		}
 		*buffer++ = sample;
 	}





More information about the Scummvm-git-logs mailing list