gnome-applets r10811 - trunk/mixer
- From: callum svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-applets r10811 - trunk/mixer
- Date: Fri, 25 Apr 2008 05:09:05 +0100 (BST)
Author: callum
Date: Fri Apr 25 04:09:05 2008
New Revision: 10811
URL: http://svn.gnome.org/viewvc/gnome-applets?rev=10811&view=rev
Log:
Mixer applet math fix.
Modified:
trunk/mixer/ChangeLog
trunk/mixer/applet.c
trunk/mixer/preferences.c
Modified: trunk/mixer/applet.c
==============================================================================
--- trunk/mixer/applet.c (original)
+++ trunk/mixer/applet.c Fri Apr 25 04:09:05 2008
@@ -997,7 +997,7 @@
g_free (volumes);
j /= track->num_channels;
- return 100 * j / (track->max_volume - track->min_volume);
+ return 100 * (j - track->min_volume) / (track->max_volume - track->min_volume);
}
/*
Modified: trunk/mixer/preferences.c
==============================================================================
--- trunk/mixer/preferences.c (original)
+++ trunk/mixer/preferences.c Fri Apr 25 04:09:05 2008
@@ -357,14 +357,20 @@
gnome_volume_applet_get_volume (GstMixer *mixer, GstMixerTrack *track)
{
int *volumes, main_volume, range;
-
+
+ if (track->num_channels == 0)
+ return 0;
+
volumes = g_new (gint, track->num_channels);
gst_mixer_get_volume (mixer, track, volumes);
main_volume = volumes[0];
g_free (volumes);
range = track->max_volume - track->min_volume;
- return 100 * main_volume / range;
+ if (range == 0)
+ return 0;
+
+ return 100 * (main_volume - track->min_volume) / range;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]