summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2014-10-25 12:43:57 +0200
committerMichal Ratajsky <[email protected]>2014-10-25 12:43:57 +0200
commit9f2c0bedf4cbe4152e449454d659ea907fa00246 (patch)
treea7d5c6889a48410d89a3eda9f74e66e833c106ee /backends
parent9a5abbc4d30d833f6731a2f86f9882797d4af0ee (diff)
downloadlibmatemixer-9f2c0bedf4cbe4152e449454d659ea907fa00246.tar.bz2
libmatemixer-9f2c0bedf4cbe4152e449454d659ea907fa00246.tar.xz
alsa: Make sure the global volume is correct after changing a single channel volume and that the channel volume is within limits
Diffstat (limited to 'backends')
-rw-r--r--backends/alsa/alsa-stream-control.c6
1 files changed, 5 insertions, 1 deletions
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;