How to identify Alsa eLements?

Tanjeff Moos tanjeff at cccmz.de
Thu Jul 2 22:05:01 CEST 2020


Hi alsa-devel,

I'm programming a GUI for the mixer in my Focusrite Scarlett 6i6 
interface. The Alsa driver supports that functionality, i.e. I can 
control the mixer using alsamixer, for example. Now I'm writing a Qt GUI 
for it.

I wonder how I can reliably identify a mixer control element (e.g. the 
master volume control). Each element has an ID (struct snd_ctl_elem_id), 
consisting of multiple elements:
- numid (seems to change at each boot)
- iface
- device
- subdevice
- name (is always constant)
- index
The docs says I can identify an element by the combination of name and 
index.

My questions:
1) Are name and index enough to identify an element?
2) How can I obtain the index? The name and numid are shown by 'amixer
    contents', for example.

Kind regards, Tanjeff



More information about the Alsa-devel mailing list