Get the number and names of control switches for the mixer
#include <sys/asoundlib.h > int snd_ctl_mixer_switch_list( snd_ctl_t *handle, int dev, snd_switch_list_t *list );
- The handle for the control device. This must have been created by snd_ctl_open() .
- The mixer device the switches apply to.
- A pointer to a snd_switch_list_t structure that snd_ctl_mixer_switch_list() fills with information about the switch.
Use the -l asound option to qcc to link against this library.
The snd_ctl_mixer_switch_list() function uses the control device handle to fill the given snd_switch_list_t structure with the number of switches for the mixer specified. It also fills in the array of switches pointed to by pswitches to a limit of switches_size. Before calling snd_mixer_groups(), set the members of the snd_switch_list_t as follows:
- This pointer must be NULL or point to a valid storage location for the switches (i.e. an array of snd_switch_list_item_t structures).
- The size of the pswitches storage location in sizeof( snd_switch_list_item_t ) units (i.e. the number of entries in the array).
On a successful return, the snd_ctl_mixer_switch_list() function will fill in these members:
- The total switches in this mixer device.
- The number of switches that couldn't be copied to the storage location.
Zero on success, or a negative value if an error occurs.
- Invalid handle argument.
The switch struct must be initialized to a known state before making the call; use memset() to set the struct to zero, and then set the name member to specify which switch to read.