sys/sunaudio/gstsunmixer.c: Normalizing the value before setting

Original commit message from CVS:
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
This commit is contained in:
Ronald S. Bultje 2004-12-22 14:49:06 +00:00
parent c1c570fcda
commit a788c9ae61
2 changed files with 18 additions and 4 deletions

View file

@ -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> 2004-12-22 Christian Fredrik Kalager Schaller <uraeus@gnome.org>
* Makefile.am: Make sure docs gets disted * Makefile.am: Make sure docs gets disted

View file

@ -52,6 +52,7 @@ static void gst_sunaudiomixer_set_record (GstMixer * sunaudiomixer,
GstMixerTrack * track, gboolean record); GstMixerTrack * track, gboolean record);
#define MIXER_DEVICES 3 #define MIXER_DEVICES 3
#define SCALE_FACTOR 2.55 /* 255/100 */
static gchar **labels = NULL; static gchar **labels = NULL;
static GstMixerTrackClass *parent_class = NULL; static GstMixerTrackClass *parent_class = NULL;
@ -211,7 +212,8 @@ gst_sunaudiomixer_set_volume (GstMixer * mixer,
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIOMIXER_TRACK (track); GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIOMIXER_TRACK (track);
g_return_if_fail (sunaudio->mixer_fd != -1); g_return_if_fail (sunaudio->mixer_fd != -1);
volume = (volumes[0] * 255) / 100;
volume = volumes[0] * SCALE_FACTOR + 0.5;
/* Set the volume */ /* Set the volume */
AUDIO_INITINFO (&audioinfo); AUDIO_INITINFO (&audioinfo);
@ -253,13 +255,16 @@ gst_sunaudiomixer_get_volume (GstMixer * mixer,
switch (sunaudiotrack->track_num) { switch (sunaudiotrack->track_num) {
case 0: case 0:
sunaudiotrack->lvol = volumes[0] = (audioinfo.play.gain * 100) / 255; sunaudiotrack->lvol = volumes[0] =
(audioinfo.play.gain / SCALE_FACTOR) + 0.5;
break; break;
case 1: case 1:
sunaudiotrack->lvol = volumes[0] = (audioinfo.record.gain * 100) / 255; sunaudiotrack->lvol = volumes[0] =
(audioinfo.record.gain / SCALE_FACTOR) + 0.5;
break; break;
case 2: case 2:
sunaudiotrack->lvol = volumes[0] = (audioinfo.monitor_gain * 100) / 255; sunaudiotrack->lvol = volumes[0] =
(audioinfo.monitor_gain / SCALE_FACTOR) + 0.5;
break; break;
} }