mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Completed control and mixer API
This commit is contained in:
parent
c709b0a627
commit
fea0c73cdb
23 changed files with 1988 additions and 1251 deletions
131
include/mixer.h
131
include/mixer.h
|
|
@ -6,15 +6,42 @@
|
|||
****************************************************************************/
|
||||
|
||||
typedef struct _snd_mixer snd_mixer_t;
|
||||
typedef struct _snd_mixer_info snd_mixer_info_t;
|
||||
typedef struct _snd_mixer_elem snd_mixer_elem_t;
|
||||
typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl,
|
||||
snd_ctl_event_type_t event,
|
||||
snd_mixer_elem_t *elem);
|
||||
typedef int (*snd_mixer_elem_callback_t)(snd_mixer_elem_t *elem,
|
||||
snd_ctl_event_type_t event);
|
||||
|
||||
enum _snd_mixer_elem_type {
|
||||
SND_MIXER_ELEM_SIMPLE,
|
||||
SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE,
|
||||
};
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
typedef struct __snd_mixer_elem_type *snd_mixer_elem_type_t;
|
||||
#else
|
||||
typedef enum _snd_mixer_elem_type snd_mixer_elem_type_t;
|
||||
#endif
|
||||
|
||||
#define SND_MIXER_ELEM_SIMPLE ((snd_mixer_elem_type_t) SND_MIXER_ELEM_SIMPLE)
|
||||
#define SND_MIXER_ELEM_LAST ((snd_mixer_elem_type_t) SND_MIXER_ELEM_LAST)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int snd_mixer_open(snd_mixer_t **handle, char *name);
|
||||
int snd_mixer_close(snd_mixer_t *handle);
|
||||
int snd_mixer_card(snd_mixer_t *handle);
|
||||
int snd_mixer_poll_descriptor(snd_mixer_t *handle);
|
||||
int snd_mixer_open(snd_mixer_t **mixer, char *name);
|
||||
int snd_mixer_close(snd_mixer_t *mixer);
|
||||
int snd_mixer_poll_descriptor(snd_mixer_t *mixer);
|
||||
int snd_mixer_info(snd_mixer_t *mixer, snd_mixer_info_t *info);
|
||||
snd_mixer_elem_t *snd_mixer_first_elem(snd_mixer_t *mixer);
|
||||
snd_mixer_elem_t *snd_mixer_last_elem(snd_mixer_t *mixer);
|
||||
snd_mixer_elem_t *snd_mixer_elem_next(snd_mixer_elem_t *elem);
|
||||
snd_mixer_elem_t *snd_mixer_elem_prev(snd_mixer_elem_t *helem);
|
||||
int snd_mixer_events(snd_mixer_t *mixer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
@ -36,6 +63,11 @@ enum _snd_mixer_channel_id {
|
|||
SND_MIXER_CHN_MONO = SND_MIXER_CHN_FRONT_LEFT
|
||||
};
|
||||
|
||||
/* Simple mixer */
|
||||
|
||||
typedef struct _snd_mixer_selem snd_mixer_selem_t;
|
||||
typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
typedef struct __snd_mixer_channel_id *snd_mixer_channel_id_t;
|
||||
#else
|
||||
|
|
@ -52,79 +84,32 @@ typedef enum _snd_mixer_channel_id snd_mixer_channel_id_t;
|
|||
#define SND_MIXER_CHN_LAST ((snd_mixer_channel_id_t) SND_MIXER_CHN_LAST)
|
||||
#define SND_MIXER_CHN_MONO ((snd_mixer_channel_id_t) SND_MIXER_CHN_MONO)
|
||||
|
||||
#define SND_MIXER_CHN_MASK_MONO (1<<snd_enum_to_int(SND_MIXER_CHN_MONO))
|
||||
#define SND_MIXER_CHN_MASK_FRONT_LEFT (1<<snd_enum_to_int(SND_MIXER_CHN_FRONT_LEFT))
|
||||
#define SND_MIXER_CHN_MASK_FRONT_RIGHT (1<<snd_enum_to_int(SND_MIXER_CHN_FRONT_RIGHT))
|
||||
#define SND_MIXER_CHN_MASK_FRONT_CENTER (1<<snd_enum_to_int(SND_MIXER_CHN_FRONT_CENTER))
|
||||
#define SND_MIXER_CHN_MASK_REAR_LEFT (1<<snd_enum_to_int(SND_MIXER_CHN_REAR_LEFT))
|
||||
#define SND_MIXER_CHN_MASK_REAR_RIGHT (1<<snd_enum_to_int(SND_MIXER_CHN_REAR_RIGHT))
|
||||
#define SND_MIXER_CHN_MASK_WOOFER (1<<snd_enum_to_int(SND_MIXER_CHN_WOOFER))
|
||||
#define SND_MIXER_CHN_MASK_STEREO (SND_MIXER_CHN_MASK_FRONT_LEFT|SND_MIXER_CHN_MASK_FRONT_RIGHT)
|
||||
|
||||
#define SND_MIXER_SCTCAP_VOLUME (1<<0)
|
||||
#define SND_MIXER_SCTCAP_JOINTLY_VOLUME (1<<1)
|
||||
#define SND_MIXER_SCTCAP_MUTE (1<<2)
|
||||
#define SND_MIXER_SCTCAP_JOINTLY_MUTE (1<<3)
|
||||
#define SND_MIXER_SCTCAP_CAPTURE (1<<4)
|
||||
#define SND_MIXER_SCTCAP_JOINTLY_CAPTURE (1<<5)
|
||||
#define SND_MIXER_SCTCAP_EXCL_CAPTURE (1<<6)
|
||||
|
||||
typedef struct _snd_mixer_sid {
|
||||
unsigned char name[60];
|
||||
unsigned int index;
|
||||
} snd_mixer_sid_t;
|
||||
|
||||
typedef struct _snd_mixer_simple_element_list {
|
||||
unsigned int controls_offset; /* W: first control ID to get */
|
||||
unsigned int controls_request; /* W: count of control IDs to get */
|
||||
unsigned int controls_count; /* R: count of available (set) IDs */
|
||||
unsigned int controls; /* R: count of all available controls */
|
||||
snd_mixer_sid_t *pids; /* W: IDs */
|
||||
char reserved[50];
|
||||
} snd_mixer_simple_element_list_t;
|
||||
|
||||
typedef struct _snd_mixer_simple_element {
|
||||
snd_mixer_sid_t sid; /* WR: simple control identification */
|
||||
unsigned int caps; /* RO: capabilities */
|
||||
unsigned int channels; /* RO: bitmap of active channels */
|
||||
unsigned int mute; /* RW: bitmap of muted channels */
|
||||
unsigned int capture; /* RW: bitmap of capture channels */
|
||||
int capture_group; /* RO: capture group (for exclusive capture) */
|
||||
long min; /* RO: minimum value */
|
||||
long max; /* RO: maximum value */
|
||||
char reserved[32];
|
||||
union {
|
||||
struct {
|
||||
long front_left; /* front left value */
|
||||
long front_right; /* front right value */
|
||||
long front_center; /* front center */
|
||||
long rear_left; /* left rear */
|
||||
long rear_right; /* right rear */
|
||||
long woofer; /* woofer */
|
||||
} names;
|
||||
long values[32];
|
||||
} volume; /* RW */
|
||||
} snd_mixer_simple_element_t;
|
||||
|
||||
typedef struct _snd_mixer_simple_callbacks {
|
||||
void *private_data; /* may be used by an application */
|
||||
void (*rebuild) (snd_mixer_t *handle, void *private_data);
|
||||
void (*value) (snd_mixer_t *handle, void *private_data, snd_mixer_sid_t *id);
|
||||
void (*change) (snd_mixer_t *handle, void *private_data, snd_mixer_sid_t *id);
|
||||
void (*add) (snd_mixer_t *handle, void *private_data, snd_mixer_sid_t *id);
|
||||
void (*remove) (snd_mixer_t *handle, void *private_data, snd_mixer_sid_t *id);
|
||||
void *reserved[58]; /* reserved for future use - must be NULL!!! */
|
||||
} snd_mixer_simple_callbacks_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const char *snd_mixer_simple_channel_name(snd_mixer_channel_id_t channel);
|
||||
int snd_mixer_simple_element_list(snd_mixer_t *handle, snd_mixer_simple_element_list_t *list);
|
||||
int snd_mixer_simple_element_read(snd_mixer_t *handle, snd_mixer_simple_element_t *simple);
|
||||
int snd_mixer_simple_element_write(snd_mixer_t *handle, snd_mixer_simple_element_t *simple);
|
||||
int snd_mixer_simple_read(snd_mixer_t *handle, snd_mixer_simple_callbacks_t *callbacks);
|
||||
const char *snd_mixer_channel_name(snd_mixer_channel_id_t channel);
|
||||
int snd_mixer_simple_build(snd_mixer_t *mixer);
|
||||
snd_mixer_elem_t *snd_mixer_find_selem(snd_mixer_t *mixer,
|
||||
const snd_mixer_selem_id_t *id);
|
||||
void snd_mixer_selem_get_id(snd_mixer_elem_t *element,
|
||||
snd_mixer_selem_id_t *id);
|
||||
int snd_mixer_selem_read(snd_mixer_elem_t *element,
|
||||
snd_mixer_selem_t *simple);
|
||||
int snd_mixer_selem_write(snd_mixer_elem_t *element,
|
||||
const snd_mixer_selem_t *simple);
|
||||
|
||||
int snd_mixer_selem_is_mono(const snd_mixer_selem_t *obj);
|
||||
int snd_mixer_selem_has_channel(const snd_mixer_selem_t *obj, snd_mixer_channel_id_t channel);
|
||||
long snd_mixer_selem_get_volume(const snd_mixer_selem_t *obj, snd_mixer_channel_id_t channel);
|
||||
void snd_mixer_selem_set_volume(snd_mixer_selem_t *obj, snd_mixer_channel_id_t channel, long value);
|
||||
int snd_mixer_selem_get_mute(const snd_mixer_selem_t *obj, snd_mixer_channel_id_t channel);
|
||||
int snd_mixer_selem_get_capture(const snd_mixer_selem_t *obj, snd_mixer_channel_id_t channel);
|
||||
void snd_mixer_selem_set_mute(snd_mixer_selem_t *obj, snd_mixer_channel_id_t channel, int mute);
|
||||
void snd_mixer_selem_set_capture(snd_mixer_selem_t *obj, snd_mixer_channel_id_t channel, int capture);
|
||||
void snd_mixer_selem_set_mute_all(snd_mixer_selem_t *obj, int mute);
|
||||
void snd_mixer_selem_set_capture_all(snd_mixer_selem_t *obj, int capture);
|
||||
void snd_mixer_selem_set_volume_all(snd_mixer_selem_t *obj, long value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue