diff options
author | Michal Ratajsky <[email protected]> | 2015-12-10 02:17:45 +0100 |
---|---|---|
committer | Michal Ratajsky <[email protected]> | 2015-12-10 02:17:45 +0100 |
commit | d62f85c3dc4f8de5fe5a59908cef705b9d0a3440 (patch) | |
tree | 5649627b2cdab66fd2820f8918c7fd75ec82dd84 /backends/pulse/pulse-stream-control.c | |
parent | a64722f0eff22f9ba8af3999bfb168d9b020ddd8 (diff) | |
download | libmatemixer-d62f85c3dc4f8de5fe5a59908cef705b9d0a3440.tar.bz2 libmatemixer-d62f85c3dc4f8de5fe5a59908cef705b9d0a3440.tar.xz |
pulse: Fix volume limits as described on the PulseAudio wiki
Diffstat (limited to 'backends/pulse/pulse-stream-control.c')
-rw-r--r-- | backends/pulse/pulse-stream-control.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/backends/pulse/pulse-stream-control.c b/backends/pulse/pulse-stream-control.c index 3da3221..bc59c97 100644 --- a/backends/pulse/pulse-stream-control.c +++ b/backends/pulse/pulse-stream-control.c @@ -665,9 +665,24 @@ pulse_stream_control_get_min_volume (MateMixerStreamControl *mmsc) static guint pulse_stream_control_get_max_volume (MateMixerStreamControl *mmsc) { + MateMixerStreamControlFlags flags; + g_return_val_if_fail (PULSE_IS_STREAM_CONTROL (mmsc), (guint) PA_VOLUME_MUTED); - return (guint) PA_VOLUME_UI_MAX; + flags = mate_mixer_stream_control_get_flags (mmsc); + + /* + * From PulseAudio wiki: + * For all volumes that are > PA_VOLUME_NORM (i.e. beyond the maximum volume + * setting of the hw) PA will do digital amplification. This works only for + * devices that have PA_SINK_DECIBEL_VOLUME/PA_SOURCE_DECIBEL_VOLUME set. For + * devices that lack this flag do not extend the volume slider like this, it + * will not have any effect. + */ + if (flags & MATE_MIXER_STREAM_CONTROL_HAS_DECIBEL) + return (guint) PA_VOLUME_UI_MAX; + else + return (guint) PA_VOLUME_NORM; } static guint @@ -688,7 +703,7 @@ pulse_stream_control_get_base_volume (MateMixerStreamControl *mmsc) control = PULSE_STREAM_CONTROL (mmsc); if (control->priv->base_volume > 0) - return control->priv->base_volume; + return (guint) control->priv->base_volume; else return (guint) PA_VOLUME_NORM; } |