summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--sys/sunaudio/gstsunmixer.c13
2 files changed, 18 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 7214a707..cea25303 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-12-22 Archana Shah <archana.shah@wipro.com>
+
+ Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+
+ * sys/sunaudio/gstsunmixer.c: (gst_sunaudiomixer_set_volume):
+ Normalizing the value before setting
+ (gst_sunaudiomixer_get_volume):
+ Normalizing the value after getting. Fixes bug# 161980
+
2004-12-22 Christian Fredrik Kalager Schaller <uraeus@gnome.org>
* Makefile.am: Make sure docs gets disted
diff --git a/sys/sunaudio/gstsunmixer.c b/sys/sunaudio/gstsunmixer.c
index 6f0db25e..29135858 100644
--- a/sys/sunaudio/gstsunmixer.c
+++ b/sys/sunaudio/gstsunmixer.c
@@ -52,6 +52,7 @@ static void gst_sunaudiomixer_set_record (GstMixer * sunaudiomixer,
GstMixerTrack * track, gboolean record);
#define MIXER_DEVICES 3
+#define SCALE_FACTOR 2.55 /* 255/100 */
static gchar **labels = NULL;
static GstMixerTrackClass *parent_class = NULL;
@@ -211,7 +212,8 @@ gst_sunaudiomixer_set_volume (GstMixer * mixer,
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIOMIXER_TRACK (track);
g_return_if_fail (sunaudio->mixer_fd != -1);
- volume = (volumes[0] * 255) / 100;
+
+ volume = volumes[0] * SCALE_FACTOR + 0.5;
/* Set the volume */
AUDIO_INITINFO (&audioinfo);
@@ -253,13 +255,16 @@ gst_sunaudiomixer_get_volume (GstMixer * mixer,
switch (sunaudiotrack->track_num) {
case 0:
- sunaudiotrack->lvol = volumes[0] = (audioinfo.play.gain * 100) / 255;
+ sunaudiotrack->lvol = volumes[0] =
+ (audioinfo.play.gain / SCALE_FACTOR) + 0.5;
break;
case 1:
- sunaudiotrack->lvol = volumes[0] = (audioinfo.record.gain * 100) / 255;
+ sunaudiotrack->lvol = volumes[0] =
+ (audioinfo.record.gain / SCALE_FACTOR) + 0.5;
break;
case 2:
- sunaudiotrack->lvol = volumes[0] = (audioinfo.monitor_gain * 100) / 255;
+ sunaudiotrack->lvol = volumes[0] =
+ (audioinfo.monitor_gain / SCALE_FACTOR) + 0.5;
break;
}