[gnome-control-center] sound: Use upstream value for amplified volume



commit a9555f52d0b22413eb8f63a49d8bc3503ca5e228
Author: Colin Guthrie <cguthrie mandriva org>
Date:   Fri Mar 11 15:45:57 2011 +0000

    sound: Use upstream value for amplified volume
    
    In order to standardise various separate volume UIs,
    upstream PulseAudio has made a new define available for the
    recommended
    maximum volume to show in UIs. This volume was chosen to be
    similar to the value currently employed in gvc but also be
    based on dB values rather than a multiple of PA_VOLUME_NORM.
    
    The 150% value previously used mapped to +10.57dB with the
    current cubic volume mapping. In the interests of sanity,
    and with a tip of the hat to Spinal Tap, we decreed that the
    value should be +11dB. This is approx 153% which is doesn't really
    change the visual look of GVC.
    
    I will also be recommending other volume controls use this new
    value so everyone can use the mixer they want.
    
    This one goes up to 11. :)
    
    References:
    https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-April/006945.html
    https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-April/006950.html
    http://en.wikipedia.org/wiki/Up_to_eleven
    
    https://bugzilla.gnome.org/show_bug.cgi?id=644292

 panels/sound/gvc-channel-bar.c   |    5 +++--
 panels/sound/gvc-mixer-control.c |   17 +++++++++++++++++
 panels/sound/gvc-mixer-control.h |    3 +++
 3 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/panels/sound/gvc-channel-bar.c b/panels/sound/gvc-channel-bar.c
index 089088d..88230e7 100644
--- a/panels/sound/gvc-channel-bar.c
+++ b/panels/sound/gvc-channel-bar.c
@@ -32,10 +32,11 @@
 #include <canberra-gtk.h>
 
 #include "gvc-channel-bar.h"
+#include "gvc-mixer-control.h"
 
 #define SCALE_SIZE 128
-#define ADJUSTMENT_MAX_NORMAL 65536.0 /* PA_VOLUME_NORM */
-#define ADJUSTMENT_MAX_AMPLIFIED 98304.0 /* 1.5 * ADJUSTMENT_MAX_NORMAL */
+#define ADJUSTMENT_MAX_NORMAL gvc_mixer_control_get_vol_max_norm(NULL)
+#define ADJUSTMENT_MAX_AMPLIFIED gvc_mixer_control_get_vol_max_amplified(NULL)
 #define ADJUSTMENT_MAX (bar->priv->is_amplified ? ADJUSTMENT_MAX_AMPLIFIED : ADJUSTMENT_MAX_NORMAL)
 #define SCROLLSTEP (ADJUSTMENT_MAX / 100.0 * 5.0)
 
diff --git a/panels/sound/gvc-mixer-control.c b/panels/sound/gvc-mixer-control.c
index 5a90db4..0e64165 100644
--- a/panels/sound/gvc-mixer-control.c
+++ b/panels/sound/gvc-mixer-control.c
@@ -2239,3 +2239,20 @@ gvc_mixer_control_new (const char *name)
                                 NULL);
         return GVC_MIXER_CONTROL (control);
 }
+
+/* FIXME: Remove when PA 0.9.23 is used */
+#ifndef PA_VOLUME_UI_MAX
+#define PA_VOLUME_UI_MAX pa_sw_volume_from_dB(+11.0)
+#endif
+
+gdouble
+gvc_mixer_control_get_vol_max_norm (GvcMixerControl *control)
+{
+	return (gdouble) PA_VOLUME_NORM;
+}
+
+gdouble
+gvc_mixer_control_get_vol_max_amplified (GvcMixerControl *control)
+{
+	return (gdouble) PA_VOLUME_UI_MAX;
+}
diff --git a/panels/sound/gvc-mixer-control.h b/panels/sound/gvc-mixer-control.h
index d32b204..3aa2c94 100644
--- a/panels/sound/gvc-mixer-control.h
+++ b/panels/sound/gvc-mixer-control.h
@@ -91,6 +91,9 @@ gboolean            gvc_mixer_control_set_default_sink     (GvcMixerControl *con
 gboolean            gvc_mixer_control_set_default_source   (GvcMixerControl *control,
                                                             GvcMixerStream  *stream);
 
+gdouble             gvc_mixer_control_get_vol_max_norm      (GvcMixerControl *control);
+gdouble             gvc_mixer_control_get_vol_max_amplified (GvcMixerControl *control);
+
 G_END_DECLS
 
 #endif /* __GVC_MIXER_CONTROL_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]