snd_ctl_mixer_switch_list()

Get the number and names of control switches for the mixer

Synopsis:

#include <sys/asoundlib.h >
int snd_ctl_mixer_switch_list( snd_ctl_t *handle,
                     int dev, snd_switch_list_t *list );

Arguments:

handle
The handle for the control device. This must have been created by snd_ctl_open().
dev
The mixer device the switches apply to.
list
A pointer to a snd_switch_list_t structure that snd_ctl_mixer_switch_list() fills with information about the switch.

Library:

libasound.so

Description:

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:

pswitches
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).
switches_size
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:

switches
The total switches in this mixer device.
switches_over
The number of switches that couldn't be copied to the storage location.

Returns:

Zero on success, or a negative value if an error occurs.

Errors:

-EINVAL
Invalid handle argument.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Caveats:

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.

See also:

snd_mixer_group_read(), mix_ctl.c application example source code