snd_mixer_elements()

Get the number of elements in the mixer and their element IDs

Synopsis:

#include <sys/asoundlib.h>

int snd_mixer_elements(
       snd_mixer_t *handle, 
       snd_mixer_elements_t *elements );

Arguments:

handle
The handle for the mixer device. This must have been created by snd_mixer_open().
elements
A pointer to a snd_mixer_elements_t structure in which snd_mixer_elements() stores the information about the elements.

Library:

libasound.so

Description:

The snd_mixer_elements() function fills the given snd_mixer_elements_t structure with the number of elements in the mixer that the handle was opened on. It also fills in the array of element IDs pointed to by pelements to a limit of elements_size.


Note: We recommend that you work with mixer groups instead of manipulating the elements directly.

Before calling snd_mixer_elements(), set the snd_mixer_elements_t structure as follows:

pelements
This pointer be NULL, or point to a valid storage location for the elements (i.e. an array of snd_mixer_eid_t structures).
elements_size
This must reflect the size of the pelements storage location, in sizeof( snd_mixer_eid_t ) units (i.e. elements_size must be the number of entries in the pelements array).

On a successful return, snd_mixer_elements() sets these members:

elements
The total number of elements in the mixer.
pelements
If non-NULL, the mixer element IDs are filled in.
elements_over
The number of elements that couldn't be copied to the storage location.

Returns:

Zero on success, or a negative value on error.

Errors:

-EINVAL
Invalid handle.

Classification:

QNX Neutrino

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

See also:

snd_mixer_eid_t, snd_mixer_element_read(), snd_mixer_element_write(), snd_mixer_elements_t, snd_mixer_sort_eid_table()