[Scummvm-cvs-logs] CVS: scummvm/sound imuse.cpp,1.41,1.42

Max Horn fingolfin at users.sourceforge.net
Mon Jul 29 09:13:03 CEST 2002


Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv8200

Modified Files:
	imuse.cpp 
Log Message:
fixed imuse volume bug introduced recently by me and painelf - iMuse internally does require the 0-127 change

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/imuse.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- imuse.cpp	28 Jul 2002 15:03:45 -0000	1.41
+++ imuse.cpp	29 Jul 2002 16:12:15 -0000	1.42
@@ -400,6 +400,8 @@
 	void lock();
 	void unlock();
 
+	int set_master_volume_intern(uint vol);
+
 public:
 	Part *parts_ptr() {
 		return _parts;
@@ -1264,13 +1266,8 @@
 	return 0;
 }
 
-int IMuseInternal::set_master_volume(uint vol)
+int IMuseInternal::set_master_volume_intern(uint vol)
 {
-	int i;
-
-	// recalibrate from 0-256 range
-	vol = vol * 127 / 256;
-
 	if (vol > 127)
 		return -1;
 
@@ -1278,12 +1275,21 @@
 		vol = vol * _music_volume / 128;
 
 	_master_volume = vol;
-	for (i = 0; i != 8; i++)
+	for (int i = 0; i != 8; i++)
 		_channel_volume_eff[i] = (_channel_volume[i] + 1) * vol >> 7;
 	update_volumes();
+
 	return 0;
 }
 
+int IMuseInternal::set_master_volume(uint vol)
+{
+	// recalibrate from 0-256 range
+	vol = vol * 127 / 256;
+
+	return set_master_volume_intern(vol);
+}
+
 int IMuseInternal::get_master_volume()
 {
 	// recalibrate to 0-256 range
@@ -1334,9 +1340,9 @@
 	if (param == 0) {
 		switch (cmd) {
 		case 6:
-			return set_master_volume(b);
+			return set_master_volume_intern(b);
 		case 7:
-			return get_master_volume();
+			return _master_volume;
 		case 8:
 			return start_sound(b) ? 0 : -1;
 		case 9:





More information about the Scummvm-git-logs mailing list