ALSA project - the C library reference
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
mixer.h File Reference

Application interface library for the ALSA driver. More...

Go to the source code of this file.

Data Structures

struct  snd_mixer_selem_regopt

Macros

#define snd_mixer_class_alloca(ptr)
 allocate an invalid snd_mixer_class_t using standard alloca
#define snd_mixer_selem_id_alloca(ptr)
 allocate an invalid snd_mixer_selem_id_t using standard alloca

Typedefs

typedef struct _snd_mixer snd_mixer_t
typedef struct _snd_mixer_class snd_mixer_class_t
typedef struct _snd_mixer_elem snd_mixer_elem_t
typedef int(* snd_mixer_callback_t )(snd_mixer_t *ctl, unsigned int mask, snd_mixer_elem_t *elem)
 Mixer callback function.
typedef int(* snd_mixer_elem_callback_t )(snd_mixer_elem_t *elem, unsigned int mask)
 Mixer element callback function.
typedef int(* snd_mixer_compare_t )(const snd_mixer_elem_t *e1, const snd_mixer_elem_t *e2)
 Compare function for sorting mixer elements.
typedef int(* snd_mixer_event_t )(snd_mixer_class_t *class_, unsigned int mask, snd_hctl_elem_t *helem, snd_mixer_elem_t *melem)
 Event callback for the mixer class.
typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t

Enumerations

enum  snd_mixer_elem_type_t { SND_MIXER_ELEM_SIMPLE, SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE }
enum  snd_mixer_selem_channel_id_t {
  SND_MIXER_SCHN_UNKNOWN = -1, SND_MIXER_SCHN_FRONT_LEFT = 0, SND_MIXER_SCHN_FRONT_RIGHT, SND_MIXER_SCHN_REAR_LEFT,
  SND_MIXER_SCHN_REAR_RIGHT, SND_MIXER_SCHN_FRONT_CENTER, SND_MIXER_SCHN_WOOFER, SND_MIXER_SCHN_SIDE_LEFT,
  SND_MIXER_SCHN_SIDE_RIGHT, SND_MIXER_SCHN_REAR_CENTER, SND_MIXER_SCHN_LAST = 31, SND_MIXER_SCHN_MONO = SND_MIXER_SCHN_FRONT_LEFT
}
enum  snd_mixer_selem_regopt_abstract { SND_MIXER_SABSTRACT_NONE = 0, SND_MIXER_SABSTRACT_BASIC }

Functions

int snd_mixer_open (snd_mixer_t **mixer, int mode)
 Opens an empty mixer.
int snd_mixer_close (snd_mixer_t *mixer)
 Close a mixer and free all related resources.
snd_mixer_elem_tsnd_mixer_first_elem (snd_mixer_t *mixer)
 get first element for a mixer
snd_mixer_elem_tsnd_mixer_last_elem (snd_mixer_t *mixer)
 get last element for a mixer
int snd_mixer_handle_events (snd_mixer_t *mixer)
 Handle pending mixer events invoking callbacks.
int snd_mixer_attach (snd_mixer_t *mixer, const char *name)
 Attach an HCTL specified with the CTL device name to an opened mixer.
int snd_mixer_attach_hctl (snd_mixer_t *mixer, snd_hctl_t *hctl)
 Attach an HCTL to an opened mixer.
int snd_mixer_detach (snd_mixer_t *mixer, const char *name)
 Detach a previously attached HCTL to an opened mixer freeing all related resources.
int snd_mixer_detach_hctl (snd_mixer_t *mixer, snd_hctl_t *hctl)
 Detach a previously attached HCTL to an opened mixer freeing all related resources.
int snd_mixer_get_hctl (snd_mixer_t *mixer, const char *name, snd_hctl_t **hctl)
 Obtain a HCTL pointer associated to given name.
int snd_mixer_poll_descriptors_count (snd_mixer_t *mixer)
 get count of poll descriptors for mixer handle
int snd_mixer_poll_descriptors (snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space)
 get poll descriptors
int snd_mixer_poll_descriptors_revents (snd_mixer_t *mixer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
 get returned events from poll descriptors
int snd_mixer_load (snd_mixer_t *mixer)
 Load a mixer elements.
void snd_mixer_free (snd_mixer_t *mixer)
 Unload all mixer elements and free all related resources.
int snd_mixer_wait (snd_mixer_t *mixer, int timeout)
 Wait for a mixer to become ready (i.e. at least one event pending)
int snd_mixer_set_compare (snd_mixer_t *mixer, snd_mixer_compare_t msort)
 Change mixer compare function and reorder elements.
void snd_mixer_set_callback (snd_mixer_t *obj, snd_mixer_callback_t val)
 Set callback function for a mixer.
void * snd_mixer_get_callback_private (const snd_mixer_t *obj)
 Get callback private value for a mixer.
void snd_mixer_set_callback_private (snd_mixer_t *obj, void *val)
 Set callback private value for a mixer.
unsigned int snd_mixer_get_count (const snd_mixer_t *obj)
 Get elements count for a mixer.
int snd_mixer_class_unregister (snd_mixer_class_t *clss)
 Unregister mixer element class and remove all its elements.
snd_mixer_elem_tsnd_mixer_elem_next (snd_mixer_elem_t *elem)
 get next mixer element
snd_mixer_elem_tsnd_mixer_elem_prev (snd_mixer_elem_t *elem)
 get previous mixer element
void snd_mixer_elem_set_callback (snd_mixer_elem_t *obj, snd_mixer_elem_callback_t val)
 Set callback function for a mixer element.
void * snd_mixer_elem_get_callback_private (const snd_mixer_elem_t *obj)
 Get callback private value for a mixer element.
void snd_mixer_elem_set_callback_private (snd_mixer_elem_t *obj, void *val)
 Set callback private value for a mixer element.
snd_mixer_elem_type_t snd_mixer_elem_get_type (const snd_mixer_elem_t *obj)
 Get type for a mixer element.
int snd_mixer_class_register (snd_mixer_class_t *class_, snd_mixer_t *mixer)
 Register mixer element class.
int snd_mixer_elem_new (snd_mixer_elem_t **elem, snd_mixer_elem_type_t type, int compare_weight, void *private_data, void(*private_free)(snd_mixer_elem_t *elem))
 Allocate a new mixer element.
int snd_mixer_elem_add (snd_mixer_elem_t *elem, snd_mixer_class_t *class_)
 Add an element for a registered mixer element class.
int snd_mixer_elem_remove (snd_mixer_elem_t *elem)
 Remove a mixer element.
void snd_mixer_elem_free (snd_mixer_elem_t *elem)
 Free a mixer element.
int snd_mixer_elem_info (snd_mixer_elem_t *elem)
 Mixer element informations are changed.
int snd_mixer_elem_value (snd_mixer_elem_t *elem)
 Mixer element values is changed.
int snd_mixer_elem_attach (snd_mixer_elem_t *melem, snd_hctl_elem_t *helem)
 Attach an HCTL element to a mixer element.
int snd_mixer_elem_detach (snd_mixer_elem_t *melem, snd_hctl_elem_t *helem)
 Detach an HCTL element from a mixer element.
int snd_mixer_elem_empty (snd_mixer_elem_t *melem)
 Return true if a mixer element does not contain any HCTL elements.
void * snd_mixer_elem_get_private (const snd_mixer_elem_t *melem)
 Get private data associated to give mixer element.
size_t snd_mixer_class_sizeof (void)
 get size of snd_mixer_class_t
int snd_mixer_class_malloc (snd_mixer_class_t **ptr)
 allocate an invalid snd_mixer_class_t using standard malloc
void snd_mixer_class_free (snd_mixer_class_t *obj)
 frees a previously allocated snd_mixer_class_t
void snd_mixer_class_copy (snd_mixer_class_t *dst, const snd_mixer_class_t *src)
 copy one snd_mixer_class_t to another
snd_mixer_tsnd_mixer_class_get_mixer (const snd_mixer_class_t *class_)
 Get a mixer associated to given mixer class.
snd_mixer_event_t snd_mixer_class_get_event (const snd_mixer_class_t *class_)
 Get mixer event callback associated to given mixer class.
void * snd_mixer_class_get_private (const snd_mixer_class_t *class_)
 Get mixer private data associated to given mixer class.
snd_mixer_compare_t snd_mixer_class_get_compare (const snd_mixer_class_t *class_)
 Get mixer compare callback associated to given mixer class.
int snd_mixer_class_set_event (snd_mixer_class_t *class_, snd_mixer_event_t event)
 Set mixer event callback to given mixer class.
int snd_mixer_class_set_private (snd_mixer_class_t *class_, void *private_data)
 Set mixer private data to given mixer class.
int snd_mixer_class_set_private_free (snd_mixer_class_t *class_, void(*private_free)(snd_mixer_class_t *))
 Set mixer private data free callback to given mixer class.
int snd_mixer_class_set_compare (snd_mixer_class_t *class_, snd_mixer_compare_t compare)
 Set mixer compare callback to given mixer class.
const char * snd_mixer_selem_channel_name (snd_mixer_selem_channel_id_t channel)
 Return name of mixer simple element channel.
int snd_mixer_selem_register (snd_mixer_t *mixer, struct snd_mixer_selem_regopt *options, snd_mixer_class_t **classp)
 Register mixer simple element class.
void snd_mixer_selem_get_id (snd_mixer_elem_t *element, snd_mixer_selem_id_t *id)
 Get mixer simple element identifier.
const char * snd_mixer_selem_get_name (snd_mixer_elem_t *elem)
 Get name part of mixer simple element identifier.
unsigned int snd_mixer_selem_get_index (snd_mixer_elem_t *elem)
 Get index part of mixer simple element identifier.
snd_mixer_elem_tsnd_mixer_find_selem (snd_mixer_t *mixer, const snd_mixer_selem_id_t *id)
 Find a mixer simple element.
int snd_mixer_selem_is_active (snd_mixer_elem_t *elem)
 Get info about the active state of a mixer simple element.
int snd_mixer_selem_is_playback_mono (snd_mixer_elem_t *elem)
 Get info about channels of playback stream of a mixer simple element.
int snd_mixer_selem_has_playback_channel (snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel)
 Get info about channels of playback stream of a mixer simple element.
int snd_mixer_selem_is_capture_mono (snd_mixer_elem_t *elem)
 Get info about channels of capture stream of a mixer simple element.
int snd_mixer_selem_has_capture_channel (snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel)
 Get info about channels of capture stream of a mixer simple element.
int snd_mixer_selem_get_capture_group (snd_mixer_elem_t *elem)
 Return info about capture switch control of a mixer simple element.
int snd_mixer_selem_has_common_volume (snd_mixer_elem_t *elem)
 Return true if mixer simple element has only one volume control for both playback and capture.
int snd_mixer_selem_has_playback_volume (snd_mixer_elem_t *elem)
 Return info about playback volume control of a mixer simple element.
int snd_mixer_selem_has_playback_volume_joined (snd_mixer_elem_t *elem)
 Return info about playback volume control of a mixer simple element.
int snd_mixer_selem_has_capture_volume (snd_mixer_elem_t *elem)
 Return info about capture volume control of a mixer simple element.
int snd_mixer_selem_has_capture_volume_joined (snd_mixer_elem_t *elem)
 Return info about capture volume control of a mixer simple element.
int snd_mixer_selem_has_common_switch (snd_mixer_elem_t *elem)
 Return true if mixer simple element has only one switch control for both playback and capture.
int snd_mixer_selem_has_playback_switch (snd_mixer_elem_t *elem)
 Return info about playback switch control existence of a mixer simple element.
int snd_mixer_selem_has_playback_switch_joined (snd_mixer_elem_t *elem)
 Return info about playback switch control of a mixer simple element.
int snd_mixer_selem_has_capture_switch (snd_mixer_elem_t *elem)
 Return info about capture switch control existence of a mixer simple element.
int snd_mixer_selem_has_capture_switch_joined (snd_mixer_elem_t *elem)
 Return info about capture switch control of a mixer simple element.
int snd_mixer_selem_has_capture_switch_exclusive (snd_mixer_elem_t *elem)
 Return info about capture switch control of a mixer simple element.
int snd_mixer_selem_ask_playback_vol_dB (snd_mixer_elem_t *elem, long value, long *dBvalue)
 Return corresponding dB value to an integer playback volume for a mixer simple element.
int snd_mixer_selem_ask_capture_vol_dB (snd_mixer_elem_t *elem, long value, long *dBvalue)
 Return corresponding dB value to an integer capture volume for a mixer simple element.
int snd_mixer_selem_ask_playback_dB_vol (snd_mixer_elem_t *elem, long dBvalue, int dir, long *value)
 Return corresponding integer playback volume for given dB value for a mixer simple element.
int snd_mixer_selem_ask_capture_dB_vol (snd_mixer_elem_t *elem, long dBvalue, int dir, long *value)
 Return corresponding integer capture volume for given dB value for a mixer simple element.
int snd_mixer_selem_get_playback_volume (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value)
 Return value of playback volume control of a mixer simple element.
int snd_mixer_selem_get_capture_volume (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value)
 Return value of capture volume control of a mixer simple element.
int snd_mixer_selem_get_playback_dB (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value)
 Return value of playback volume in dB control of a mixer simple element.
int snd_mixer_selem_get_capture_dB (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value)
 Return value of capture volume in dB control of a mixer simple element.
int snd_mixer_selem_get_playback_switch (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value)
 Return value of playback switch control of a mixer simple element.
int snd_mixer_selem_get_capture_switch (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value)
 Return value of capture switch control of a mixer simple element.
int snd_mixer_selem_set_playback_volume (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value)
 Set value of playback volume control of a mixer simple element.
int snd_mixer_selem_set_capture_volume (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value)
 Set value of capture volume control of a mixer simple element.
int snd_mixer_selem_set_playback_dB (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir)
 Set value in dB of playback volume control of a mixer simple element.
int snd_mixer_selem_set_capture_dB (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir)
 Set value in dB of capture volume control of a mixer simple element.
int snd_mixer_selem_set_playback_volume_all (snd_mixer_elem_t *elem, long value)
 Set value of playback volume control for all channels of a mixer simple element.
int snd_mixer_selem_set_capture_volume_all (snd_mixer_elem_t *elem, long value)
 Set value of capture volume control for all channels of a mixer simple element.
int snd_mixer_selem_set_playback_dB_all (snd_mixer_elem_t *elem, long value, int dir)
 Set value in dB of playback volume control for all channels of a mixer simple element.
int snd_mixer_selem_set_capture_dB_all (snd_mixer_elem_t *elem, long value, int dir)
 Set value in dB of capture volume control for all channels of a mixer simple element.
int snd_mixer_selem_set_playback_switch (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value)
 Set value of playback switch control of a mixer simple element.
int snd_mixer_selem_set_capture_switch (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value)
 Set value of capture switch control of a mixer simple element.
int snd_mixer_selem_set_playback_switch_all (snd_mixer_elem_t *elem, int value)
 Set value of playback switch control for all channels of a mixer simple element.
int snd_mixer_selem_set_capture_switch_all (snd_mixer_elem_t *elem, int value)
 Set value of capture switch control for all channels of a mixer simple element.
int snd_mixer_selem_get_playback_volume_range (snd_mixer_elem_t *elem, long *min, long *max)
 Get range for playback volume of a mixer simple element.
int snd_mixer_selem_get_playback_dB_range (snd_mixer_elem_t *elem, long *min, long *max)
 Get range in dB for playback volume of a mixer simple element.
int snd_mixer_selem_set_playback_volume_range (snd_mixer_elem_t *elem, long min, long max)
 Set range for playback volume of a mixer simple element.
int snd_mixer_selem_get_capture_volume_range (snd_mixer_elem_t *elem, long *min, long *max)
 Get range for capture volume of a mixer simple element.
int snd_mixer_selem_get_capture_dB_range (snd_mixer_elem_t *elem, long *min, long *max)
 Get range in dB for capture volume of a mixer simple element.
int snd_mixer_selem_set_capture_volume_range (snd_mixer_elem_t *elem, long min, long max)
 Set range for capture volume of a mixer simple element.
int snd_mixer_selem_is_enumerated (snd_mixer_elem_t *elem)
 Return true if mixer simple element is an enumerated control.
int snd_mixer_selem_is_enum_playback (snd_mixer_elem_t *elem)
 Return true if mixer simple enumerated element belongs to the playback direction.
int snd_mixer_selem_is_enum_capture (snd_mixer_elem_t *elem)
 Return true if mixer simple enumerated element belongs to the capture direction.
int snd_mixer_selem_get_enum_items (snd_mixer_elem_t *elem)
 Return the number of enumerated items of the given mixer simple element.
int snd_mixer_selem_get_enum_item_name (snd_mixer_elem_t *elem, unsigned int idx, size_t maxlen, char *str)
 get the enumerated item string for the given mixer simple element
int snd_mixer_selem_get_enum_item (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *idxp)
 get the current selected enumerated item for the given mixer simple element
int snd_mixer_selem_set_enum_item (snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int idx)
 set the current selected enumerated item for the given mixer simple element
size_t snd_mixer_selem_id_sizeof (void)
 get size of snd_mixer_selem_id_t
int snd_mixer_selem_id_malloc (snd_mixer_selem_id_t **ptr)
 allocate an invalid snd_mixer_selem_id_t using standard malloc
void snd_mixer_selem_id_free (snd_mixer_selem_id_t *obj)
 frees a previously allocated snd_mixer_selem_id_t
void snd_mixer_selem_id_copy (snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src)
 copy one snd_mixer_selem_id_t to another
const char * snd_mixer_selem_id_get_name (const snd_mixer_selem_id_t *obj)
 Get name part of a mixer simple element identifier.
unsigned int snd_mixer_selem_id_get_index (const snd_mixer_selem_id_t *obj)
 Get index part of a mixer simple element identifier.
void snd_mixer_selem_id_set_name (snd_mixer_selem_id_t *obj, const char *val)
 Set name part of a mixer simple element identifier.
void snd_mixer_selem_id_set_index (snd_mixer_selem_id_t *obj, unsigned int val)
 Set index part of a mixer simple element identifier.

Detailed Description

Application interface library for the ALSA driver.

Author:
Jaroslav Kysela perex.nosp@m.@per.nosp@m.ex.cz
Abramo Bagnara abram.nosp@m.o@al.nosp@m.sa-pr.nosp@m.ojec.nosp@m.t.org
Takashi Iwai tiwai.nosp@m.@sus.nosp@m.e.de
Date:
1998-2001

Application interface library for the ALSA driver