2001-09-13 11:38:32 +00:00
|
|
|
/**
|
|
|
|
* \file <alsa/mixer.h>
|
|
|
|
* \brief Application interface library for the ALSA driver
|
|
|
|
* \author Jaroslav Kysela <perex@suse.cz>
|
|
|
|
* \author Abramo Bagnara <abramo@alsa-project.org>
|
|
|
|
* \author Takashi Iwai <tiwai@suse.de>
|
|
|
|
* \date 1998-2001
|
|
|
|
*
|
|
|
|
* Application interface library for the ALSA driver
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or modify
|
2001-12-30 09:22:54 +00:00
|
|
|
* it under the terms of the GNU Lesser General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2.1 of
|
2001-09-13 11:38:32 +00:00
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2001-12-30 09:22:54 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2001-09-13 11:38:32 +00:00
|
|
|
*
|
2001-12-30 09:22:54 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2001-09-13 11:38:32 +00:00
|
|
|
* License along with this library; if not, write to the Free Software
|
2001-12-30 09:22:54 +00:00
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2001-09-13 11:38:32 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ALSA_MIXER_H
|
|
|
|
#define __ALSA_MIXER_H
|
1998-08-13 15:42:56 +00:00
|
|
|
|
2001-11-14 11:40:46 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2001-04-24 13:02:58 +00:00
|
|
|
/**
|
|
|
|
* \defgroup Mixer Mixer Interface
|
|
|
|
* The mixer interface.
|
|
|
|
* \{
|
|
|
|
*/
|
|
|
|
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Mixer handle */
|
2000-11-20 20:10:46 +00:00
|
|
|
typedef struct _snd_mixer snd_mixer_t;
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Mixer elements class handle */
|
2001-02-11 15:45:35 +00:00
|
|
|
typedef struct _snd_mixer_class snd_mixer_class_t;
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Mixer element handle */
|
2001-02-09 11:20:31 +00:00
|
|
|
typedef struct _snd_mixer_elem snd_mixer_elem_t;
|
2001-03-30 09:43:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Mixer callback function
|
|
|
|
* \param mixer Mixer handle
|
|
|
|
* \param mask event mask
|
|
|
|
* \param elem related mixer element (if any)
|
|
|
|
* \return 0 on success otherwise a negative error code
|
|
|
|
*/
|
2001-02-09 11:20:31 +00:00
|
|
|
typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl,
|
2001-02-13 21:29:30 +00:00
|
|
|
unsigned int mask,
|
2001-02-09 11:20:31 +00:00
|
|
|
snd_mixer_elem_t *elem);
|
2001-03-30 09:43:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Mixer element callback function
|
|
|
|
* \param elem Mixer element
|
|
|
|
* \param mask event mask
|
|
|
|
* \return 0 on success otherwise a negative error code
|
|
|
|
*/
|
2001-02-09 11:20:31 +00:00
|
|
|
typedef int (*snd_mixer_elem_callback_t)(snd_mixer_elem_t *elem,
|
2001-02-13 21:29:30 +00:00
|
|
|
unsigned int mask);
|
2001-03-30 09:43:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Compare function for sorting mixer elements
|
|
|
|
* \param e1 First element
|
|
|
|
* \param e2 Second element
|
|
|
|
* \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
|
|
|
|
*/
|
2001-02-11 15:45:35 +00:00
|
|
|
typedef int (*snd_mixer_compare_t)(const snd_mixer_elem_t *e1,
|
|
|
|
const snd_mixer_elem_t *e2);
|
2001-02-09 11:20:31 +00:00
|
|
|
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Mixer element type */
|
2001-03-29 10:11:38 +00:00
|
|
|
typedef enum _snd_mixer_elem_type {
|
2001-03-30 09:43:29 +00:00
|
|
|
/* Simple (legacy) mixer elements */
|
2001-02-09 11:20:31 +00:00
|
|
|
SND_MIXER_ELEM_SIMPLE,
|
2002-02-05 11:36:20 +00:00
|
|
|
SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE
|
2001-03-29 10:11:38 +00:00
|
|
|
} snd_mixer_elem_type_t;
|
2000-01-18 08:45:02 +00:00
|
|
|
|
2001-03-26 12:45:48 +00:00
|
|
|
int snd_mixer_open(snd_mixer_t **mixer, int mode);
|
2001-02-09 11:20:31 +00:00
|
|
|
int snd_mixer_close(snd_mixer_t *mixer);
|
|
|
|
snd_mixer_elem_t *snd_mixer_first_elem(snd_mixer_t *mixer);
|
|
|
|
snd_mixer_elem_t *snd_mixer_last_elem(snd_mixer_t *mixer);
|
2001-02-11 15:45:35 +00:00
|
|
|
int snd_mixer_handle_events(snd_mixer_t *mixer);
|
|
|
|
int snd_mixer_attach(snd_mixer_t *mixer, const char *name);
|
|
|
|
int snd_mixer_detach(snd_mixer_t *mixer, const char *name);
|
2001-02-18 18:32:30 +00:00
|
|
|
int snd_mixer_poll_descriptors_count(snd_mixer_t *mixer);
|
2001-02-12 23:51:49 +00:00
|
|
|
int snd_mixer_poll_descriptors(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space);
|
2001-11-30 17:36:45 +00:00
|
|
|
int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
|
2001-02-11 15:45:35 +00:00
|
|
|
int snd_mixer_load(snd_mixer_t *mixer);
|
2001-03-29 17:50:28 +00:00
|
|
|
void snd_mixer_free(snd_mixer_t *mixer);
|
2001-02-12 23:51:49 +00:00
|
|
|
int snd_mixer_wait(snd_mixer_t *mixer, int timeout);
|
2001-02-12 13:29:33 +00:00
|
|
|
int snd_mixer_set_compare(snd_mixer_t *mixer, snd_mixer_compare_t msort);
|
2001-09-13 11:38:32 +00:00
|
|
|
void snd_mixer_set_callback(snd_mixer_t *obj, snd_mixer_callback_t val);
|
|
|
|
void * snd_mixer_get_callback_private(const snd_mixer_t *obj);
|
|
|
|
void snd_mixer_set_callback_private(snd_mixer_t *obj, void * val);
|
|
|
|
unsigned int snd_mixer_get_count(const snd_mixer_t *obj);
|
|
|
|
int snd_mixer_class_unregister(snd_mixer_class_t *clss);
|
2001-02-11 15:45:35 +00:00
|
|
|
|
2001-02-09 11:20:31 +00:00
|
|
|
snd_mixer_elem_t *snd_mixer_elem_next(snd_mixer_elem_t *elem);
|
2001-02-13 14:07:28 +00:00
|
|
|
snd_mixer_elem_t *snd_mixer_elem_prev(snd_mixer_elem_t *elem);
|
2001-09-13 11:38:32 +00:00
|
|
|
void snd_mixer_elem_set_callback(snd_mixer_elem_t *obj, snd_mixer_elem_callback_t val);
|
|
|
|
void * snd_mixer_elem_get_callback_private(const snd_mixer_elem_t *obj);
|
|
|
|
void snd_mixer_elem_set_callback_private(snd_mixer_elem_t *obj, void * val);
|
|
|
|
snd_mixer_elem_type_t snd_mixer_elem_get_type(const snd_mixer_elem_t *obj);
|
2001-02-11 15:45:35 +00:00
|
|
|
|
2000-07-15 10:20:32 +00:00
|
|
|
|
2001-04-24 13:02:58 +00:00
|
|
|
/**
|
|
|
|
* \defgroup SimpleMixer Simple Mixer Interface
|
|
|
|
* \ingroup Mixer
|
|
|
|
* The simple mixer interface.
|
|
|
|
* \{
|
|
|
|
*/
|
|
|
|
|
2001-03-30 09:43:29 +00:00
|
|
|
/* Simple (legacy) mixer elements API */
|
2000-07-15 10:20:32 +00:00
|
|
|
|
2002-03-12 20:14:33 +00:00
|
|
|
/** Mixer simple element channel identifier */
|
2001-03-29 10:11:38 +00:00
|
|
|
typedef enum _snd_mixer_selem_channel_id {
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Unknown */
|
2001-02-11 15:45:35 +00:00
|
|
|
SND_MIXER_SCHN_UNKNOWN = -1,
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Front left */
|
2001-02-11 15:45:35 +00:00
|
|
|
SND_MIXER_SCHN_FRONT_LEFT = 0,
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Front right */
|
2001-02-11 15:45:35 +00:00
|
|
|
SND_MIXER_SCHN_FRONT_RIGHT,
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Front center */
|
2001-02-11 15:45:35 +00:00
|
|
|
SND_MIXER_SCHN_FRONT_CENTER,
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Rear left */
|
2001-02-11 15:45:35 +00:00
|
|
|
SND_MIXER_SCHN_REAR_LEFT,
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Rear right */
|
2001-02-11 15:45:35 +00:00
|
|
|
SND_MIXER_SCHN_REAR_RIGHT,
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Woofer */
|
2001-02-11 15:45:35 +00:00
|
|
|
SND_MIXER_SCHN_WOOFER,
|
|
|
|
SND_MIXER_SCHN_LAST = 31,
|
2001-03-30 09:43:29 +00:00
|
|
|
/** Mono (Front left alias) */
|
2001-02-11 15:45:35 +00:00
|
|
|
SND_MIXER_SCHN_MONO = SND_MIXER_SCHN_FRONT_LEFT
|
2001-03-29 10:11:38 +00:00
|
|
|
} snd_mixer_selem_channel_id_t;
|
2001-02-05 15:44:42 +00:00
|
|
|
|
2002-03-12 20:14:33 +00:00
|
|
|
/** Mixer simple element identifier */
|
2001-02-09 11:20:31 +00:00
|
|
|
typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
|
|
|
|
|
2001-02-11 15:45:35 +00:00
|
|
|
const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel);
|
|
|
|
|
2001-02-15 23:05:41 +00:00
|
|
|
int snd_mixer_selem_register(snd_mixer_t *mixer, void *arg,
|
|
|
|
snd_mixer_class_t **classp);
|
2001-02-09 11:20:31 +00:00
|
|
|
void snd_mixer_selem_get_id(snd_mixer_elem_t *element,
|
|
|
|
snd_mixer_selem_id_t *id);
|
2001-02-18 17:56:37 +00:00
|
|
|
const char *snd_mixer_selem_get_name(snd_mixer_elem_t *elem);
|
|
|
|
unsigned int snd_mixer_selem_get_index(snd_mixer_elem_t *elem);
|
2001-02-11 15:45:35 +00:00
|
|
|
snd_mixer_elem_t *snd_mixer_find_selem(snd_mixer_t *mixer,
|
|
|
|
const snd_mixer_selem_id_t *id);
|
2001-02-15 23:05:41 +00:00
|
|
|
|
2001-07-23 13:07:47 +00:00
|
|
|
int snd_mixer_selem_is_active(snd_mixer_elem_t *elem);
|
2001-02-15 23:05:41 +00:00
|
|
|
int snd_mixer_selem_is_playback_mono(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_playback_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
|
|
|
|
int snd_mixer_selem_is_capture_mono(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_capture_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
|
|
|
|
int snd_mixer_selem_get_capture_group(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_common_volume(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_playback_volume(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_playback_volume_joined(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_capture_volume(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_capture_volume_joined(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_common_switch(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_playback_switch(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_playback_switch_joined(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_capture_switch(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_capture_switch_joined(snd_mixer_elem_t *elem);
|
|
|
|
int snd_mixer_selem_has_capture_switch_exclusive(snd_mixer_elem_t *elem);
|
|
|
|
|
|
|
|
int snd_mixer_selem_get_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
|
|
|
|
int snd_mixer_selem_get_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
|
|
|
|
int snd_mixer_selem_get_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
|
|
|
|
int snd_mixer_selem_get_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
|
|
|
|
int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
|
|
|
|
int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
|
|
|
|
int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value);
|
|
|
|
int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value);
|
|
|
|
int snd_mixer_selem_set_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
|
|
|
|
int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
|
|
|
|
int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value);
|
|
|
|
int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value);
|
2001-03-30 09:43:29 +00:00
|
|
|
void snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem,
|
|
|
|
long *min, long *max);
|
2001-02-18 17:56:37 +00:00
|
|
|
void snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
|
|
|
|
long min, long max);
|
2001-03-30 09:43:29 +00:00
|
|
|
void snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem,
|
|
|
|
long *min, long *max);
|
2001-02-18 17:56:37 +00:00
|
|
|
void snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
|
|
|
|
long min, long max);
|
2001-03-30 09:43:29 +00:00
|
|
|
|
|
|
|
size_t snd_mixer_selem_id_sizeof(void);
|
|
|
|
/** \hideinitializer
|
|
|
|
* \brief allocate an invalid #snd_mixer_selem_id_t using standard alloca
|
|
|
|
* \param ptr returned pointer
|
|
|
|
*/
|
|
|
|
#define snd_mixer_selem_id_alloca(ptr) do { assert(ptr); *ptr = (snd_mixer_selem_id_t *) alloca(snd_mixer_selem_id_sizeof()); memset(*ptr, 0, snd_mixer_selem_id_sizeof()); } while (0)
|
|
|
|
int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr);
|
|
|
|
void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj);
|
|
|
|
void snd_mixer_selem_id_copy(snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src);
|
|
|
|
const char *snd_mixer_selem_id_get_name(const snd_mixer_selem_id_t *obj);
|
|
|
|
unsigned int snd_mixer_selem_id_get_index(const snd_mixer_selem_id_t *obj);
|
|
|
|
void snd_mixer_selem_id_set_name(snd_mixer_selem_id_t *obj, const char *val);
|
|
|
|
void snd_mixer_selem_id_set_index(snd_mixer_selem_id_t *obj, unsigned int val);
|
|
|
|
|
2001-11-14 11:40:46 +00:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/** \} */
|
2001-03-30 09:43:29 +00:00
|
|
|
|
1998-08-13 15:42:56 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-09-13 11:38:32 +00:00
|
|
|
#endif /* __ALSA_MIXER_H */
|
|
|
|
|