From 9f2c0bedf4cbe4152e449454d659ea907fa00246 Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Sat, 25 Oct 2014 12:43:57 +0200 Subject: alsa: Make sure the global volume is correct after changing a single channel volume and that the channel volume is within limits --- backends/alsa/alsa-stream-control.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backends/alsa/alsa-stream-control.c b/backends/alsa/alsa-stream-control.c index b5500d1..b60d50f 100644 --- a/backends/alsa/alsa-stream-control.c +++ b/backends/alsa/alsa-stream-control.c @@ -454,6 +454,8 @@ alsa_stream_control_set_channel_volume (MateMixerStreamControl *mmsc, guint chan if (control->priv->data.volume_joined == TRUE) return alsa_stream_control_set_volume (mmsc, volume); + volume = CLAMP (volume, control->priv->data.min, control->priv->data.max); + if (volume != control->priv->data.v[channel]) { AlsaStreamControlClass *klass; @@ -468,9 +470,11 @@ alsa_stream_control_set_channel_volume (MateMixerStreamControl *mmsc, guint chan if (klass->set_channel_volume (control, c, volume) == FALSE) return FALSE; - // XXX recalc total volume control->priv->data.v[channel] = volume; + /* The global volume is always set to the highest channel volume */ + control->priv->data.volume = MAX (control->priv->data.volume, volume); + g_object_notify (G_OBJECT (control), "volume"); } return TRUE; -- cgit v1.2.1