alsa: Add a mechanism to bind ALSA controls as prop params

This adds an api.alsa.bind-ctls property to alsa-pcm sink and source
nodes, to bind a property to an ALSA PCM ctl. The property is an array
of ctl names that should be bound.

This can be handy, for example, to bind the Playback/Capture Rate
controls on a USB gadget, in order to track the PCM's state via a node
param.

This is currently wired to be read-only, but it should be easy enough to
make it writable.
This commit is contained in:
Arun Raghavan 2023-11-07 14:02:26 -05:00
parent 6bae812ce0
commit 2871a65b1f
3 changed files with 300 additions and 7 deletions

View file

@ -44,6 +44,7 @@ extern "C" {
#define SPA_KEY_API_ALSA_OPEN_UCM "api.alsa.open.ucm" /**< if UCM should be opened card */
#define SPA_KEY_API_ALSA_DISABLE_LONGNAME \
"api.alsa.disable-longname" /**< if card long name should not be passed to MIDI port */
#define SPA_KEY_API_ALSA_BIND_CTLS "api.alsa.bind-ctls" /**< alsa controls to bind as params */
/** info from alsa card_info */
#define SPA_KEY_API_ALSA_CARD_ID "api.alsa.card.id" /**< id from card_info */