Commit graph

201 commits

Author SHA1 Message Date
Hui Wang
0f18a662be sound: update the volume-slider after getting a valid stream
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>
2021-08-01 22:12:11 +00:00
Mohammed Sadiq
7c575b8ccf sound: Use content style for listboxes 2021-05-19 03:25:47 +00:00
Benjamin Berg
a87dee7911 sound: Update mute button icon when volume changes
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
2021-02-21 15:30:40 +00:00
Benjamin Berg
4b8ff9f6f3 sound: Include zero volume in lowest volume icon
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.
2021-02-21 15:30:39 +00:00
Arne
9225cd9364 sound: fix subwoofer slider 2020-09-25 01:53:44 +00:00
Hui Wang
9b81e0ee45 sound: update the profile list after getting the signal from gvc
In the ubuntu 20.04, we found a regression on HDMI audio. We plug a
HDMI/DP monitor, the output device is the speaker in the output device
combo box, then we select the HDMI from the combo box, the output
device is switched to HDMI audio successfully, but the configuration
box is empty. This will not happen in the ubuntu 18.04, the profile
will show hdmi-stereo in this situation. So I think this is a
regression.

When problem happens, I could see the errors from log:
Gvc:    DEBUG: Matching profile for 'output:analog-stereo' is '(null)'
Gvc:    DEBUG: Matching profile for 'output:analog-stereo' is '(null)'
Gvc:    DEBUG: Matching profile for 'output:analog-stereo' is '(null)'

Through debugging, I found the cc_profile_combo_box_set_device() is
called too early. In the ubuntu 18.04, this function is called after
pulseaudio changes the active_profile, but in the ubuntu 20.04, it is
called ahead of pulseaudio changes the active_profile.

To fix it, add a signal callback function, after pulseaudio changes
the active_profile, this callback function will be called, then call
cc_profile_combo_box_set_device().

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2020-09-16 09:10:02 +12:00
Adrien Plazas
f06379e30c Replace HdyColumn by HdyClamp
In libhandy 1, HdyClamp replaces HdyColumn. This stops setting values
when they match HdyClamp's defaults.
2020-07-20 08:04:28 +02:00
Robert Ancell
d9ea45354e sound: Stop non-interactive profile changes from triggering changed events
Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1033
2020-06-17 19:29:57 +00:00
Robert Ancell
7a65d113f2 sound: Remove unused files
These were accidentally added as part of ths sound panel redesign.
2020-03-19 16:22:20 +13:00
Mohammed Sadiq
dfd4d42fd0 sound: Prefer symbolic icons for audio streams 2020-02-13 21:12:37 +00:00
Robert Ancell
cc4478d4f8 sound: Add missing subwoofer icons
These were accidentally dropped in the migration from the old panel to the new one.

Fixes #825
2020-01-07 20:49:12 +00:00
Georges Basile Stavracas Neto
5f640b9903 panel-list: Reorganize Devices section
Move the Power and Sound panel to there.
2020-01-06 15:15:30 +00:00
Felipe Borges
4180e75aad sound: Set audio icon based on volume
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
2019-12-18 12:00:02 +01:00
Robert Ancell
667fe61e78 sound: Replace ifdefs with #pragma once 2019-11-27 21:56:10 +00:00
Robert Ancell
ea22446ad1 sound: Remove reference to unused widget 2019-11-12 14:31:14 +13:00
Mart Raudsepp
389e7f59ae sound: Remove leftover canberra-gtk header inclusion
This may fail to build too, as we don't depend on canberra-gtk anymore,
and gsound only depends on canberra, not canberra-gtk.
2019-09-20 08:50:26 +03:00
Felipe Borges
be9d71ed6a sound: Use "avatar-default-symbolic" in sound test dialog
The colour icon blends with bright themes (such as Adwaita) making
it hard to distinguish.

The symbolic variant of the same asset contrasts fine with light
and dark background and matches the "symbolic" pattern of the other
two buttons shown in the dialog (the audio-volume-* icons).

Fixes #502
2019-09-17 10:33:38 +02:00
Iain Lane
ad39840066 sound: Pass a GvcMixerControl to the stream volume sliders
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
2019-09-09 15:23:32 +00:00
Robert Ancell
9d612ff1c7 sound: Fix volume sliders regression
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
2019-08-25 09:51:31 +00:00
Georges Basile Stavracas Neto
05b531ec28 sound: Remove unused variable 2019-06-16 01:01:36 +00:00
Jordan Petridis
b542e98359 sounds: Use correct mute icon in the input section
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
2019-06-16 01:01:36 +00:00
Georges Basile Stavracas Neto
a9f0248376 sound: Use fallback icon when stream's icon doesn't exist
Some streams may give us an icon name that doesn't exist in the
icon theme (e.g. Spotify giving "audio"). While it's fundamentally
an application problem, we can deal with this case a bit better
than showing the ugly "image-missing" icon.

Detect when an icon doesn't exist by performing an icon theme
lookup and, if the icon really doesn't exist, use a proper fallback
icon.

It also avoids a small GIcon leak.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/548
2019-06-16 01:01:36 +00:00
Georges Basile Stavracas Neto
e8bd7c24ee sound: Remove icon from sound theme buttons
Remove the icon and adjust the label to be vertically
centralized.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/549
2019-06-16 01:01:36 +00:00
Benjamin Berg
6872c767bb sound: Clean up labels of devices without origin
Sound devices may not have an origin, in that case we ended up with a
trailing " - " in the label which should not be there. Add a check that
the origin is non-null and not an empty string and only show the devices
description otherwise.
2019-05-22 17:19:26 +02:00
Bastien Nocera
d36cffa290 sound: Add "input" and "output" keywords to the panel 2019-05-14 01:55:59 +00:00
Robert Ancell
82ca937ecd sound: Fix crash when sound device set to NULL
This can occur during transitions.

Introduced in f081264.
2019-03-14 11:28:08 +13:00
Robert Ancell
f0812644ae sound: Apply device changes
Was missing the code to actually apply the changes.
2019-03-14 10:58:59 +13:00
Felipe Borges
de769bbe9b sound: Add shadow to application icons
The new GNOME application icons need a shadow when placed on top
of a light background.

See https://gitlab.gnome.org/GNOME/Initiatives/issues/2
2019-03-13 13:46:53 +01:00
Adrien Plazas
c74d28009c sound: Make the panel adaptive
Use a HdyColumn and ellipsize same labels so the panel can fit in
narrower windows.
2019-02-18 15:12:53 +01:00
Robert Ancell
0799c864e8 sound: Rename new sound panel to replace old one 2019-02-07 09:31:18 +13:00
Robert Ancell
652dd8bfc8 sound: Remove old panel
This has been replaced with a new implementation that uses the new designs.
2019-02-07 09:31:18 +13:00
Robert Ancell
74b54f6336 sound: Don't use gtk_widget_show_all
It is removed in GTK+ 4
2018-10-18 01:18:57 +00:00
Piotr Drąg
7265bd53a0 Add translator comments to .desktop files
Icons are confusing translators, and gettext
is unlikely to get fixed any time soon.
2018-02-23 18:49:35 +01:00
Robert Ancell
911e7d4e4f sound: Use g_auto for variables
https://bugzilla.gnome.org/show_bug.cgi?id=788223
2018-01-25 23:28:41 -02:00
Iñigo Martínez
0dd386f405 build: Migrate from Intltool to Gettext
Recent versions of Gettext are able to translate several formats
that are used in GNOME applications. This patch migrates from
Intltool to Gettext by using meson's i18n features.

https://bugzilla.gnome.org/show_bug.cgi?id=787588
2018-01-23 10:49:31 +01:00
Piotr Drąg
9db20522d3 sound: specify encoding in the XML declaration of gnome-sounds-default.xml
Without it, gettext mangles UTF-8 characters.

See https://savannah.gnu.org/bugs/?52932

https://bugzilla.gnome.org/show_bug.cgi?id=787588
2018-01-19 16:41:30 +01:00
Iñigo Martínez
dc0988d47c build: Remove autotools
To avoid the burden of maintaining multiple build systems, this
patch removes autotools support.

https://bugzilla.gnome.org/show_bug.cgi?id=785414
2018-01-18 12:20:08 +01:00
Iñigo Martínez
32edd6789e build: Port to meson build system
Meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=785414
2018-01-17 20:09:35 -02:00
Iñigo Martínez
d7012d0337 build: Move libgd and gvc modules to subprojects
In order to share the libgd and gvc modules between autotools and
meson, this patch moves their directories to subprojects
directory and updates autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=785414
2018-01-17 19:02:57 -02:00
Bastien Nocera
7ce6bd1e55 sound: Respect allow-volume-above-100-percent setting
Instead of always allowing above 100% volumes for hardware that supports
it, only enable it when the allow-volume-above-100-percent setting is
set to true as well.

See https://bugzilla.gnome.org/show_bug.cgi?id=790988

https://bugzilla.gnome.org/show_bug.cgi?id=791272
2018-01-12 20:13:00 +01:00
Felipe Borges
b3d51d9051 sound: Embed the "Applications" tab content in a scrolled window
The "Applications" tab might expand vertically indefinitely depending
on the amount of applications playing sounds simultaneously. This
causes the whole Control Center window to grow vertically.

To reproduce the issue you'd need to launch multiple sound sources.
  1. Launch "gst-play-1.0 <music file>"
  2. Press space to pause the playback
  3. Press Ctrl+Z to send it into the background
  4. Goto 1.

These changes pack the content of the "Applications" tab in a
GtkScrolledWindow.

To avoid having the scrollbar overlapping the switchers, we set a
10px margin-end to the inner container.

https://bugzilla.gnome.org/show_bug.cgi?id=786684
2018-01-09 16:48:40 +01:00
Andrea Azzarone
dc46487081 sound: Discard selection-changed events that are not triggered by the user
The tree view in the input and the output tab uses the "selection-changed"
signal. This implies that when a row is removed (e.g. when unplugging heaphones) g-c-c
will receive the signal and try to change the active port. G-c-c should not be the one
deciding deciding which port should be active, the user or PA are smart enough. We
should descard selection-changed events that are not triggered by an user interaction.

https://bugzilla.gnome.org/show_bug.cgi?id=789551
2017-10-30 16:49:26 +01:00
Jakub Steiner
8bfd0b97d6 sound: update artwork
- restyle all assets symbolic
- add missing mono speaker

https://bugzilla.gnome.org/show_bug.cgi?id=775170
2017-10-17 23:54:28 +02:00
Robert Ancell
43129a1cfd sound: Use G_DEFINE_TYPE 2017-09-26 21:09:56 -04:00
Bastien Nocera
27a8ca6e02 sound: Memory leaks and Bluetooth handling fixes 2017-04-06 15:17:20 +02:00
Bastien Nocera
3f0510cac8 build: Better libm checks
Use AC_CHECK_LIBM instead of AC_CHECK_LIB(m,...
and use $(LIBM) instead of hardcoding "-lm" in Makefiles.
2017-02-08 19:21:53 +01:00
Bastien Nocera
65d9bd0441 sound: Fix "format not a string literal" error
https://bugzilla.gnome.org/show_bug.cgi?id=764727
2016-04-08 11:31:24 +02:00
Christophe Fergeau
c84722248e shell: Revert "Let panels have their own commandline flags"
This reverts commit 31a8a99440.

This was meant for bgo#695885 which has stalled for a while, so this
feature has no in-tree user. This commit removes it for now, this can be
readded when users for it materialize.

https://bugzilla.gnome.org/show_bug.cgi?id=751597
2015-07-16 11:49:34 +02:00
David Henningsson
c4b4b8bdc5 sound: Support more channels in speaker test
Add support for mono, front-left-of-center and
right-left-of-center channels in speaker test dialogue.

https://bugzilla.gnome.org/show_bug.cgi?id=750324
2015-06-30 14:55:24 +02:00
Bastien Nocera
b410ec353c sound: Fix gtk_tree_model_get_iter_first() retval
https://bugzilla.gnome.org/show_bug.cgi?id=749892
2015-05-27 11:06:02 +02:00