Commit graph

42 commits

Author SHA1 Message Date
Pauli Virtanen
da2cecf074 alsa: acp: don't disable dB if negative max unless range is small
Disabling dB volumes for max_dB < 0 was added in Pulseaudio in 2021,
based on a device which had -128..-127.07 range. However, negative
max_dB is valid value for USB devices, and there are devices that have
it.

Eg. Microsoft LifeChat LX-3000 has

numid=6,iface=MIXER,name='Speaker Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=151,step=0
  : values=150,150
  | dBminmax-min=-28.37dB,max=-0.06dB

and the dB range seems to be OK. Web search for "The decibel volume
range for element" also gives other hits with seemingly OK looking
ranges.

Don't disable dB volume unless both the max is negative and the range is
suspiciously small. This should still disable it for the device this
check was originally added for.

Link: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/447
Link: 10ac01a206
2025-10-15 21:37:06 +03:00
Pauli Virtanen
c89acd3e1c alsa: acp: fix volume rounding down causing mute
Some ALSA devices have minimum HW volume value that is muted.  ALSA
indicates it with SND_CTL_TLV_DB_GAIN_MUTE = -9999999 dB/100 volume dB.
When rounding down to HW volume, we may get this muted value.

When determining splitting of volumes to mixers and soft volume, we
don't want HW mixers to set volume to muted, unless the target volume is
actually muted.

Fix by adding element_ask_unmuted_dB_vol() that rounds up if the asked
rounding mode resulted to mute.

This fixes mic getting muted at low volume despite ALSA reporting the dB
values correctly.

Fixes #4890
2025-10-14 08:02:23 +00:00
Pauli Virtanen
dcccfcab7f spa: acp: get and emit UCM information for SplitPCM devices
When api.alsa.split-enable=true for ACP device, instruct UCM to not
use alsa-lib plugins for SplitPCM devices.

Grab the information from UCM for the intended channel remapping, and
add the splitting information to the nodes emitted.

Session manager can then look at that, and load nodes to do the channel
splitting.
2024-12-21 16:03:19 +02:00
Wim Taymans
1ae4374ccf Fix compilation with -Werror=float-conversion
Better make the conversions explicit so that we don't get any surprises.

Fixes #4065
2024-06-18 12:17:56 +02:00
Igor V. Kovalenko
082680d8a2 alsa-util: Perform format and rate detection before setting HW params
Perform detection of supported sample format and rates just after device is
opened, before `snd_pcm_hw_params()` is called for the first time. This fixes a
problem where device restricts available sample rates after HW params are set
preventing sample rate detection (seen with UAC2 devices and kernel 6.1.9)

Bug: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1414
Bug: https://github.com/alsa-project/alsa-lib/issues/119
Link: aed52c507f
[Wim: Apply to acp add_pro_profile(), enable pa_alsa_supported_*()]
2023-12-04 15:34:48 +00:00
Pauli Virtanen
636a9c611d acp: Respect XDG base directory spec when loading configs
Backport from Pulseaudio. Reimplement get_data_path. We'll look for the
override files similarly as we do for other config files
(XDG_CONFIG_HOME then /etc then install location), instead of looking at
the Pulseaudio locations ~/.local/share/pulseaudio etc.

Upstream commits:

From: SimonP <simonp.git@gmail.com>

alsa-mixer: Respect XDG base directory spec when loading profile sets

Try $XDG_DATA_HOME, then $XDG_DATA_DIRS, and finally fall back to old behaviour.

From: SimonP <simonp.git@gmail.com>

alsa-mixer: Respect XDG base directory spec when loading path configs

Try $XDG_DATA_HOME, then $XDG_DATA_DIRS, and finally fall back to old
behaviour (prefix-defined directory).

core-util: Ignore non-absolute XDG base dirs

These are invalid per the spec.
2023-11-09 20:36:15 +00:00
Wim Taymans
a66d5b90f9 Revert "alsa: UCM conflicting devices changes"
If needs some more work

This reverts commit aae770f18b.
This reverts commit 2216956e05.
This reverts commit 1d3c4501ef.
This reverts commit c7ca024607.
This reverts commit 8e4a5f5d5e.
This reverts commit 8b20675ad1.
This reverts commit ebe6f8b51a.
This reverts commit 4b97da1277.
This reverts commit 7c46a656c7.
This reverts commit 96ed03e1fc.
This reverts commit 43770c533c.
This reverts commit ccb2fce054.
This reverts commit 93d0ddc8b3.
This reverts commit 815e8c8fa0.
This reverts commit 97b99a0f7c.
This reverts commit 7e4d87402b.
This reverts commit 168b3ee22c.
This reverts commit 5128cdba31.
This reverts commit 31cde774c5.
This reverts commit b02c8ba153.
This reverts commit 68ac72d098.
This reverts commit 96cfc9bc1a.
This reverts commit e2d642a20b.
This reverts commit 80fc80c343.
This reverts commit 3a68905c7c.
This reverts commit 7e64680a65.
This reverts commit 8d1e38a281.
This reverts commit 591188195c.
This reverts commit 973fe0cb79.
This reverts commit 4d08c9ad60.
This reverts commit 3dce92e580.
This reverts commit 6b5e232c5c.
This reverts commit b1286c62c9.
2023-04-12 13:05:08 +02:00
Wim Taymans
1d3c4501ef alsa: use pa_strbuf 2023-03-21 09:47:10 +01:00
Wim Taymans
96ed03e1fc alsa-util: Perform format and rate detection before setting HW params
Perform detection of supported sample format and rates just after device is
opened, before `snd_pcm_hw_params()` is called for the first time. This fixes a
problem where device restricts available sample rates after HW params are set
preventing sample rate detection (seen with UAC2 devices and kernel 6.1.9)
2023-03-20 18:22:09 +01:00
Wim Taymans
a9ced45d4b acp: add debug for open and close
Debug open and close calls.
Make pa_alsa_close to close the device.
2022-08-05 12:31:28 +02:00
Wim Taymans
99f9f729ff handle open_memstream errors
Fixes #2182
2022-03-02 11:48:31 +01:00
Wim Taymans
a33df863b4 acp: sync with pulseaudio 2021-07-21 13:11:17 +02:00
Julian Bouzas
2dcdc80030 spa: alsa: acp: fix memleak when destroying card profles 2021-07-08 11:08:00 -04:00
Peter Hutterer
5cf3c28fa4 config.h is a local header, not a system one
Change the #include accordingly, that's what we use in the rest of the tree
too.
2021-06-10 09:04:16 +10:00
Peter Hutterer
da339c286f meson.build: drop HAVE_CONFIG_H
This is an autotools leftover, with meson we're always guaranteed to have
the config.h file.
2021-06-10 09:04:16 +10:00
Peter Hutterer
83f8a2896f alsa-mixer: drop the VALGRIND_HAVE_MEMCHECK hacks
Cause for this was a missing ioctl, fixed in 2014. See valgrind commit
4ef60ef1029e6933773b7de9966ece7185129d84
2021-06-07 10:44:27 +00:00
Peter Hutterer
d9cc1a25f1 Include the valgrind headers in our tree
These headers are designed for including in the project. So the user doesn't
need to install valgrind-devel and we don't have to worry about whether the
headers are available or not.
2021-06-07 10:44:27 +00:00
Wim Taymans
620e8de52a acp: copy the db_fix key as well
Or else we will try to free the original key twice and segfault.

Fixes #1125
2021-06-01 12:43:08 +02:00
Peter Hutterer
e83f039833 alsa: free the strdup'd substring on error
n is the return value of pa_split()

Found by scan-build
2021-05-26 10:03:49 +02:00
Peter Hutterer
4dd886188a alsa: fix scan-build errors for unused variables
All cases of value stored but never read
2021-05-26 07:51:27 +00:00
Wim Taymans
3fd8f62e21 acp: sync with pulseaudio
Remove our custom hack to work around missing duplex and use
upstream fix.
2021-04-22 12:25:48 +02:00
Wim Taymans
c90332a6bf acp: make sure all descriptions are translated 2021-04-15 17:56:40 +02:00
Wim Taymans
20eb61b882 alsa: sync with pulseaudio 2021-02-25 10:28:25 +01:00
Wim Taymans
3659d70aef acp: complain louder when profile files are missing 2021-02-04 10:31:55 +01:00
Wim Taymans
d82066e49f acp: sync with pulseaudio 2021-01-19 10:52:28 +01:00
Wim Taymans
b3f8a4b99b acp: update pcm proplist for UCM as well
Update the properties we get from the pcm handle right before we
close the handle.
Also set properties on the UCM devices.

See #524
2021-01-11 15:39:48 +01:00
Wim Taymans
6a9552a4ac acp; fall back to default when profile-set is not accessible 2021-01-11 13:05:11 +01:00
Wim Taymans
62065ac263 acp: update to latest 2021-01-05 10:08:31 +01:00
Wim Taymans
cdb6c94c8e acp: undo upstream change that breaks duplex mode 2020-12-17 13:05:37 +01:00
Wim Taymans
d6530bc0cd acp: sync with pulseaudio 2020-12-17 12:04:18 +01:00
Wim Taymans
e8dcd7f5f9 acp: sync
Remove >2 channel support until upstream
Fix availability groups
2020-12-17 11:03:31 +01:00
Wim Taymans
119678e8d1 Revert "alsa: sync to latest acp"
This reverts commit f611e34456.

There is something wrong with this
2020-11-26 12:40:44 +01:00
Wim Taymans
f611e34456 alsa: sync to latest acp 2020-11-26 11:16:31 +01:00
Wim Taymans
42dd52c7fe acp: clean up card object
Fixes #369
2020-11-09 15:01:07 +01:00
Wim Taymans
df912a9059 acp: fix > 2 channel maps 2020-10-15 09:46:14 +02:00
Wim Taymans
477d6e0b7f acp: fixup impossible decibel ranges 2020-10-13 17:24:23 +02:00
Wim Taymans
4e9b81960f acp: sync 2020-10-13 17:23:36 +02:00
Wim Taymans
a67af43cad alsa: sync with latest pulseaudio
Move some things around to make it easier to merge in changes.
2020-08-18 12:41:34 +02:00
Wim Taymans
154f981f97 Add mixer paths and profile-sets as well
So we don't have to rely on pulseaudio installed ones
2020-07-28 12:30:32 +02:00
Wim Taymans
3f33c9c81d acp: sync with latest 2020-07-28 10:16:47 +02:00
Wim Taymans
b896d65723 acp: emit param change when port changed 2020-07-08 16:16:43 +02:00
Wim Taymans
1612f5e4d2 alsa-acp: Add libacp based card device
libacp is a port and wrapper around the pulseaudio card profile code.
It uses a set of templates for construct a card profile and mixer port
settings. It also has support for UCM when available for the hardware.
2020-07-06 12:20:09 +02:00