When pressing the mute button after the volume slider is manually moved
to 0 (and so the GVS "is-muted" property is still FALSE), set the volume
to 25% instead of actually muting the stream.
Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/520.
The logic inside it is a bit reworked to make it more consistent. The
mute button and the slider now only communicate directly with GVC. The
notify callbacks are now used to change the UI states.
This fixes the UI problem of the mute button being "raised" when pressed
(see https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/520).
In the ubuntu 20.04, we met an issue about the output volume-slider
on the machine with the legacy HDA audio driver, the output device
is the Speaker first (analog-stereo pa sink), then we connect a hdmi
monitor, the HDMI audio is in the output combo-box, we select the
hdmi audio (hdmi-stereo pa sink) from the combo-box, the hdmi audio
becomes the active output device now, we adjust the output volume from
the volume-slider, the slider UI is changed, but the output sound
is not changed with the UI.
The root cause is when the speaker is active, the pulseaudio only
keeps the analog-stereo sink, the sink hdmi-stereo is unlinked, when
users select the hdmi audio from UI, the pulseaudio will unlink
analo-stereo sink and create hdmi-stereo sink, but before hdmi-stereo
is created, the output_device_changed_cb() is called and
gvc_mixer_control_get_stream_from_device() returns a NULL since the
hdmi-stereo sink is not created yet in the pulseaudio. Because stream
is NULL, the output_volume_slider->stream is NULL, users can't change
the output volume via the volume-slider.
To fix it, we add a output_volume_slider->stream check in the
device_update_cb(), if it is NULL, get the stream and set it to
volume-slider. In this function, the sink hdmi-stereo is created
already, so the stream is not NULL. And this change also applies to
input as well.
Signed-off-by: Hui Wang <hui.wang@canonical.com>
The icon on the mute button needs to be updated whenever the volume is
changed (externally). Add the appropriate call too notify_volume_cb.
Fixes: #1268
If changed externally at least, the volume can be zero while unmuted.
Just use the lowest volume icon in that case by including it in the
range.
It does not make sense to use the muted icon, as we are not technically
muted and the toggle button is not active.
The same way that GNOME Shell does it, we set:
* audio-volume-muted-symbolic when mute button is toggled*
* audio-volume-low-symbolic when 0 < volume < 30%
* audio-volume-medium-symbolic when 30% < volume < 70%
* audio-volume-high-symbolic when 70% < volume <= 100%
When "muted" we can't actually rely on volume (it can be close
to zero but not absolute zero). Instead of requiring volume == 0,
we track the state based on whether the mute button is active.
Fixes#521
Since 9d612ff1c7 this is required,
otherwise we never set up the GtkAdjustment and so the scales don't
display any values or widget to make adjustments, meaning they can't be
used.
Also call `notify_volume_cb()` from `update_ranges()` to initialise the
adjustment, since when we set the mixer control we now might not have
set the value.
Closes#652
GVC added additional checks that break where we were using a NULL value instead
of a GvcMixerControl. Solution is to pass this object where appropriate.
(gnome-control-center:833): Gvc-CRITICAL **: 11:09:33.818: gvc_mixer_control_get_vol_max_norm: assertion 'GVC_IS_MIXER_CONTROL (control)' failed
Fixes#636
The current code does not differenciate between input and
output, and thus it shows the same icon for muting outputs
and inputs. As per design suggesion [1], the input row
should use the "microphone-sensitivity-muted-symbolic" icon.
In order to achieve that, move the CcLevelBarStreamType enum
to a separate header, and rename it to CcStreamType. And also
pass the stream type to the volume slider.
In CcVolumeSlider, update the code to switch to the correct
mute icon depending on the stream type.
[1] https://gitlab.gnome.org/GNOME/gnome-control-center/issues/539
Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/539