Commit graph

78 commits

Author SHA1 Message Date
Wim Taymans
7e64680a65 alsa-ucm: Split profile creation into verb and profile parts
To support having multiple profiles per UCM verb, split the profile
creation into two parts based on whether they should run once for each
verb or for each profile (maybe multiple times per verb).

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-03-20 15:35:09 +01:00
Wim Taymans
8d1e38a281 alsa-ucm: Make mapping creation independent from indvidual profiles
The ucm_create_mapping() function is not idempotent. It looks like it
was meant to be called once per device for the devices of a UCM verb
and takes a profile argument simply because a verb has generated a
single profile so far.

Make sure creating mappings per device and adding those mappings to the
profiles happens as separate steps to make it easier to split UCM verbs
and profiles as concepts.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-03-20 15:28:15 +01:00
Wim Taymans
591188195c alsa-ucm: Stop conflating profile name with UCM verb name
So far each profile had the exact name as their associated UCM verb,
which caused the one to be used where the other should have been.
Explicitly get and use the verb name where that was intended, and make
sure things about profiles aren't named after verbs.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-03-20 15:25:02 +01:00
Wim Taymans
973fe0cb79 alsa-ucm: Let profiles know their associated UCM verb
Currently each UCM verb generates one profile named the same as the
verb, meaning it's trivial to know which verb the profile belongs to.
This will be slightly harder to do when we generate multiple profiles
per UCM verb (e.g. to make use of conflicting devices).

It would still be possible to parse the profile name to get the UCM
verb, but instead let's keep track of the struct instance representing
the profile's associated verb. This also lets us remove a block of code
searching for the verb by its name.

Co-authored-by: Jaroslav Kysela <perex@perex.cz>
[Alper: Reused Jaroslav's UCM profile context changes for UCM verb
instead of combined devices.]

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-03-20 15:18:12 +01:00
Wim Taymans
4d08c9ad60 alsa-ucm: Set profiles by their struct instance, not their name
While switching profiles, it's possible that we will want to do more
work besides switching UCM verbs. The alsa-card module already has our
profiles as structs, but passes in only the names instead of the entire
struct. Make things work with the struct instead, so we can add other
things (like a UCM context) to it and use those here.

Co-authored-by: Tanu Kaskinen <tanuk@iki.fi>
[Alper: Split into its own commit and integrated Tanu's snippet.]

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-03-20 15:13:41 +01:00
Wim Taymans
3dce92e580 alsa-ucm: Add enable, disable, status helpers for devices
Right now manipulating device status is done inline once while setting a
port. However, we will need to reuse this code to disable conflicting
devices of a device we want to enable. Split it into enable and disable
helper functions.

There is another issue with the device enable logic, where trying to
disabling an already disabled device sometimes fails. To avoid that,
implement a status helper and check if the device we want to enable is
already enabled/disabled before trying to do so.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-03-20 15:02:41 +01:00
Wim Taymans
6b5e232c5c alsa-ucm: Make modifiers track conflicting/supported devices as idxsets
Modifiers currently keep their conflicting and supported devices's
names, and these names are resolved to devices every time we need to use
them. Instead, resolve these device names while creating the modifier
struct and keep track of the resulting device structs in idxsets, same
as how device structs keep track of their support relations.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-03-20 14:56:14 +01:00
Wim Taymans
b1286c62c9 alsa-ucm: Always create device conflicting/supported device idxsets
This is intended to make the current and upcoming code a bit clearer, as
we won't need to constantly check for the existence of these idxsets
before using or operating on them.
2023-03-20 13:28:17 +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
bc1789c3ea Revert "acp: sync with pulseaudio"
This reverts commit 57f0fdf746.

This seems to cause problems and needs to mature a bit more in
pulseaudio it seems.
2022-07-11 10:03:01 +02:00
Wim Taymans
57f0fdf746 acp: sync with pulseaudio 2022-07-07 12:23:28 +02:00
Wim Taymans
b63a6a1b66 acp: sync with pulseaudio 2022-01-03 17:21:28 +01:00
Wim Taymans
7ef2b27376 acp: sync with pulseaudio
Include the alsa-ucm fixes.

See #1849
2021-12-16 15:07:05 +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
Wim Taymans
ae89ae093e acp: strip UCM alibpref from mapping
Strip the alibpref from the device string in the mapping name. This
name is used to generate the node name eventually and we don't want
this random identifier in it.

Fixes #1362
2021-06-29 17:43:00 +02: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
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
62065ac263 acp: update to latest 2021-01-05 10:08:31 +01:00
Marijn Suijten
d636cadbb8 acp: alsa-ucm: Print iterated path name instead of current path
data->path (current path for selected profile) is not set yet here
resulting in segfaults. We are not interested in printing that anyway
but instead care about the iterated `path` from data->paths.
2020-12-15 09:36:52 +00:00
Elliott Sales de Andrade
6224068586 Fix some possible leaks. 2020-11-23 15:36:08 +00:00
Wim Taymans
41db0f35b3 acp: sync with latests 2020-09-30 12:56:05 +02:00
Wim Taymans
cfdd6cab20 acp: fix UCM off profile 2020-08-18 16:52:09 +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
Emmanuel Gil Peyrot
14fdf07e8f Run codespell on the entire codebase
This tool detects and fixes common English spelling mistakes, with
generally very few mistakes.

Here is the command I used to generate this commit.  There were a few
changes that had to be done manually, and of course adding the ignore
file:
```shell
codespell -I .codespell-ignore -x .codespell-ignore -w
```

I didn’t add it to the CI, but this would be a good place for it.
2020-08-17 17:16:31 +00:00
Wim Taymans
a459c1f226 acp: sync with master 2020-07-13 14:39:27 +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