diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2004-12-22 14:49:06 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2004-12-22 14:49:06 +0000 |
commit | a788c9ae61841784bf94d280e07a7031f30f7ba8 (patch) | |
tree | 766fe5bb32135a1a50953a982b6043ec3c4eb2e8 /sys | |
parent | c1c570fcdacaad7f853aec374b60a76b1fc5552e (diff) | |
download | gst-plugins-bad-a788c9ae61841784bf94d280e07a7031f30f7ba8.tar.gz gst-plugins-bad-a788c9ae61841784bf94d280e07a7031f30f7ba8.tar.bz2 gst-plugins-bad-a788c9ae61841784bf94d280e07a7031f30f7ba8.zip |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sunaudio/gstsunmixer.c | 13 |
1 files changed, 9 insertions, 4 deletions
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; } |