spa: acp: Allow Volume control which supports mute to be used as a hardware mute

Some devices have a hardware volume control, but not a dedicated
hardware mute control. In some of these cases, the volume control is
described as having a hardware mute when volume is 0. This is described
in the TLV information of the volume control, when the
SNDRV_CTL_TLVD_DB_SCALE_MUTE flag is set in the TLV structure.
If set, alsa-lib will set the minimum dB value to -99999.99dB, which
can be detected inside PipeWire.

PipeWire can then use this hardware volume control to apply hardware
mute, when set.

In order to be able to set volumes and mutes separately, changing the
volume whilst muted will save the value, but not write it to the
hardware. When the device is unmuted, the saved value will be restored.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
This commit is contained in:
Stefan Binding 2025-03-28 14:18:10 +00:00 committed by Wim Taymans
parent 21a468a9cd
commit 7f07448a80
2 changed files with 54 additions and 8 deletions

View file

@ -225,6 +225,7 @@ struct pa_alsa_path {
bool has_mute:1;
bool has_volume:1;
bool has_dB:1;
bool has_volume_mute:1;
bool mute_during_activation:1;
/* These two are used during probing only */
bool has_req_any:1;