mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Better names for control API
This commit is contained in:
parent
66f13f6115
commit
45c416ed82
22 changed files with 666 additions and 668 deletions
|
|
@ -572,27 +572,27 @@ int ctl_shm_cmd(client_t *client)
|
|||
ctl = client->device.control.handle;
|
||||
switch (cmd) {
|
||||
case SNDRV_CTL_IOCTL_INFO:
|
||||
ctrl->result = snd_ctl_info(ctl, &ctrl->u.hw_info);
|
||||
ctrl->result = snd_ctl_card_info(ctl, &ctrl->u.hw_info);
|
||||
break;
|
||||
case SNDRV_CTL_IOCTL_CONTROL_LIST:
|
||||
case SNDRV_CTL_IOCTL_ELEMENT_LIST:
|
||||
{
|
||||
size_t maxsize = CTL_SHM_DATA_MAXLEN;
|
||||
if (ctrl->u.clist.space * sizeof(*ctrl->u.clist.pids) > maxsize) {
|
||||
ctrl->result = -EFAULT;
|
||||
break;
|
||||
}
|
||||
ctrl->u.clist.pids = (snd_control_id_t*) ctrl->data;
|
||||
ctrl->u.clist.pids = (snd_ctl_element_id_t*) ctrl->data;
|
||||
ctrl->result = snd_ctl_clist(ctl, &ctrl->u.clist);
|
||||
break;
|
||||
}
|
||||
case SNDRV_CTL_IOCTL_CONTROL_INFO:
|
||||
ctrl->result = snd_ctl_cinfo(ctl, &ctrl->u.cinfo);
|
||||
case SNDRV_CTL_IOCTL_ELEMENT_INFO:
|
||||
ctrl->result = snd_ctl_element_info(ctl, &ctrl->u.cinfo);
|
||||
break;
|
||||
case SNDRV_CTL_IOCTL_CONTROL_READ:
|
||||
ctrl->result = snd_ctl_cread(ctl, &ctrl->u.cread);
|
||||
case SNDRV_CTL_IOCTL_ELEMENT_READ:
|
||||
ctrl->result = snd_ctl_element_read(ctl, &ctrl->u.cread);
|
||||
break;
|
||||
case SNDRV_CTL_IOCTL_CONTROL_WRITE:
|
||||
ctrl->result = snd_ctl_cwrite(ctl, &ctrl->u.cwrite);
|
||||
case SNDRV_CTL_IOCTL_ELEMENT_WRITE:
|
||||
ctrl->result = snd_ctl_element_write(ctl, &ctrl->u.cwrite);
|
||||
break;
|
||||
case SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE:
|
||||
ctrl->result = snd_ctl_hwdep_next_device(ctl, &ctrl->u.device);
|
||||
|
|
|
|||
|
|
@ -89,11 +89,11 @@ typedef struct {
|
|||
int cmd;
|
||||
union {
|
||||
int device;
|
||||
snd_ctl_info_t hw_info;
|
||||
snd_control_list_t clist;
|
||||
snd_control_info_t cinfo;
|
||||
snd_control_t cread;
|
||||
snd_control_t cwrite;
|
||||
snd_ctl_card_info_t hw_info;
|
||||
snd_ctl_element_list_t clist;
|
||||
snd_ctl_element_info_t cinfo;
|
||||
snd_ctl_element_t cread;
|
||||
snd_ctl_element_t cwrite;
|
||||
snd_hwdep_info_t hwdep_info;
|
||||
snd_pcm_info_t pcm_info;
|
||||
int pcm_prefer_subdevice;
|
||||
|
|
|
|||
|
|
@ -6,22 +6,22 @@
|
|||
****************************************************************************/
|
||||
|
||||
typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
|
||||
typedef struct _snd_ctl_info snd_ctl_info_t;
|
||||
typedef struct _snd_control_id snd_control_id_t;
|
||||
typedef struct _snd_control_list snd_control_list_t;
|
||||
typedef struct _snd_control_info snd_control_info_t;
|
||||
typedef struct _snd_control snd_control_t;
|
||||
typedef struct _snd_ctl_card_info snd_ctl_card_info_t;
|
||||
typedef struct _snd_ctl_element_id snd_ctl_element_id_t;
|
||||
typedef struct _snd_ctl_element_list snd_ctl_element_list_t;
|
||||
typedef struct _snd_ctl_element_info snd_ctl_element_info_t;
|
||||
typedef struct _snd_ctl_element snd_ctl_element_t;
|
||||
typedef struct _snd_ctl_event snd_ctl_event_t;
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
typedef struct __snd_card_type *snd_card_type_t;
|
||||
typedef struct __snd_control_type *snd_control_type_t;
|
||||
typedef struct __snd_control_iface *snd_control_iface_t;
|
||||
typedef struct __snd_ctl_element_type *snd_ctl_element_type_t;
|
||||
typedef struct __snd_ctl_element_iface *snd_ctl_element_iface_t;
|
||||
typedef struct __snd_ctl_event_type *snd_ctl_event_type_t;
|
||||
#else
|
||||
typedef enum sndrv_card_type snd_card_type_t;
|
||||
typedef enum sndrv_control_type snd_control_type_t;
|
||||
typedef enum sndrv_control_iface snd_control_iface_t;
|
||||
typedef enum sndrv_ctl_element_type snd_ctl_element_type_t;
|
||||
typedef enum sndrv_ctl_element_iface snd_ctl_element_iface_t;
|
||||
typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
|
||||
#endif
|
||||
|
||||
|
|
@ -95,22 +95,22 @@ typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
|
|||
#define SND_CARD_TYPE_VIA8233 ((snd_card_type_t) SNDRV_CARD_TYPE_VIA8233)
|
||||
#define SND_CARD_TYPE_LAST ((snd_card_type_t) SNDRV_CARD_TYPE_LAST)
|
||||
|
||||
#define SND_CONTROL_TYPE_NONE ((snd_control_type_t) SNDRV_CONTROL_TYPE_NONE)
|
||||
#define SND_CONTROL_TYPE_BOOLEAN ((snd_control_type_t) SNDRV_CONTROL_TYPE_BOOLEAN)
|
||||
#define SND_CONTROL_TYPE_INTEGER ((snd_control_type_t) SNDRV_CONTROL_TYPE_INTEGER)
|
||||
#define SND_CONTROL_TYPE_ENUMERATED ((snd_control_type_t) SNDRV_CONTROL_TYPE_ENUMERATED)
|
||||
#define SND_CONTROL_TYPE_BYTES ((snd_control_type_t) SNDRV_CONTROL_TYPE_BYTES)
|
||||
#define SND_CONTROL_TYPE_IEC958 ((snd_control_type_t) SNDRV_CONTROL_TYPE_IEC958)
|
||||
#define SND_CONTROL_TYPE_LAST ((snd_control_type_t) SNDRV_CONTROL_TYPE_LAST)
|
||||
#define SND_CTL_ELEMENT_TYPE_NONE ((snd_ctl_element_type_t) SNDRV_CTL_ELEMENT_TYPE_NONE)
|
||||
#define SND_CTL_ELEMENT_TYPE_BOOLEAN ((snd_ctl_element_type_t) SNDRV_CTL_ELEMENT_TYPE_BOOLEAN)
|
||||
#define SND_CTL_ELEMENT_TYPE_INTEGER ((snd_ctl_element_type_t) SNDRV_CTL_ELEMENT_TYPE_INTEGER)
|
||||
#define SND_CTL_ELEMENT_TYPE_ENUMERATED ((snd_ctl_element_type_t) SNDRV_CTL_ELEMENT_TYPE_ENUMERATED)
|
||||
#define SND_CTL_ELEMENT_TYPE_BYTES ((snd_ctl_element_type_t) SNDRV_CTL_ELEMENT_TYPE_BYTES)
|
||||
#define SND_CTL_ELEMENT_TYPE_IEC958 ((snd_ctl_element_type_t) SNDRV_CTL_ELEMENT_TYPE_IEC958)
|
||||
#define SND_CTL_ELEMENT_TYPE_LAST ((snd_ctl_element_type_t) SNDRV_CTL_ELEMENT_TYPE_LAST)
|
||||
|
||||
#define SND_CONTROL_IFACE_CARD ((snd_control_iface_t) SNDRV_CONTROL_IFACE_CARD)
|
||||
#define SND_CONTROL_IFACE_HWDEP ((snd_control_iface_t) SNDRV_CONTROL_IFACE_HWDEP)
|
||||
#define SND_CONTROL_IFACE_MIXER ((snd_control_iface_t) SNDRV_CONTROL_IFACE_MIXER)
|
||||
#define SND_CONTROL_IFACE_PCM ((snd_control_iface_t) SNDRV_CONTROL_IFACE_PCM)
|
||||
#define SND_CONTROL_IFACE_RAWMIDI ((snd_control_iface_t) SNDRV_CONTROL_IFACE_RAWMIDI)
|
||||
#define SND_CONTROL_IFACE_TIMER ((snd_control_iface_t) SNDRV_CONTROL_IFACE_TIMER)
|
||||
#define SND_CONTROL_IFACE_SEQUENCER ((snd_control_iface_t) SNDRV_CONTROL_IFACE_SEQUENCER)
|
||||
#define SND_CONTROL_IFACE_LAST ((snd_control_iface_t) SNDRV_CONTROL_IFACE_LAST)
|
||||
#define SND_CTL_ELEMENT_IFACE_CARD ((snd_ctl_element_iface_t) SNDRV_CTL_ELEMENT_IFACE_CARD)
|
||||
#define SND_CTL_ELEMENT_IFACE_HWDEP ((snd_ctl_element_iface_t) SNDRV_CTL_ELEMENT_IFACE_HWDEP)
|
||||
#define SND_CTL_ELEMENT_IFACE_MIXER ((snd_ctl_element_iface_t) SNDRV_CTL_ELEMENT_IFACE_MIXER)
|
||||
#define SND_CTL_ELEMENT_IFACE_PCM ((snd_ctl_element_iface_t) SNDRV_CTL_ELEMENT_IFACE_PCM)
|
||||
#define SND_CTL_ELEMENT_IFACE_RAWMIDI ((snd_ctl_element_iface_t) SNDRV_CTL_ELEMENT_IFACE_RAWMIDI)
|
||||
#define SND_CTL_ELEMENT_IFACE_TIMER ((snd_ctl_element_iface_t) SNDRV_CTL_ELEMENT_IFACE_TIMER)
|
||||
#define SND_CTL_ELEMENT_IFACE_SEQUENCER ((snd_ctl_element_iface_t) SNDRV_CTL_ELEMENT_IFACE_SEQUENCER)
|
||||
#define SND_CTL_ELEMENT_IFACE_LAST ((snd_ctl_element_iface_t) SNDRV_CTL_ELEMENT_IFACE_LAST)
|
||||
|
||||
#define SND_CTL_EVENT_REBUILD ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_REBUILD)
|
||||
#define SND_CTL_EVENT_VALUE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_VALUE)
|
||||
|
|
@ -160,11 +160,11 @@ int snd_ctl_open(snd_ctl_t **handle, char *name);
|
|||
int snd_ctl_close(snd_ctl_t *handle);
|
||||
int snd_ctl_card(snd_ctl_t *handle);
|
||||
int snd_ctl_poll_descriptor(snd_ctl_t *handle);
|
||||
int snd_ctl_info(snd_ctl_t *handle, snd_ctl_info_t *info);
|
||||
int snd_ctl_clist(snd_ctl_t *handle, snd_control_list_t * list);
|
||||
int snd_ctl_cinfo(snd_ctl_t *handle, snd_control_info_t * sw);
|
||||
int snd_ctl_cread(snd_ctl_t *handle, snd_control_t * control);
|
||||
int snd_ctl_cwrite(snd_ctl_t *handle, snd_control_t * control);
|
||||
int snd_ctl_card_info(snd_ctl_t *handle, snd_ctl_card_info_t *info);
|
||||
int snd_ctl_clist(snd_ctl_t *handle, snd_ctl_element_list_t * list);
|
||||
int snd_ctl_element_info(snd_ctl_t *handle, snd_ctl_element_info_t * sw);
|
||||
int snd_ctl_element_read(snd_ctl_t *handle, snd_ctl_element_t * control);
|
||||
int snd_ctl_element_write(snd_ctl_t *handle, snd_ctl_element_t * control);
|
||||
int snd_ctl_hwdep_next_device(snd_ctl_t *handle, int * device);
|
||||
int snd_ctl_hwdep_info(snd_ctl_t *handle, snd_hwdep_info_t * info);
|
||||
int snd_ctl_pcm_next_device(snd_ctl_t *handle, int *device);
|
||||
|
|
@ -176,14 +176,14 @@ int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *handle, int subdev);
|
|||
|
||||
int snd_ctl_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks);
|
||||
|
||||
void snd_control_set_bytes(snd_control_t *obj, void *data, size_t size);
|
||||
void snd_ctl_element_set_bytes(snd_ctl_element_t *obj, void *data, size_t size);
|
||||
|
||||
const char *snd_control_type_name(snd_control_type_t type);
|
||||
const char *snd_control_iface_name(snd_control_iface_t iface);
|
||||
const char *snd_ctl_element_type_name(snd_ctl_element_type_t type);
|
||||
const char *snd_ctl_element_iface_name(snd_ctl_element_iface_t iface);
|
||||
const char *snd_ctl_event_type_name(snd_ctl_event_type_t type);
|
||||
|
||||
int snd_control_list_alloc_space(snd_control_list_t *obj, unsigned int entries);
|
||||
void snd_control_list_free_space(snd_control_list_t *obj);
|
||||
int snd_ctl_element_list_alloc_space(snd_ctl_element_list_t *obj, unsigned int entries);
|
||||
void snd_ctl_element_list_free_space(snd_ctl_element_list_t *obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
@ -193,41 +193,41 @@ void snd_control_list_free_space(snd_control_list_t *obj);
|
|||
* Highlevel API for controls
|
||||
*/
|
||||
|
||||
typedef struct _snd_hcontrol_list snd_hcontrol_list_t;
|
||||
typedef struct _snd_hcontrol snd_hcontrol_t;
|
||||
typedef struct _snd_hctl_element_list snd_hctl_element_list_t;
|
||||
typedef struct _snd_hctl_element snd_hctl_element_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int (*snd_ctl_hsort_t)(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2);
|
||||
typedef int (*snd_ctl_hsort_t)(const snd_hctl_element_t *c1, const snd_hctl_element_t *c2);
|
||||
typedef void (*snd_ctl_hcallback_rebuild_t)(snd_ctl_t *handle, void *private_data);
|
||||
typedef void (*snd_ctl_hcallback_add_t)(snd_ctl_t *handle, void *private_data, snd_hcontrol_t *hcontrol);
|
||||
typedef void (*snd_hcontrol_callback_t)(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
|
||||
typedef void (*snd_hcontrol_private_free_t)(snd_hcontrol_t *hcontrol);
|
||||
typedef void (*snd_ctl_hcallback_add_t)(snd_ctl_t *handle, void *private_data, snd_hctl_element_t *helem);
|
||||
typedef void (*snd_hctl_element_callback_t)(snd_ctl_t *handle, snd_hctl_element_t *helem);
|
||||
typedef void (*snd_hctl_element_private_free_t)(snd_hctl_element_t *helem);
|
||||
|
||||
int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t csort);
|
||||
int snd_ctl_hfree(snd_ctl_t *handle);
|
||||
snd_hcontrol_t *snd_ctl_hfirst(snd_ctl_t *handle);
|
||||
snd_hcontrol_t *snd_ctl_hlast(snd_ctl_t *handle);
|
||||
snd_hcontrol_t *snd_ctl_hnext(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
|
||||
snd_hcontrol_t *snd_ctl_hprev(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
|
||||
snd_hctl_element_t *snd_ctl_hfirst(snd_ctl_t *handle);
|
||||
snd_hctl_element_t *snd_ctl_hlast(snd_ctl_t *handle);
|
||||
snd_hctl_element_t *snd_ctl_hnext(snd_ctl_t *handle, snd_hctl_element_t *helem);
|
||||
snd_hctl_element_t *snd_ctl_hprev(snd_ctl_t *handle, snd_hctl_element_t *helem);
|
||||
int snd_ctl_hcount(snd_ctl_t *handle);
|
||||
snd_hcontrol_t *snd_ctl_hfind(snd_ctl_t *handle, snd_control_id_t *id);
|
||||
int snd_ctl_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist);
|
||||
int snd_ctl_hsort(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2);
|
||||
snd_hctl_element_t *snd_ctl_hfind(snd_ctl_t *handle, snd_ctl_element_id_t *id);
|
||||
int snd_ctl_hlist(snd_ctl_t *handle, snd_hctl_element_list_t *hlist);
|
||||
int snd_ctl_hsort(const snd_hctl_element_t *c1, const snd_hctl_element_t *c2);
|
||||
int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t csort);
|
||||
int snd_ctl_hcallback_rebuild(snd_ctl_t *handle, snd_ctl_hcallback_rebuild_t callback, void *private_data);
|
||||
int snd_ctl_hcallback_add(snd_ctl_t *handle, snd_ctl_hcallback_add_t callback, void *private_data);
|
||||
int snd_ctl_hevent(snd_ctl_t *handle);
|
||||
|
||||
int snd_ctl_hbag_create(void **bag);
|
||||
int snd_ctl_hbag_destroy(void **bag, void (*hcontrol_free)(snd_hcontrol_t *hcontrol));
|
||||
int snd_ctl_hbag_add(void **bag, snd_hcontrol_t *hcontrol);
|
||||
int snd_ctl_hbag_del(void **bag, snd_hcontrol_t *hcontrol);
|
||||
snd_hcontrol_t *snd_ctl_hbag_find(void **bag, snd_control_id_t *id);
|
||||
int snd_hcontrol_list_alloc_space(snd_hcontrol_list_t *obj, unsigned int entries);
|
||||
void snd_hcontrol_list_free_space(snd_hcontrol_list_t *obj);
|
||||
int snd_ctl_hbag_destroy(void **bag, void (*hctl_element_free)(snd_hctl_element_t *helem));
|
||||
int snd_ctl_hbag_add(void **bag, snd_hctl_element_t *helem);
|
||||
int snd_ctl_hbag_del(void **bag, snd_hctl_element_t *helem);
|
||||
snd_hctl_element_t *snd_ctl_hbag_find(void **bag, snd_ctl_element_id_t *id);
|
||||
int snd_hctl_element_list_alloc_space(snd_hctl_element_list_t *obj, unsigned int entries);
|
||||
void snd_hctl_element_list_free_space(snd_hctl_element_list_t *obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,57 +2,57 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
size_t snd_control_id_sizeof();
|
||||
#define snd_control_id_alloca(ptr) ({ assert(ptr); *ptr = (snd_control_id_t *) alloca(snd_control_id_sizeof()); memset(*ptr, 0, snd_control_id_sizeof()); 0; })
|
||||
int snd_control_id_malloc(snd_control_id_t **ptr);
|
||||
void snd_control_id_free(snd_control_id_t *obj);
|
||||
void snd_control_id_copy(snd_control_id_t *dst, const snd_control_id_t *src);
|
||||
size_t snd_ctl_element_id_sizeof();
|
||||
#define snd_ctl_element_id_alloca(ptr) ({ assert(ptr); *ptr = (snd_ctl_element_id_t *) alloca(snd_ctl_element_id_sizeof()); memset(*ptr, 0, snd_ctl_element_id_sizeof()); 0; })
|
||||
int snd_ctl_element_id_malloc(snd_ctl_element_id_t **ptr);
|
||||
void snd_ctl_element_id_free(snd_ctl_element_id_t *obj);
|
||||
void snd_ctl_element_id_copy(snd_ctl_element_id_t *dst, const snd_ctl_element_id_t *src);
|
||||
|
||||
unsigned int snd_control_id_get_numid(const snd_control_id_t *obj);
|
||||
unsigned int snd_ctl_element_id_get_numid(const snd_ctl_element_id_t *obj);
|
||||
|
||||
snd_control_iface_t snd_control_id_get_interface(const snd_control_id_t *obj);
|
||||
snd_ctl_element_iface_t snd_ctl_element_id_get_interface(const snd_ctl_element_id_t *obj);
|
||||
|
||||
unsigned int snd_control_id_get_device(const snd_control_id_t *obj);
|
||||
unsigned int snd_ctl_element_id_get_device(const snd_ctl_element_id_t *obj);
|
||||
|
||||
unsigned int snd_control_id_get_subdevice(const snd_control_id_t *obj);
|
||||
unsigned int snd_ctl_element_id_get_subdevice(const snd_ctl_element_id_t *obj);
|
||||
|
||||
const char *snd_control_id_get_name(const snd_control_id_t *obj);
|
||||
const char *snd_ctl_element_id_get_name(const snd_ctl_element_id_t *obj);
|
||||
|
||||
unsigned int snd_control_id_get_index(const snd_control_id_t *obj);
|
||||
unsigned int snd_ctl_element_id_get_index(const snd_ctl_element_id_t *obj);
|
||||
|
||||
void snd_control_id_set_numid(snd_control_id_t *obj, unsigned int val);
|
||||
void snd_ctl_element_id_set_numid(snd_ctl_element_id_t *obj, unsigned int val);
|
||||
|
||||
void snd_control_id_set_interface(snd_control_id_t *obj, snd_control_iface_t val);
|
||||
void snd_ctl_element_id_set_interface(snd_ctl_element_id_t *obj, snd_ctl_element_iface_t val);
|
||||
|
||||
void snd_control_id_set_device(snd_control_id_t *obj, unsigned int val);
|
||||
void snd_ctl_element_id_set_device(snd_ctl_element_id_t *obj, unsigned int val);
|
||||
|
||||
void snd_control_id_set_subdevice(snd_control_id_t *obj, unsigned int val);
|
||||
void snd_ctl_element_id_set_subdevice(snd_ctl_element_id_t *obj, unsigned int val);
|
||||
|
||||
void snd_control_id_set_name(snd_control_id_t *obj, const char *val);
|
||||
void snd_ctl_element_id_set_name(snd_ctl_element_id_t *obj, const char *val);
|
||||
|
||||
void snd_control_id_set_index(snd_control_id_t *obj, unsigned int val);
|
||||
void snd_ctl_element_id_set_index(snd_ctl_element_id_t *obj, unsigned int val);
|
||||
|
||||
size_t snd_ctl_info_sizeof();
|
||||
#define snd_ctl_info_alloca(ptr) ({ assert(ptr); *ptr = (snd_ctl_info_t *) alloca(snd_ctl_info_sizeof()); memset(*ptr, 0, snd_ctl_info_sizeof()); 0; })
|
||||
int snd_ctl_info_malloc(snd_ctl_info_t **ptr);
|
||||
void snd_ctl_info_free(snd_ctl_info_t *obj);
|
||||
void snd_ctl_info_copy(snd_ctl_info_t *dst, const snd_ctl_info_t *src);
|
||||
size_t snd_ctl_card_info_sizeof();
|
||||
#define snd_ctl_card_info_alloca(ptr) ({ assert(ptr); *ptr = (snd_ctl_card_info_t *) alloca(snd_ctl_card_info_sizeof()); memset(*ptr, 0, snd_ctl_card_info_sizeof()); 0; })
|
||||
int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr);
|
||||
void snd_ctl_card_info_free(snd_ctl_card_info_t *obj);
|
||||
void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t *src);
|
||||
|
||||
int snd_ctl_info_get_card(const snd_ctl_info_t *obj);
|
||||
int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj);
|
||||
|
||||
snd_card_type_t snd_ctl_info_get_type(const snd_ctl_info_t *obj);
|
||||
snd_card_type_t snd_ctl_card_info_get_type(const snd_ctl_card_info_t *obj);
|
||||
|
||||
const char *snd_ctl_info_get_id(const snd_ctl_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj);
|
||||
|
||||
const char *snd_ctl_info_get_abbreviation(const snd_ctl_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_abbreviation(const snd_ctl_card_info_t *obj);
|
||||
|
||||
const char *snd_ctl_info_get_name(const snd_ctl_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj);
|
||||
|
||||
const char *snd_ctl_info_get_longname(const snd_ctl_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj);
|
||||
|
||||
const char *snd_ctl_info_get_mixerid(const snd_ctl_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_mixerid(const snd_ctl_card_info_t *obj);
|
||||
|
||||
const char *snd_ctl_info_get_mixername(const snd_ctl_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj);
|
||||
|
||||
size_t snd_ctl_event_sizeof();
|
||||
#define snd_ctl_event_alloca(ptr) ({ assert(ptr); *ptr = (snd_ctl_event_t *) alloca(snd_ctl_event_sizeof()); memset(*ptr, 0, snd_ctl_event_sizeof()); 0; })
|
||||
|
|
@ -64,9 +64,9 @@ snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj);
|
|||
|
||||
unsigned int snd_ctl_event_get_numid(const snd_ctl_event_t *obj);
|
||||
|
||||
void snd_ctl_event_get_id(const snd_ctl_event_t *obj, snd_control_id_t *ptr);
|
||||
void snd_ctl_event_get_id(const snd_ctl_event_t *obj, snd_ctl_element_id_t *ptr);
|
||||
|
||||
snd_control_iface_t snd_ctl_event_get_interface(const snd_ctl_event_t *obj);
|
||||
snd_ctl_element_iface_t snd_ctl_event_get_interface(const snd_ctl_event_t *obj);
|
||||
|
||||
unsigned int snd_ctl_event_get_device(const snd_ctl_event_t *obj);
|
||||
|
||||
|
|
@ -76,207 +76,207 @@ const char *snd_ctl_event_get_name(const snd_ctl_event_t *obj);
|
|||
|
||||
unsigned int snd_ctl_event_get_index(const snd_ctl_event_t *obj);
|
||||
|
||||
size_t snd_control_list_sizeof();
|
||||
#define snd_control_list_alloca(ptr) ({ assert(ptr); *ptr = (snd_control_list_t *) alloca(snd_control_list_sizeof()); memset(*ptr, 0, snd_control_list_sizeof()); 0; })
|
||||
int snd_control_list_malloc(snd_control_list_t **ptr);
|
||||
void snd_control_list_free(snd_control_list_t *obj);
|
||||
void snd_control_list_copy(snd_control_list_t *dst, const snd_control_list_t *src);
|
||||
size_t snd_ctl_element_list_sizeof();
|
||||
#define snd_ctl_element_list_alloca(ptr) ({ assert(ptr); *ptr = (snd_ctl_element_list_t *) alloca(snd_ctl_element_list_sizeof()); memset(*ptr, 0, snd_ctl_element_list_sizeof()); 0; })
|
||||
int snd_ctl_element_list_malloc(snd_ctl_element_list_t **ptr);
|
||||
void snd_ctl_element_list_free(snd_ctl_element_list_t *obj);
|
||||
void snd_ctl_element_list_copy(snd_ctl_element_list_t *dst, const snd_ctl_element_list_t *src);
|
||||
|
||||
void snd_control_list_set_offset(snd_control_list_t *obj, unsigned int val);
|
||||
void snd_ctl_element_list_set_offset(snd_ctl_element_list_t *obj, unsigned int val);
|
||||
|
||||
unsigned int snd_control_list_get_used(const snd_control_list_t *obj);
|
||||
unsigned int snd_ctl_element_list_get_used(const snd_ctl_element_list_t *obj);
|
||||
|
||||
unsigned int snd_control_list_get_count(const snd_control_list_t *obj);
|
||||
unsigned int snd_ctl_element_list_get_count(const snd_ctl_element_list_t *obj);
|
||||
|
||||
void snd_control_list_get_id(const snd_control_list_t *obj, unsigned int idx, snd_control_id_t *ptr);
|
||||
void snd_ctl_element_list_get_id(const snd_ctl_element_list_t *obj, unsigned int idx, snd_ctl_element_id_t *ptr);
|
||||
|
||||
unsigned int snd_control_list_get_numid(const snd_control_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_ctl_element_list_get_numid(const snd_ctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
snd_control_iface_t snd_control_list_get_interface(const snd_control_list_t *obj, unsigned int idx);
|
||||
snd_ctl_element_iface_t snd_ctl_element_list_get_interface(const snd_ctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
unsigned int snd_control_list_get_device(const snd_control_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_ctl_element_list_get_device(const snd_ctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
unsigned int snd_control_list_get_subdevice(const snd_control_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_ctl_element_list_get_subdevice(const snd_ctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
const char *snd_control_list_get_name(const snd_control_list_t *obj, unsigned int idx);
|
||||
const char *snd_ctl_element_list_get_name(const snd_ctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
unsigned int snd_control_list_get_index(const snd_control_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_ctl_element_list_get_index(const snd_ctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
size_t snd_control_info_sizeof();
|
||||
#define snd_control_info_alloca(ptr) ({ assert(ptr); *ptr = (snd_control_info_t *) alloca(snd_control_info_sizeof()); memset(*ptr, 0, snd_control_info_sizeof()); 0; })
|
||||
int snd_control_info_malloc(snd_control_info_t **ptr);
|
||||
void snd_control_info_free(snd_control_info_t *obj);
|
||||
void snd_control_info_copy(snd_control_info_t *dst, const snd_control_info_t *src);
|
||||
size_t snd_ctl_element_info_sizeof();
|
||||
#define snd_ctl_element_info_alloca(ptr) ({ assert(ptr); *ptr = (snd_ctl_element_info_t *) alloca(snd_ctl_element_info_sizeof()); memset(*ptr, 0, snd_ctl_element_info_sizeof()); 0; })
|
||||
int snd_ctl_element_info_malloc(snd_ctl_element_info_t **ptr);
|
||||
void snd_ctl_element_info_free(snd_ctl_element_info_t *obj);
|
||||
void snd_ctl_element_info_copy(snd_ctl_element_info_t *dst, const snd_ctl_element_info_t *src);
|
||||
|
||||
snd_control_type_t snd_control_info_get_type(const snd_control_info_t *obj);
|
||||
snd_ctl_element_type_t snd_ctl_element_info_get_type(const snd_ctl_element_info_t *obj);
|
||||
|
||||
int snd_control_info_is_readable(const snd_control_info_t *obj);
|
||||
int snd_ctl_element_info_is_readable(const snd_ctl_element_info_t *obj);
|
||||
|
||||
int snd_control_info_is_writable(const snd_control_info_t *obj);
|
||||
int snd_ctl_element_info_is_writable(const snd_ctl_element_info_t *obj);
|
||||
|
||||
int snd_control_info_is_volatile(const snd_control_info_t *obj);
|
||||
int snd_ctl_element_info_is_volatile(const snd_ctl_element_info_t *obj);
|
||||
|
||||
int snd_control_info_is_inactive(const snd_control_info_t *obj);
|
||||
int snd_ctl_element_info_is_inactive(const snd_ctl_element_info_t *obj);
|
||||
|
||||
int snd_control_info_is_locked(const snd_control_info_t *obj);
|
||||
int snd_ctl_element_info_is_locked(const snd_ctl_element_info_t *obj);
|
||||
|
||||
int snd_control_info_is_indirect(const snd_control_info_t *obj);
|
||||
int snd_ctl_element_info_is_indirect(const snd_ctl_element_info_t *obj);
|
||||
|
||||
unsigned int snd_control_info_get_count(const snd_control_info_t *obj);
|
||||
unsigned int snd_ctl_element_info_get_count(const snd_ctl_element_info_t *obj);
|
||||
|
||||
long snd_control_info_get_min(const snd_control_info_t *obj);
|
||||
long snd_ctl_element_info_get_min(const snd_ctl_element_info_t *obj);
|
||||
|
||||
long snd_control_info_get_max(const snd_control_info_t *obj);
|
||||
long snd_ctl_element_info_get_max(const snd_ctl_element_info_t *obj);
|
||||
|
||||
long snd_control_info_get_step(const snd_control_info_t *obj);
|
||||
long snd_ctl_element_info_get_step(const snd_ctl_element_info_t *obj);
|
||||
|
||||
unsigned int snd_control_info_get_items(const snd_control_info_t *obj);
|
||||
unsigned int snd_ctl_element_info_get_items(const snd_ctl_element_info_t *obj);
|
||||
|
||||
void snd_control_info_set_item(snd_control_info_t *obj, unsigned int val);
|
||||
void snd_ctl_element_info_set_item(snd_ctl_element_info_t *obj, unsigned int val);
|
||||
|
||||
const char *snd_control_info_get_item_name(const snd_control_info_t *obj);
|
||||
const char *snd_ctl_element_info_get_item_name(const snd_ctl_element_info_t *obj);
|
||||
|
||||
void snd_control_info_get_id(const snd_control_info_t *obj, snd_control_id_t *ptr);
|
||||
void snd_ctl_element_info_get_id(const snd_ctl_element_info_t *obj, snd_ctl_element_id_t *ptr);
|
||||
|
||||
unsigned int snd_control_info_get_numid(const snd_control_info_t *obj);
|
||||
unsigned int snd_ctl_element_info_get_numid(const snd_ctl_element_info_t *obj);
|
||||
|
||||
snd_control_iface_t snd_control_info_get_interface(const snd_control_info_t *obj);
|
||||
snd_ctl_element_iface_t snd_ctl_element_info_get_interface(const snd_ctl_element_info_t *obj);
|
||||
|
||||
unsigned int snd_control_info_get_device(const snd_control_info_t *obj);
|
||||
unsigned int snd_ctl_element_info_get_device(const snd_ctl_element_info_t *obj);
|
||||
|
||||
unsigned int snd_control_info_get_subdevice(const snd_control_info_t *obj);
|
||||
unsigned int snd_ctl_element_info_get_subdevice(const snd_ctl_element_info_t *obj);
|
||||
|
||||
const char *snd_control_info_get_name(const snd_control_info_t *obj);
|
||||
const char *snd_ctl_element_info_get_name(const snd_ctl_element_info_t *obj);
|
||||
|
||||
unsigned int snd_control_info_get_index(const snd_control_info_t *obj);
|
||||
unsigned int snd_ctl_element_info_get_index(const snd_ctl_element_info_t *obj);
|
||||
|
||||
void snd_control_info_set_id(snd_control_info_t *obj, const snd_control_id_t *ptr);
|
||||
void snd_ctl_element_info_set_id(snd_ctl_element_info_t *obj, const snd_ctl_element_id_t *ptr);
|
||||
|
||||
void snd_control_info_set_numid(snd_control_info_t *obj, unsigned int val);
|
||||
void snd_ctl_element_info_set_numid(snd_ctl_element_info_t *obj, unsigned int val);
|
||||
|
||||
void snd_control_info_set_interface(snd_control_info_t *obj, snd_control_iface_t val);
|
||||
void snd_ctl_element_info_set_interface(snd_ctl_element_info_t *obj, snd_ctl_element_iface_t val);
|
||||
|
||||
void snd_control_info_set_device(snd_control_info_t *obj, unsigned int val);
|
||||
void snd_ctl_element_info_set_device(snd_ctl_element_info_t *obj, unsigned int val);
|
||||
|
||||
void snd_control_info_set_subdevice(snd_control_info_t *obj, unsigned int val);
|
||||
void snd_ctl_element_info_set_subdevice(snd_ctl_element_info_t *obj, unsigned int val);
|
||||
|
||||
void snd_control_info_set_name(snd_control_info_t *obj, const char *val);
|
||||
void snd_ctl_element_info_set_name(snd_ctl_element_info_t *obj, const char *val);
|
||||
|
||||
void snd_control_info_set_index(snd_control_info_t *obj, unsigned int val);
|
||||
void snd_ctl_element_info_set_index(snd_ctl_element_info_t *obj, unsigned int val);
|
||||
|
||||
size_t snd_control_sizeof();
|
||||
#define snd_control_alloca(ptr) ({ assert(ptr); *ptr = (snd_control_t *) alloca(snd_control_sizeof()); memset(*ptr, 0, snd_control_sizeof()); 0; })
|
||||
int snd_control_malloc(snd_control_t **ptr);
|
||||
void snd_control_free(snd_control_t *obj);
|
||||
void snd_control_copy(snd_control_t *dst, const snd_control_t *src);
|
||||
size_t snd_ctl_element_sizeof();
|
||||
#define snd_ctl_element_alloca(ptr) ({ assert(ptr); *ptr = (snd_ctl_element_t *) alloca(snd_ctl_element_sizeof()); memset(*ptr, 0, snd_ctl_element_sizeof()); 0; })
|
||||
int snd_ctl_element_malloc(snd_ctl_element_t **ptr);
|
||||
void snd_ctl_element_free(snd_ctl_element_t *obj);
|
||||
void snd_ctl_element_copy(snd_ctl_element_t *dst, const snd_ctl_element_t *src);
|
||||
|
||||
void snd_control_get_id(const snd_control_t *obj, snd_control_id_t *ptr);
|
||||
void snd_ctl_element_get_id(const snd_ctl_element_t *obj, snd_ctl_element_id_t *ptr);
|
||||
|
||||
unsigned int snd_control_get_numid(const snd_control_t *obj);
|
||||
unsigned int snd_ctl_element_get_numid(const snd_ctl_element_t *obj);
|
||||
|
||||
snd_control_iface_t snd_control_get_interface(const snd_control_t *obj);
|
||||
snd_ctl_element_iface_t snd_ctl_element_get_interface(const snd_ctl_element_t *obj);
|
||||
|
||||
unsigned int snd_control_get_device(const snd_control_t *obj);
|
||||
unsigned int snd_ctl_element_get_device(const snd_ctl_element_t *obj);
|
||||
|
||||
unsigned int snd_control_get_subdevice(const snd_control_t *obj);
|
||||
unsigned int snd_ctl_element_get_subdevice(const snd_ctl_element_t *obj);
|
||||
|
||||
const char *snd_control_get_name(const snd_control_t *obj);
|
||||
const char *snd_ctl_element_get_name(const snd_ctl_element_t *obj);
|
||||
|
||||
unsigned int snd_control_get_index(const snd_control_t *obj);
|
||||
unsigned int snd_ctl_element_get_index(const snd_ctl_element_t *obj);
|
||||
|
||||
void snd_control_set_id(snd_control_t *obj, const snd_control_id_t *ptr);
|
||||
void snd_ctl_element_set_id(snd_ctl_element_t *obj, const snd_ctl_element_id_t *ptr);
|
||||
|
||||
void snd_control_set_numid(snd_control_t *obj, unsigned int val);
|
||||
void snd_ctl_element_set_numid(snd_ctl_element_t *obj, unsigned int val);
|
||||
|
||||
void snd_control_set_interface(snd_control_t *obj, snd_control_iface_t val);
|
||||
void snd_ctl_element_set_interface(snd_ctl_element_t *obj, snd_ctl_element_iface_t val);
|
||||
|
||||
void snd_control_set_device(snd_control_t *obj, unsigned int val);
|
||||
void snd_ctl_element_set_device(snd_ctl_element_t *obj, unsigned int val);
|
||||
|
||||
void snd_control_set_subdevice(snd_control_t *obj, unsigned int val);
|
||||
void snd_ctl_element_set_subdevice(snd_ctl_element_t *obj, unsigned int val);
|
||||
|
||||
void snd_control_set_name(snd_control_t *obj, const char *val);
|
||||
void snd_ctl_element_set_name(snd_ctl_element_t *obj, const char *val);
|
||||
|
||||
void snd_control_set_index(snd_control_t *obj, unsigned int val);
|
||||
void snd_ctl_element_set_index(snd_ctl_element_t *obj, unsigned int val);
|
||||
|
||||
long snd_control_get_boolean(const snd_control_t *obj, unsigned int idx);
|
||||
long snd_ctl_element_get_boolean(const snd_ctl_element_t *obj, unsigned int idx);
|
||||
|
||||
long snd_control_get_integer(const snd_control_t *obj, unsigned int idx);
|
||||
long snd_ctl_element_get_integer(const snd_ctl_element_t *obj, unsigned int idx);
|
||||
|
||||
unsigned int snd_control_get_enumerated(const snd_control_t *obj, unsigned int idx);
|
||||
unsigned int snd_ctl_element_get_enumerated(const snd_ctl_element_t *obj, unsigned int idx);
|
||||
|
||||
unsigned char snd_control_get_byte(const snd_control_t *obj, unsigned int idx);
|
||||
unsigned char snd_ctl_element_get_byte(const snd_ctl_element_t *obj, unsigned int idx);
|
||||
|
||||
void snd_control_set_boolean(snd_control_t *obj, unsigned int idx, long val);
|
||||
void snd_ctl_element_set_boolean(snd_ctl_element_t *obj, unsigned int idx, long val);
|
||||
|
||||
void snd_control_set_integer(snd_control_t *obj, unsigned int idx, long val);
|
||||
void snd_ctl_element_set_integer(snd_ctl_element_t *obj, unsigned int idx, long val);
|
||||
|
||||
void snd_control_set_enumerated(snd_control_t *obj, unsigned int idx, unsigned int val);
|
||||
void snd_ctl_element_set_enumerated(snd_ctl_element_t *obj, unsigned int idx, unsigned int val);
|
||||
|
||||
void snd_control_set_byte(snd_control_t *obj, unsigned int idx, unsigned char val);
|
||||
void snd_ctl_element_set_byte(snd_ctl_element_t *obj, unsigned int idx, unsigned char val);
|
||||
|
||||
const void * snd_control_get_bytes(const snd_control_t *obj);
|
||||
const void * snd_ctl_element_get_bytes(const snd_ctl_element_t *obj);
|
||||
|
||||
void snd_control_get_iec958(const snd_control_t *obj, snd_aes_iec958_t *ptr);
|
||||
void snd_ctl_element_get_iec958(const snd_ctl_element_t *obj, snd_aes_iec958_t *ptr);
|
||||
|
||||
void snd_control_set_iec958(snd_control_t *obj, const snd_aes_iec958_t *ptr);
|
||||
void snd_ctl_element_set_iec958(snd_ctl_element_t *obj, const snd_aes_iec958_t *ptr);
|
||||
|
||||
size_t snd_hcontrol_list_sizeof();
|
||||
#define snd_hcontrol_list_alloca(ptr) ({ assert(ptr); *ptr = (snd_hcontrol_list_t *) alloca(snd_hcontrol_list_sizeof()); memset(*ptr, 0, snd_hcontrol_list_sizeof()); 0; })
|
||||
int snd_hcontrol_list_malloc(snd_hcontrol_list_t **ptr);
|
||||
void snd_hcontrol_list_free(snd_hcontrol_list_t *obj);
|
||||
void snd_hcontrol_list_copy(snd_hcontrol_list_t *dst, const snd_hcontrol_list_t *src);
|
||||
size_t snd_hctl_element_list_sizeof();
|
||||
#define snd_hctl_element_list_alloca(ptr) ({ assert(ptr); *ptr = (snd_hctl_element_list_t *) alloca(snd_hctl_element_list_sizeof()); memset(*ptr, 0, snd_hctl_element_list_sizeof()); 0; })
|
||||
int snd_hctl_element_list_malloc(snd_hctl_element_list_t **ptr);
|
||||
void snd_hctl_element_list_free(snd_hctl_element_list_t *obj);
|
||||
void snd_hctl_element_list_copy(snd_hctl_element_list_t *dst, const snd_hctl_element_list_t *src);
|
||||
|
||||
void snd_hcontrol_list_set_offset(snd_hcontrol_list_t *obj, unsigned int val);
|
||||
void snd_hctl_element_list_set_offset(snd_hctl_element_list_t *obj, unsigned int val);
|
||||
|
||||
unsigned int snd_hcontrol_list_get_used(const snd_hcontrol_list_t *obj);
|
||||
unsigned int snd_hctl_element_list_get_used(const snd_hctl_element_list_t *obj);
|
||||
|
||||
unsigned int snd_hcontrol_list_get_count(const snd_hcontrol_list_t *obj);
|
||||
unsigned int snd_hctl_element_list_get_count(const snd_hctl_element_list_t *obj);
|
||||
|
||||
void snd_hcontrol_list_get_id(const snd_hcontrol_list_t *obj, unsigned int idx, snd_control_id_t *ptr);
|
||||
void snd_hctl_element_list_get_id(const snd_hctl_element_list_t *obj, unsigned int idx, snd_ctl_element_id_t *ptr);
|
||||
|
||||
unsigned int snd_hcontrol_list_get_numid(const snd_hcontrol_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_hctl_element_list_get_numid(const snd_hctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
snd_control_iface_t snd_hcontrol_list_get_interface(const snd_hcontrol_list_t *obj, unsigned int idx);
|
||||
snd_ctl_element_iface_t snd_hctl_element_list_get_interface(const snd_hctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
unsigned int snd_hcontrol_list_get_device(const snd_hcontrol_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_hctl_element_list_get_device(const snd_hctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
unsigned int snd_hcontrol_list_get_subdevice(const snd_hcontrol_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_hctl_element_list_get_subdevice(const snd_hctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
const char *snd_hcontrol_list_get_name(const snd_hcontrol_list_t *obj, unsigned int idx);
|
||||
const char *snd_hctl_element_list_get_name(const snd_hctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
unsigned int snd_hcontrol_list_get_index(const snd_hcontrol_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_hctl_element_list_get_index(const snd_hctl_element_list_t *obj, unsigned int idx);
|
||||
|
||||
size_t snd_hcontrol_sizeof();
|
||||
#define snd_hcontrol_alloca(ptr) ({ assert(ptr); *ptr = (snd_hcontrol_t *) alloca(snd_hcontrol_sizeof()); memset(*ptr, 0, snd_hcontrol_sizeof()); 0; })
|
||||
int snd_hcontrol_malloc(snd_hcontrol_t **ptr);
|
||||
void snd_hcontrol_free(snd_hcontrol_t *obj);
|
||||
void snd_hcontrol_copy(snd_hcontrol_t *dst, const snd_hcontrol_t *src);
|
||||
size_t snd_hctl_element_sizeof();
|
||||
#define snd_hctl_element_alloca(ptr) ({ assert(ptr); *ptr = (snd_hctl_element_t *) alloca(snd_hctl_element_sizeof()); memset(*ptr, 0, snd_hctl_element_sizeof()); 0; })
|
||||
int snd_hctl_element_malloc(snd_hctl_element_t **ptr);
|
||||
void snd_hctl_element_free(snd_hctl_element_t *obj);
|
||||
void snd_hctl_element_copy(snd_hctl_element_t *dst, const snd_hctl_element_t *src);
|
||||
|
||||
void snd_hcontrol_get_id(const snd_hcontrol_t *obj, snd_control_id_t *ptr);
|
||||
void snd_hctl_element_get_id(const snd_hctl_element_t *obj, snd_ctl_element_id_t *ptr);
|
||||
|
||||
unsigned int snd_hcontrol_get_numid(const snd_hcontrol_t *obj);
|
||||
unsigned int snd_hctl_element_get_numid(const snd_hctl_element_t *obj);
|
||||
|
||||
snd_control_iface_t snd_hcontrol_get_interface(const snd_hcontrol_t *obj);
|
||||
snd_ctl_element_iface_t snd_hctl_element_get_interface(const snd_hctl_element_t *obj);
|
||||
|
||||
unsigned int snd_hcontrol_get_device(const snd_hcontrol_t *obj);
|
||||
unsigned int snd_hctl_element_get_device(const snd_hctl_element_t *obj);
|
||||
|
||||
unsigned int snd_hcontrol_get_subdevice(const snd_hcontrol_t *obj);
|
||||
unsigned int snd_hctl_element_get_subdevice(const snd_hctl_element_t *obj);
|
||||
|
||||
const char *snd_hcontrol_get_name(const snd_hcontrol_t *obj);
|
||||
const char *snd_hctl_element_get_name(const snd_hctl_element_t *obj);
|
||||
|
||||
unsigned int snd_hcontrol_get_index(const snd_hcontrol_t *obj);
|
||||
unsigned int snd_hctl_element_get_index(const snd_hctl_element_t *obj);
|
||||
|
||||
void snd_hcontrol_set_callback_change(snd_hcontrol_t *obj, snd_hcontrol_callback_t val);
|
||||
void snd_hctl_element_set_callback_change(snd_hctl_element_t *obj, snd_hctl_element_callback_t val);
|
||||
|
||||
void snd_hcontrol_set_callback_value(snd_hcontrol_t *obj, snd_hcontrol_callback_t val);
|
||||
void snd_hctl_element_set_callback_value(snd_hctl_element_t *obj, snd_hctl_element_callback_t val);
|
||||
|
||||
void snd_hcontrol_set_callback_remove(snd_hcontrol_t *obj, snd_hcontrol_callback_t val);
|
||||
void snd_hctl_element_set_callback_remove(snd_hctl_element_t *obj, snd_hctl_element_callback_t val);
|
||||
|
||||
void * snd_hcontrol_get_private_data(const snd_hcontrol_t *obj);
|
||||
void * snd_hctl_element_get_private_data(const snd_hctl_element_t *obj);
|
||||
|
||||
void snd_hcontrol_set_private_data(snd_hcontrol_t *obj, void * val);
|
||||
void snd_hctl_element_set_private_data(snd_hctl_element_t *obj, void * val);
|
||||
|
||||
void snd_hcontrol_set_private_free(snd_hcontrol_t *obj, snd_hcontrol_private_free_t val);
|
||||
void snd_hctl_element_set_private_free(snd_hctl_element_t *obj, snd_hctl_element_private_free_t val);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@
|
|||
#define _snd_pcm_sw_params sndrv_pcm_sw_params
|
||||
#define _snd_pcm_status sndrv_pcm_status
|
||||
|
||||
#define _snd_ctl_info sndrv_ctl_info
|
||||
#define _snd_control_id sndrv_control_id
|
||||
#define _snd_control_list sndrv_control_list
|
||||
#define _snd_control_info sndrv_control_info
|
||||
#define _snd_control sndrv_control
|
||||
#define _snd_ctl_card_info sndrv_ctl_card_info
|
||||
#define _snd_ctl_element_id sndrv_ctl_element_id
|
||||
#define _snd_ctl_element_list sndrv_ctl_element_list
|
||||
#define _snd_ctl_element_info sndrv_ctl_element_info
|
||||
#define _snd_ctl_element sndrv_ctl_element
|
||||
#define _snd_ctl_event sndrv_ctl_event
|
||||
|
||||
#define _snd_rawmidi_info sndrv_rawmidi_info
|
||||
|
|
|
|||
|
|
@ -74,16 +74,16 @@ typedef struct _snd_mixer_sid {
|
|||
unsigned int index;
|
||||
} snd_mixer_sid_t;
|
||||
|
||||
typedef struct _snd_mixer_simple_control_list {
|
||||
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_control_list_t;
|
||||
} snd_mixer_simple_element_list_t;
|
||||
|
||||
typedef struct _snd_mixer_simple_control {
|
||||
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 */
|
||||
|
|
@ -104,7 +104,7 @@ typedef struct _snd_mixer_simple_control {
|
|||
} names;
|
||||
long values[32];
|
||||
} volume; /* RW */
|
||||
} snd_mixer_simple_control_t;
|
||||
} snd_mixer_simple_element_t;
|
||||
|
||||
typedef struct _snd_mixer_simple_callbacks {
|
||||
void *private_data; /* may be used by an application */
|
||||
|
|
@ -121,9 +121,9 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
const char *snd_mixer_simple_channel_name(snd_mixer_channel_id_t channel);
|
||||
int snd_mixer_simple_control_list(snd_mixer_t *handle, snd_mixer_simple_control_list_t *list);
|
||||
int snd_mixer_simple_control_read(snd_mixer_t *handle, snd_mixer_simple_control_t *simple);
|
||||
int snd_mixer_simple_control_write(snd_mixer_t *handle, snd_mixer_simple_control_t *simple);
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Control Interface - highlevel API - hcontrol bag operations
|
||||
* Control Interface - highlevel API - helem bag operations
|
||||
* Copyright (c) 2000 by Jaroslav Kysela <perex@suse.cz>
|
||||
*
|
||||
*
|
||||
|
|
@ -36,43 +36,43 @@ int snd_ctl_hbag_create(void **bag)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void snd_ctl_hbag_free_private(snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED)
|
||||
static void snd_ctl_hbag_free_private(snd_hctl_element_t *helem ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
int snd_ctl_hbag_destroy(void **bag, void (*hcontrol_free)(snd_hcontrol_t *hcontrol))
|
||||
int snd_ctl_hbag_destroy(void **bag, void (*hctl_element_free)(snd_hctl_element_t *helem))
|
||||
{
|
||||
assert(bag != NULL);
|
||||
if (hcontrol_free == NULL)
|
||||
hcontrol_free = snd_ctl_hbag_free_private;
|
||||
tdestroy(*bag, (__free_fn_t)hcontrol_free);
|
||||
if (hctl_element_free == NULL)
|
||||
hctl_element_free = snd_ctl_hbag_free_private;
|
||||
tdestroy(*bag, (__free_fn_t)hctl_element_free);
|
||||
*bag = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_ctl_hbag_add(void **bag, snd_hcontrol_t *hcontrol)
|
||||
int snd_ctl_hbag_add(void **bag, snd_hctl_element_t *helem)
|
||||
{
|
||||
void *res;
|
||||
|
||||
assert(bag != NULL && hcontrol != NULL);
|
||||
res = tsearch(hcontrol, bag, (__compar_fn_t)snd_ctl_hsort);
|
||||
assert(bag != NULL && helem != NULL);
|
||||
res = tsearch(helem, bag, (__compar_fn_t)snd_ctl_hsort);
|
||||
if (res == NULL)
|
||||
return -ENOMEM;
|
||||
if ((snd_hcontrol_t *)res == hcontrol)
|
||||
if ((snd_hctl_element_t *)res == helem)
|
||||
return -EALREADY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_ctl_hbag_del(void **bag, snd_hcontrol_t *hcontrol)
|
||||
int snd_ctl_hbag_del(void **bag, snd_hctl_element_t *helem)
|
||||
{
|
||||
assert(bag != NULL && hcontrol != NULL);
|
||||
if (tdelete(hcontrol, bag, (__compar_fn_t)snd_ctl_hsort) == NULL)
|
||||
assert(bag != NULL && helem != NULL);
|
||||
if (tdelete(helem, bag, (__compar_fn_t)snd_ctl_hsort) == NULL)
|
||||
return -ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
snd_hcontrol_t *snd_ctl_hbag_find(void **bag, snd_control_id_t *id)
|
||||
snd_hctl_element_t *snd_ctl_hbag_find(void **bag, snd_ctl_element_id_t *id)
|
||||
{
|
||||
void *res;
|
||||
|
||||
|
|
@ -80,5 +80,5 @@ snd_hcontrol_t *snd_ctl_hbag_find(void **bag, snd_control_id_t *id)
|
|||
if (*bag == NULL)
|
||||
return NULL;
|
||||
res = tfind(id, bag, (__compar_fn_t)snd_ctl_hsort);
|
||||
return res == NULL ? NULL : *(snd_hcontrol_t **)res;
|
||||
return res == NULL ? NULL : *(snd_hctl_element_t **)res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ int snd_card_get_index(const char *string)
|
|||
{
|
||||
int card;
|
||||
snd_ctl_t *handle;
|
||||
snd_ctl_info_t info;
|
||||
snd_ctl_card_info_t info;
|
||||
|
||||
if (!string || *string == '\0')
|
||||
return -EINVAL;
|
||||
|
|
@ -90,7 +90,7 @@ int snd_card_get_index(const char *string)
|
|||
continue;
|
||||
if (snd_ctl_hw_open(&handle, NULL, card) < 0)
|
||||
continue;
|
||||
if (snd_ctl_info(handle, &info) < 0) {
|
||||
if (snd_ctl_card_info(handle, &info) < 0) {
|
||||
snd_ctl_close(handle);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -104,14 +104,14 @@ int snd_card_get_index(const char *string)
|
|||
int snd_card_get_name(int card, char **name)
|
||||
{
|
||||
snd_ctl_t *handle;
|
||||
snd_ctl_info_t info;
|
||||
snd_ctl_card_info_t info;
|
||||
int err;
|
||||
|
||||
if (name == NULL)
|
||||
return -EINVAL;
|
||||
if ((err = snd_ctl_hw_open(&handle, NULL, card)) < 0)
|
||||
return err;
|
||||
if ((err = snd_ctl_info(handle, &info)) < 0) {
|
||||
if ((err = snd_ctl_card_info(handle, &info)) < 0) {
|
||||
snd_ctl_close(handle);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -125,14 +125,14 @@ int snd_card_get_name(int card, char **name)
|
|||
int snd_card_get_longname(int card, char **name)
|
||||
{
|
||||
snd_ctl_t *handle;
|
||||
snd_ctl_info_t info;
|
||||
snd_ctl_card_info_t info;
|
||||
int err;
|
||||
|
||||
if (name == NULL)
|
||||
return -EINVAL;
|
||||
if ((err = snd_ctl_hw_open(&handle, NULL, card)) < 0)
|
||||
return err;
|
||||
if ((err = snd_ctl_info(handle, &info)) < 0) {
|
||||
if ((err = snd_ctl_card_info(handle, &info)) < 0) {
|
||||
snd_ctl_close(handle);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,31 +48,31 @@ int snd_ctl_poll_descriptor(snd_ctl_t *ctl)
|
|||
return ctl->ops->poll_descriptor(ctl);
|
||||
}
|
||||
|
||||
int snd_ctl_info(snd_ctl_t *ctl, snd_ctl_info_t *info)
|
||||
int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info)
|
||||
{
|
||||
assert(ctl && info);
|
||||
return ctl->ops->hw_info(ctl, info);
|
||||
}
|
||||
|
||||
int snd_ctl_clist(snd_ctl_t *ctl, snd_control_list_t *list)
|
||||
int snd_ctl_clist(snd_ctl_t *ctl, snd_ctl_element_list_t *list)
|
||||
{
|
||||
assert(ctl && list);
|
||||
return ctl->ops->clist(ctl, list);
|
||||
}
|
||||
|
||||
int snd_ctl_cinfo(snd_ctl_t *ctl, snd_control_info_t *info)
|
||||
int snd_ctl_element_info(snd_ctl_t *ctl, snd_ctl_element_info_t *info)
|
||||
{
|
||||
assert(ctl && info && (info->id.name[0] || info->id.numid));
|
||||
return ctl->ops->cinfo(ctl, info);
|
||||
}
|
||||
|
||||
int snd_ctl_cread(snd_ctl_t *ctl, snd_control_t *control)
|
||||
int snd_ctl_element_read(snd_ctl_t *ctl, snd_ctl_element_t *control)
|
||||
{
|
||||
assert(ctl && control && (control->id.name[0] || control->id.numid));
|
||||
return ctl->ops->cread(ctl, control);
|
||||
}
|
||||
|
||||
int snd_ctl_cwrite(snd_ctl_t *ctl, snd_control_t *control)
|
||||
int snd_ctl_element_write(snd_ctl_t *ctl, snd_ctl_element_t *control)
|
||||
{
|
||||
assert(ctl && control && (control->id.name[0] || control->id.numid));
|
||||
return ctl->ops->cwrite(ctl, control);
|
||||
|
|
@ -239,18 +239,18 @@ int snd_ctl_open(snd_ctl_t **ctlp, char *name)
|
|||
return open_func(ctlp, name, ctl_conf);
|
||||
}
|
||||
|
||||
void snd_control_set_bytes(snd_control_t *obj, void *data, size_t size)
|
||||
void snd_ctl_element_set_bytes(snd_ctl_element_t *obj, void *data, size_t size)
|
||||
{
|
||||
assert(obj);
|
||||
assert(size <= sizeof(obj->value.bytes.data));
|
||||
memcpy(obj->value.bytes.data, data, size);
|
||||
}
|
||||
|
||||
#define TYPE(v) [SND_CONTROL_TYPE_##v] = #v
|
||||
#define IFACE(v) [SND_CONTROL_IFACE_##v] = #v
|
||||
#define TYPE(v) [SND_CTL_ELEMENT_TYPE_##v] = #v
|
||||
#define IFACE(v) [SND_CTL_ELEMENT_IFACE_##v] = #v
|
||||
#define EVENT(v) [SND_CTL_EVENT_##v] = #v
|
||||
|
||||
const char *snd_control_type_names[] = {
|
||||
const char *snd_ctl_element_type_names[] = {
|
||||
TYPE(NONE),
|
||||
TYPE(BOOLEAN),
|
||||
TYPE(INTEGER),
|
||||
|
|
@ -259,7 +259,7 @@ const char *snd_control_type_names[] = {
|
|||
TYPE(IEC958),
|
||||
};
|
||||
|
||||
const char *snd_control_iface_names[] = {
|
||||
const char *snd_ctl_element_iface_names[] = {
|
||||
IFACE(CARD),
|
||||
IFACE(HWDEP),
|
||||
IFACE(MIXER),
|
||||
|
|
@ -277,16 +277,16 @@ const char *snd_ctl_event_type_names[] = {
|
|||
EVENT(REMOVE),
|
||||
};
|
||||
|
||||
const char *snd_control_type_name(snd_control_type_t type)
|
||||
const char *snd_ctl_element_type_name(snd_ctl_element_type_t type)
|
||||
{
|
||||
assert(type <= SND_CONTROL_TYPE_LAST);
|
||||
return snd_control_type_names[snd_enum_to_int(type)];
|
||||
assert(type <= SND_CTL_ELEMENT_TYPE_LAST);
|
||||
return snd_ctl_element_type_names[snd_enum_to_int(type)];
|
||||
}
|
||||
|
||||
const char *snd_control_iface_name(snd_control_iface_t iface)
|
||||
const char *snd_ctl_element_iface_name(snd_ctl_element_iface_t iface)
|
||||
{
|
||||
assert(iface <= SND_CONTROL_IFACE_LAST);
|
||||
return snd_control_iface_names[snd_enum_to_int(iface)];
|
||||
assert(iface <= SND_CTL_ELEMENT_IFACE_LAST);
|
||||
return snd_ctl_element_iface_names[snd_enum_to_int(iface)];
|
||||
}
|
||||
|
||||
const char *snd_ctl_event_type_name(snd_ctl_event_type_t type)
|
||||
|
|
@ -295,7 +295,7 @@ const char *snd_ctl_event_type_name(snd_ctl_event_type_t type)
|
|||
return snd_ctl_event_type_names[snd_enum_to_int(type)];
|
||||
}
|
||||
|
||||
int snd_control_list_alloc_space(snd_control_list_t *obj, unsigned int entries)
|
||||
int snd_ctl_element_list_alloc_space(snd_ctl_element_list_t *obj, unsigned int entries)
|
||||
{
|
||||
obj->pids = calloc(entries, sizeof(*obj->pids));
|
||||
if (!obj->pids) {
|
||||
|
|
@ -306,7 +306,7 @@ int snd_control_list_alloc_space(snd_control_list_t *obj, unsigned int entries)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void snd_control_list_free_space(snd_control_list_t *obj)
|
||||
void snd_ctl_element_list_free_space(snd_ctl_element_list_t *obj)
|
||||
{
|
||||
free(obj->pids);
|
||||
obj->pids = NULL;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ static int snd_ctl_hw_poll_descriptor(snd_ctl_t *handle)
|
|||
return hw->fd;
|
||||
}
|
||||
|
||||
static int snd_ctl_hw_hw_info(snd_ctl_t *handle, snd_ctl_info_t *info)
|
||||
static int snd_ctl_hw_hw_info(snd_ctl_t *handle, snd_ctl_card_info_t *info)
|
||||
{
|
||||
snd_ctl_hw_t *hw = handle->private;
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_INFO, info) < 0)
|
||||
|
|
@ -59,34 +59,34 @@ static int snd_ctl_hw_hw_info(snd_ctl_t *handle, snd_ctl_info_t *info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int snd_ctl_hw_clist(snd_ctl_t *handle, snd_control_list_t *list)
|
||||
static int snd_ctl_hw_clist(snd_ctl_t *handle, snd_ctl_element_list_t *list)
|
||||
{
|
||||
snd_ctl_hw_t *hw = handle->private;
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_CONTROL_LIST, list) < 0)
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEMENT_LIST, list) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_ctl_hw_cinfo(snd_ctl_t *handle, snd_control_info_t *info)
|
||||
static int snd_ctl_hw_cinfo(snd_ctl_t *handle, snd_ctl_element_info_t *info)
|
||||
{
|
||||
snd_ctl_hw_t *hw = handle->private;
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_CONTROL_INFO, info) < 0)
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEMENT_INFO, info) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_ctl_hw_cread(snd_ctl_t *handle, snd_control_t *control)
|
||||
static int snd_ctl_hw_cread(snd_ctl_t *handle, snd_ctl_element_t *control)
|
||||
{
|
||||
snd_ctl_hw_t *hw = handle->private;
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_CONTROL_READ, control) < 0)
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEMENT_READ, control) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_ctl_hw_cwrite(snd_ctl_t *handle, snd_control_t *control)
|
||||
static int snd_ctl_hw_cwrite(snd_ctl_t *handle, snd_ctl_element_t *control)
|
||||
{
|
||||
snd_ctl_hw_t *hw = handle->private;
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_CONTROL_WRITE, control) < 0)
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEMENT_WRITE, control) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
typedef struct _snd_ctl_ops {
|
||||
int (*close)(snd_ctl_t *handle);
|
||||
int (*poll_descriptor)(snd_ctl_t *handle);
|
||||
int (*hw_info)(snd_ctl_t *handle, snd_ctl_info_t *info);
|
||||
int (*clist)(snd_ctl_t *handle, snd_control_list_t *list);
|
||||
int (*cinfo)(snd_ctl_t *handle, snd_control_info_t *info);
|
||||
int (*cread)(snd_ctl_t *handle, snd_control_t *control);
|
||||
int (*cwrite)(snd_ctl_t *handle, snd_control_t *control);
|
||||
int (*hw_info)(snd_ctl_t *handle, snd_ctl_card_info_t *info);
|
||||
int (*clist)(snd_ctl_t *handle, snd_ctl_element_list_t *list);
|
||||
int (*cinfo)(snd_ctl_t *handle, snd_ctl_element_info_t *info);
|
||||
int (*cread)(snd_ctl_t *handle, snd_ctl_element_t *control);
|
||||
int (*cwrite)(snd_ctl_t *handle, snd_ctl_element_t *control);
|
||||
int (*hwdep_next_device)(snd_ctl_t *handle, int *device);
|
||||
int (*hwdep_info)(snd_ctl_t *handle, snd_hwdep_info_t * info);
|
||||
int (*pcm_next_device)(snd_ctl_t *handle, int *device);
|
||||
|
|
@ -62,33 +62,33 @@ struct _snd_ctl {
|
|||
struct _snd_ctl_callbacks {
|
||||
void *private_data; /* may be used by an application */
|
||||
void (*rebuild) (snd_ctl_t *handle, void *private_data);
|
||||
void (*value) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
|
||||
void (*change) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
|
||||
void (*add) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
|
||||
void (*remove) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
|
||||
void (*value) (snd_ctl_t *handle, void *private_data, snd_ctl_element_id_t * id);
|
||||
void (*change) (snd_ctl_t *handle, void *private_data, snd_ctl_element_id_t * id);
|
||||
void (*add) (snd_ctl_t *handle, void *private_data, snd_ctl_element_id_t * id);
|
||||
void (*remove) (snd_ctl_t *handle, void *private_data, snd_ctl_element_id_t * id);
|
||||
void *reserved[58]; /* reserved for the future use - must be NULL!!! */
|
||||
};
|
||||
|
||||
struct _snd_hcontrol_list {
|
||||
struct _snd_hctl_element_list {
|
||||
unsigned int offset; /* W: first control ID to get */
|
||||
unsigned int space; /* W: count of control IDs to get */
|
||||
unsigned int used; /* R: count of available (set) controls */
|
||||
unsigned int count; /* R: count of all available controls */
|
||||
snd_control_id_t *pids; /* W: IDs */
|
||||
snd_ctl_element_id_t *pids; /* W: IDs */
|
||||
};
|
||||
|
||||
struct _snd_hcontrol {
|
||||
snd_control_id_t id; /* must be always on top */
|
||||
struct list_head list; /* links for list of all hcontrols */
|
||||
struct _snd_hctl_element {
|
||||
snd_ctl_element_id_t id; /* must be always on top */
|
||||
struct list_head list; /* links for list of all helems */
|
||||
int change: 1, /* structure change */
|
||||
value: 1; /* value change */
|
||||
/* event callbacks */
|
||||
snd_hcontrol_callback_t callback_change;
|
||||
snd_hcontrol_callback_t callback_value;
|
||||
snd_hcontrol_callback_t callback_remove;
|
||||
snd_hctl_element_callback_t callback_change;
|
||||
snd_hctl_element_callback_t callback_value;
|
||||
snd_hctl_element_callback_t callback_remove;
|
||||
/* private data */
|
||||
void *private_data;
|
||||
snd_hcontrol_private_free_t private_free;
|
||||
snd_hctl_element_private_free_t private_free;
|
||||
/* links */
|
||||
snd_ctl_t *handle; /* associated handle */
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -106,7 +106,7 @@ static int snd_ctl_shm_poll_descriptor(snd_ctl_t *ctl)
|
|||
return fd;
|
||||
}
|
||||
|
||||
static int snd_ctl_shm_hw_info(snd_ctl_t *ctl, snd_ctl_info_t *info)
|
||||
static int snd_ctl_shm_hw_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info)
|
||||
{
|
||||
snd_ctl_shm_t *shm = ctl->private;
|
||||
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
|
|
@ -120,18 +120,18 @@ static int snd_ctl_shm_hw_info(snd_ctl_t *ctl, snd_ctl_info_t *info)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int snd_ctl_shm_clist(snd_ctl_t *ctl, snd_control_list_t *list)
|
||||
static int snd_ctl_shm_clist(snd_ctl_t *ctl, snd_ctl_element_list_t *list)
|
||||
{
|
||||
snd_ctl_shm_t *shm = ctl->private;
|
||||
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
size_t maxsize = CTL_SHM_DATA_MAXLEN;
|
||||
size_t bytes = list->space * sizeof(*list->pids);
|
||||
int err;
|
||||
snd_control_id_t *pids = list->pids;
|
||||
snd_ctl_element_id_t *pids = list->pids;
|
||||
if (bytes > maxsize)
|
||||
return -EINVAL;
|
||||
ctrl->u.clist = *list;
|
||||
ctrl->cmd = SNDRV_CTL_IOCTL_CONTROL_LIST;
|
||||
ctrl->cmd = SNDRV_CTL_IOCTL_ELEMENT_LIST;
|
||||
err = snd_ctl_shm_action(ctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -142,13 +142,13 @@ static int snd_ctl_shm_clist(snd_ctl_t *ctl, snd_control_list_t *list)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int snd_ctl_shm_cinfo(snd_ctl_t *ctl, snd_control_info_t *info)
|
||||
static int snd_ctl_shm_cinfo(snd_ctl_t *ctl, snd_ctl_element_info_t *info)
|
||||
{
|
||||
snd_ctl_shm_t *shm = ctl->private;
|
||||
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->u.cinfo = *info;
|
||||
ctrl->cmd = SNDRV_CTL_IOCTL_CONTROL_INFO;
|
||||
ctrl->cmd = SNDRV_CTL_IOCTL_ELEMENT_INFO;
|
||||
err = snd_ctl_shm_action(ctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -156,13 +156,13 @@ static int snd_ctl_shm_cinfo(snd_ctl_t *ctl, snd_control_info_t *info)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int snd_ctl_shm_cread(snd_ctl_t *ctl, snd_control_t *control)
|
||||
static int snd_ctl_shm_cread(snd_ctl_t *ctl, snd_ctl_element_t *control)
|
||||
{
|
||||
snd_ctl_shm_t *shm = ctl->private;
|
||||
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->u.cread = *control;
|
||||
ctrl->cmd = SNDRV_CTL_IOCTL_CONTROL_READ;
|
||||
ctrl->cmd = SNDRV_CTL_IOCTL_ELEMENT_READ;
|
||||
err = snd_ctl_shm_action(ctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -170,13 +170,13 @@ static int snd_ctl_shm_cread(snd_ctl_t *ctl, snd_control_t *control)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int snd_ctl_shm_cwrite(snd_ctl_t *ctl, snd_control_t *control)
|
||||
static int snd_ctl_shm_cwrite(snd_ctl_t *ctl, snd_ctl_element_t *control)
|
||||
{
|
||||
snd_ctl_shm_t *shm = ctl->private;
|
||||
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->u.cwrite = *control;
|
||||
ctrl->cmd = SNDRV_CTL_IOCTL_CONTROL_WRITE;
|
||||
ctrl->cmd = SNDRV_CTL_IOCTL_ELEMENT_WRITE;
|
||||
err = snd_ctl_shm_action(ctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@
|
|||
#include <search.h>
|
||||
#include "control_local.h"
|
||||
|
||||
static void snd_ctl_hfree1(snd_hcontrol_t *hcontrol);
|
||||
static void snd_ctl_hfree1(snd_hctl_element_t *helem);
|
||||
|
||||
int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t hsort)
|
||||
{
|
||||
snd_control_list_t list;
|
||||
snd_hcontrol_t *hcontrol, *prev;
|
||||
snd_ctl_element_list_t list;
|
||||
snd_hctl_element_t *helem, *prev;
|
||||
int err;
|
||||
unsigned int idx;
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t hsort)
|
|||
return err;
|
||||
if (list.count == 0)
|
||||
break;
|
||||
list.pids = (snd_control_id_t *)calloc(list.count, sizeof(snd_control_id_t));
|
||||
list.pids = (snd_ctl_element_id_t *)calloc(list.count, sizeof(snd_ctl_element_id_t));
|
||||
if (list.pids == NULL)
|
||||
return -ENOMEM;
|
||||
list.space = list.count;
|
||||
|
|
@ -61,24 +61,24 @@ int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t hsort)
|
|||
return err;
|
||||
} while (list.count != list.used);
|
||||
for (idx = 0, prev = NULL; idx < list.count; idx++) {
|
||||
hcontrol = (snd_hcontrol_t *)calloc(1, sizeof(snd_hcontrol_t));
|
||||
if (hcontrol == NULL)
|
||||
helem = (snd_hctl_element_t *)calloc(1, sizeof(snd_hctl_element_t));
|
||||
if (helem == NULL)
|
||||
goto __nomem;
|
||||
hcontrol->id = list.pids[idx];
|
||||
hcontrol->handle = handle;
|
||||
if (tsearch(hcontrol, &handle->hroot, (__compar_fn_t)hsort) == NULL) {
|
||||
helem->id = list.pids[idx];
|
||||
helem->handle = handle;
|
||||
if (tsearch(helem, &handle->hroot, (__compar_fn_t)hsort) == NULL) {
|
||||
__nomem:
|
||||
if (handle->hroot != NULL) {
|
||||
tdestroy(handle->hroot, (__free_fn_t)snd_ctl_hfree1);
|
||||
handle->hroot = NULL;
|
||||
}
|
||||
handle->hroot = NULL;
|
||||
if (hcontrol != NULL)
|
||||
free(hcontrol);
|
||||
if (helem != NULL)
|
||||
free(helem);
|
||||
free(list.pids);
|
||||
return -ENOMEM;
|
||||
}
|
||||
list_add_tail(&hcontrol->list, &handle->hlist);
|
||||
list_add_tail(&helem->list, &handle->hlist);
|
||||
handle->hcount++;
|
||||
}
|
||||
if (list.pids != NULL)
|
||||
|
|
@ -90,20 +90,20 @@ int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t hsort)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void snd_ctl_hfree1(snd_hcontrol_t *hcontrol)
|
||||
static void snd_ctl_hfree1(snd_hctl_element_t *helem)
|
||||
{
|
||||
snd_ctl_t *handle;
|
||||
|
||||
assert(hcontrol != NULL);
|
||||
handle = hcontrol->handle;
|
||||
assert(helem != NULL);
|
||||
handle = helem->handle;
|
||||
assert(handle != NULL);
|
||||
assert(handle->hcount > 0);
|
||||
if (hcontrol->callback_remove)
|
||||
hcontrol->callback_remove(handle, hcontrol);
|
||||
if (hcontrol->private_free)
|
||||
hcontrol->private_free(hcontrol);
|
||||
list_del(&hcontrol->list);
|
||||
free(hcontrol);
|
||||
if (helem->callback_remove)
|
||||
helem->callback_remove(handle, helem);
|
||||
if (helem->private_free)
|
||||
helem->private_free(helem);
|
||||
list_del(&helem->list);
|
||||
free(helem);
|
||||
handle->hcount--;
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ static int snd_ctl_hsort_mixer_priority(const char *name)
|
|||
return res + res1;
|
||||
}
|
||||
|
||||
int snd_ctl_hsort(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2)
|
||||
int snd_ctl_hsort(const snd_hctl_element_t *c1, const snd_hctl_element_t *c2)
|
||||
{
|
||||
int res, p1, p2;
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ int snd_ctl_hsort(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2)
|
|||
if (c1->id.iface > c2->id.iface)
|
||||
return 1;
|
||||
if ((res = strcmp(c1->id.name, c2->id.name)) != 0) {
|
||||
if (c1->id.iface != SNDRV_CONTROL_IFACE_MIXER)
|
||||
if (c1->id.iface != SNDRV_CTL_ELEMENT_IFACE_MIXER)
|
||||
return res;
|
||||
p1 = snd_ctl_hsort_mixer_priority(c1->id.name);
|
||||
p2 = snd_ctl_hsort_mixer_priority(c2->id.name);
|
||||
|
|
@ -228,7 +228,7 @@ int snd_ctl_hsort(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void snd_ctl_hresort_free(snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED)
|
||||
static void snd_ctl_hresort_free(snd_hctl_element_t *helem ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
|
@ -236,8 +236,8 @@ static void snd_ctl_hresort_free(snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED)
|
|||
int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t hsort)
|
||||
{
|
||||
struct list_head *list;
|
||||
snd_hcontrol_t *hcontrol;
|
||||
snd_control_id_t *ids, *pids;
|
||||
snd_hctl_element_t *helem;
|
||||
snd_ctl_element_id_t *ids, *pids;
|
||||
int idx;
|
||||
|
||||
assert(handle != NULL && hsort != NULL);
|
||||
|
|
@ -246,14 +246,14 @@ int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t hsort)
|
|||
if (handle->herr < 0)
|
||||
return handle->herr;
|
||||
assert(handle->hroot_new == NULL);
|
||||
ids = pids = (snd_control_id_t *)malloc(sizeof(snd_control_id_t) * handle->hcount);
|
||||
ids = pids = (snd_ctl_element_id_t *)malloc(sizeof(snd_ctl_element_id_t) * handle->hcount);
|
||||
if (ids == NULL)
|
||||
return -ENOMEM;
|
||||
/* first step - update search engine */
|
||||
list_for_each(list, &handle->hlist) {
|
||||
hcontrol = list_entry(list, snd_hcontrol_t, list);
|
||||
*pids++ = hcontrol->id;
|
||||
if (tsearch(hcontrol, &handle->hroot_new, (__compar_fn_t)hsort) == NULL) {
|
||||
helem = list_entry(list, snd_hctl_element_t, list);
|
||||
*pids++ = helem->id;
|
||||
if (tsearch(helem, &handle->hroot_new, (__compar_fn_t)hsort) == NULL) {
|
||||
if (handle->hroot_new != NULL)
|
||||
tdestroy(handle->hroot_new, (__free_fn_t)snd_ctl_hresort_free);
|
||||
handle->hroot_new = NULL;
|
||||
|
|
@ -267,46 +267,46 @@ int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t hsort)
|
|||
handle->hroot = handle->hroot_new;
|
||||
handle->hroot_new = NULL;
|
||||
/* second step - perform qsort and save results */
|
||||
qsort(ids, handle->hcount, sizeof(snd_control_id_t), (int (*)(const void *, const void *))hsort);
|
||||
qsort(ids, handle->hcount, sizeof(snd_ctl_element_id_t), (int (*)(const void *, const void *))hsort);
|
||||
INIT_LIST_HEAD(&handle->hlist);
|
||||
for (idx = 0; idx < handle->hcount; idx++) {
|
||||
hcontrol = snd_ctl_hfind(handle, ids + idx);
|
||||
list_add_tail(&hcontrol->list, &handle->hlist);
|
||||
helem = snd_ctl_hfind(handle, ids + idx);
|
||||
list_add_tail(&helem->list, &handle->hlist);
|
||||
}
|
||||
free(ids);
|
||||
return 0;
|
||||
}
|
||||
|
||||
snd_hcontrol_t *snd_ctl_hfirst(snd_ctl_t *handle)
|
||||
snd_hctl_element_t *snd_ctl_hfirst(snd_ctl_t *handle)
|
||||
{
|
||||
assert(handle != NULL);
|
||||
if (list_empty(&handle->hlist))
|
||||
return NULL;
|
||||
return (snd_hcontrol_t *)list_entry(handle->hlist.next, snd_hcontrol_t, list);
|
||||
return (snd_hctl_element_t *)list_entry(handle->hlist.next, snd_hctl_element_t, list);
|
||||
}
|
||||
|
||||
snd_hcontrol_t *snd_ctl_hlast(snd_ctl_t *handle)
|
||||
snd_hctl_element_t *snd_ctl_hlast(snd_ctl_t *handle)
|
||||
{
|
||||
assert(handle != NULL);
|
||||
if (list_empty(&handle->hlist))
|
||||
return NULL;
|
||||
return (snd_hcontrol_t *)list_entry(handle->hlist.prev, snd_hcontrol_t, list);
|
||||
return (snd_hctl_element_t *)list_entry(handle->hlist.prev, snd_hctl_element_t, list);
|
||||
}
|
||||
|
||||
snd_hcontrol_t *snd_ctl_hnext(snd_ctl_t *handle, snd_hcontrol_t *hcontrol)
|
||||
snd_hctl_element_t *snd_ctl_hnext(snd_ctl_t *handle, snd_hctl_element_t *helem)
|
||||
{
|
||||
assert(handle != NULL && hcontrol != NULL);
|
||||
if (hcontrol->list.next == &handle->hlist)
|
||||
assert(handle != NULL && helem != NULL);
|
||||
if (helem->list.next == &handle->hlist)
|
||||
return NULL;
|
||||
return (snd_hcontrol_t *)list_entry(hcontrol->list.next, snd_hcontrol_t, list);
|
||||
return (snd_hctl_element_t *)list_entry(helem->list.next, snd_hctl_element_t, list);
|
||||
}
|
||||
|
||||
snd_hcontrol_t *snd_ctl_hprev(snd_ctl_t *handle, snd_hcontrol_t *hcontrol)
|
||||
snd_hctl_element_t *snd_ctl_hprev(snd_ctl_t *handle, snd_hctl_element_t *helem)
|
||||
{
|
||||
assert(handle != NULL && hcontrol != NULL);
|
||||
if (hcontrol->list.prev == &handle->hlist)
|
||||
assert(handle != NULL && helem != NULL);
|
||||
if (helem->list.prev == &handle->hlist)
|
||||
return NULL;
|
||||
return (snd_hcontrol_t *)list_entry(hcontrol->list.prev, snd_hcontrol_t, list);
|
||||
return (snd_hctl_element_t *)list_entry(helem->list.prev, snd_hctl_element_t, list);
|
||||
}
|
||||
|
||||
int snd_ctl_hcount(snd_ctl_t *handle)
|
||||
|
|
@ -315,7 +315,7 @@ int snd_ctl_hcount(snd_ctl_t *handle)
|
|||
return handle->hcount;
|
||||
}
|
||||
|
||||
snd_hcontrol_t *snd_ctl_hfind(snd_ctl_t *handle, snd_control_id_t *id)
|
||||
snd_hctl_element_t *snd_ctl_hfind(snd_ctl_t *handle, snd_ctl_element_id_t *id)
|
||||
{
|
||||
void *res;
|
||||
|
||||
|
|
@ -323,13 +323,13 @@ snd_hcontrol_t *snd_ctl_hfind(snd_ctl_t *handle, snd_control_id_t *id)
|
|||
if (handle->hroot == NULL)
|
||||
return NULL;
|
||||
res = tfind(id, &handle->hroot, (__compar_fn_t)handle->hsort);
|
||||
return res == NULL ? NULL : *(snd_hcontrol_t **)res;
|
||||
return res == NULL ? NULL : *(snd_hctl_element_t **)res;
|
||||
}
|
||||
|
||||
int snd_ctl_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist)
|
||||
int snd_ctl_hlist(snd_ctl_t *handle, snd_hctl_element_list_t *hlist)
|
||||
{
|
||||
struct list_head *list;
|
||||
snd_hcontrol_t *hcontrol;
|
||||
snd_hctl_element_t *helem;
|
||||
unsigned int idx;
|
||||
|
||||
assert(hlist != NULL);
|
||||
|
|
@ -342,11 +342,11 @@ int snd_ctl_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist)
|
|||
return -EINVAL;
|
||||
idx = 0;
|
||||
list_for_each(list, &handle->hlist) {
|
||||
hcontrol = list_entry(list, snd_hcontrol_t, list);
|
||||
helem = list_entry(list, snd_hctl_element_t, list);
|
||||
if (idx >= hlist->offset + hlist->space)
|
||||
break;
|
||||
if (idx >= hlist->offset) {
|
||||
hlist->pids[idx] = hcontrol->id;
|
||||
hlist->pids[idx] = helem->id;
|
||||
hlist->used++;
|
||||
}
|
||||
idx++;
|
||||
|
|
@ -378,75 +378,75 @@ static void callback_rebuild(snd_ctl_t *handle, void *private_data ATTRIBUTE_UNU
|
|||
handle->callback_rebuild(handle, handle->callback_rebuild_private_data);
|
||||
}
|
||||
|
||||
static void callback_change(snd_ctl_t *handle, void *private_data ATTRIBUTE_UNUSED, snd_control_id_t *id)
|
||||
static void callback_change(snd_ctl_t *handle, void *private_data ATTRIBUTE_UNUSED, snd_ctl_element_id_t *id)
|
||||
{
|
||||
snd_hcontrol_t *hcontrol;
|
||||
snd_hctl_element_t *helem;
|
||||
|
||||
if (handle->herr < 0)
|
||||
return;
|
||||
hcontrol = snd_ctl_hfind(handle, id);
|
||||
if (hcontrol == NULL) {
|
||||
helem = snd_ctl_hfind(handle, id);
|
||||
if (helem == NULL) {
|
||||
handle->herr = -ENOENT;
|
||||
return;
|
||||
}
|
||||
hcontrol->change = 1;
|
||||
helem->change = 1;
|
||||
}
|
||||
|
||||
static void callback_value(snd_ctl_t *handle, void *private_data ATTRIBUTE_UNUSED, snd_control_id_t *id)
|
||||
static void callback_value(snd_ctl_t *handle, void *private_data ATTRIBUTE_UNUSED, snd_ctl_element_id_t *id)
|
||||
{
|
||||
snd_hcontrol_t *hcontrol;
|
||||
snd_hctl_element_t *helem;
|
||||
|
||||
if (handle->herr < 0)
|
||||
return;
|
||||
hcontrol = snd_ctl_hfind(handle, id);
|
||||
if (hcontrol == NULL) {
|
||||
helem = snd_ctl_hfind(handle, id);
|
||||
if (helem == NULL) {
|
||||
handle->herr = -ENOENT;
|
||||
return;
|
||||
}
|
||||
hcontrol->value = 1;
|
||||
helem->value = 1;
|
||||
}
|
||||
|
||||
static void callback_add(snd_ctl_t *handle, void *private_data ATTRIBUTE_UNUSED, snd_control_id_t *id)
|
||||
static void callback_add(snd_ctl_t *handle, void *private_data ATTRIBUTE_UNUSED, snd_ctl_element_id_t *id)
|
||||
{
|
||||
snd_hcontrol_t *hcontrol, *icontrol;
|
||||
snd_hctl_element_t *helem, *icontrol;
|
||||
|
||||
if (handle->herr < 0)
|
||||
return;
|
||||
hcontrol = (snd_hcontrol_t *)calloc(1, sizeof(snd_hcontrol_t));
|
||||
if (hcontrol == NULL) {
|
||||
helem = (snd_hctl_element_t *)calloc(1, sizeof(snd_hctl_element_t));
|
||||
if (helem == NULL) {
|
||||
handle->herr = -ENOMEM;
|
||||
return;
|
||||
}
|
||||
hcontrol->id = *id;
|
||||
hcontrol->handle = handle;
|
||||
icontrol = tsearch(hcontrol, &handle->hroot, (__compar_fn_t)handle->hsort);
|
||||
helem->id = *id;
|
||||
helem->handle = handle;
|
||||
icontrol = tsearch(helem, &handle->hroot, (__compar_fn_t)handle->hsort);
|
||||
if (icontrol == NULL) {
|
||||
free(hcontrol);
|
||||
free(helem);
|
||||
handle->herr = -ENOMEM;
|
||||
return;
|
||||
}
|
||||
if (icontrol != hcontrol) { /* double hit */
|
||||
free(hcontrol);
|
||||
if (icontrol != helem) { /* double hit */
|
||||
free(helem);
|
||||
return;
|
||||
}
|
||||
list_add_tail(&hcontrol->list, &handle->hlist);
|
||||
list_add_tail(&helem->list, &handle->hlist);
|
||||
if (handle->callback_add)
|
||||
handle->callback_add(handle, handle->callback_add_private_data, hcontrol);
|
||||
handle->callback_add(handle, handle->callback_add_private_data, helem);
|
||||
}
|
||||
|
||||
static void callback_remove(snd_ctl_t *handle, void *private_data ATTRIBUTE_UNUSED, snd_control_id_t *id)
|
||||
static void callback_remove(snd_ctl_t *handle, void *private_data ATTRIBUTE_UNUSED, snd_ctl_element_id_t *id)
|
||||
{
|
||||
snd_hcontrol_t *hcontrol;
|
||||
snd_hctl_element_t *helem;
|
||||
|
||||
if (handle->herr < 0)
|
||||
return;
|
||||
hcontrol = snd_ctl_hfind(handle, id);
|
||||
if (hcontrol == NULL) {
|
||||
helem = snd_ctl_hfind(handle, id);
|
||||
if (helem == NULL) {
|
||||
handle->herr = -ENOENT;
|
||||
return;
|
||||
}
|
||||
if (tdelete(hcontrol, &handle->hroot, (__compar_fn_t)handle->hsort) != NULL)
|
||||
snd_ctl_hfree1(hcontrol);
|
||||
if (tdelete(helem, &handle->hroot, (__compar_fn_t)handle->hsort) != NULL)
|
||||
snd_ctl_hfree1(helem);
|
||||
}
|
||||
|
||||
int snd_ctl_hevent(snd_ctl_t *handle)
|
||||
|
|
@ -461,7 +461,7 @@ int snd_ctl_hevent(snd_ctl_t *handle)
|
|||
reserved: { NULL, }
|
||||
};
|
||||
struct list_head *list;
|
||||
snd_hcontrol_t *hcontrol;
|
||||
snd_hctl_element_t *helem;
|
||||
int res;
|
||||
|
||||
assert(handle != NULL);
|
||||
|
|
@ -472,20 +472,20 @@ int snd_ctl_hevent(snd_ctl_t *handle)
|
|||
if (handle->herr < 0)
|
||||
return handle->herr;
|
||||
list_for_each(list, &handle->hlist) {
|
||||
hcontrol = list_entry(list, snd_hcontrol_t, list);
|
||||
if (hcontrol->change && hcontrol->callback_change) {
|
||||
hcontrol->callback_change(hcontrol->handle, hcontrol);
|
||||
hcontrol->change = 0;
|
||||
helem = list_entry(list, snd_hctl_element_t, list);
|
||||
if (helem->change && helem->callback_change) {
|
||||
helem->callback_change(helem->handle, helem);
|
||||
helem->change = 0;
|
||||
}
|
||||
if (hcontrol->value && hcontrol->callback_value) {
|
||||
hcontrol->callback_value(hcontrol->handle, hcontrol);
|
||||
hcontrol->value = 0;
|
||||
if (helem->value && helem->callback_value) {
|
||||
helem->callback_value(helem->handle, helem);
|
||||
helem->value = 0;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int snd_hcontrol_list_alloc_space(snd_hcontrol_list_t *obj, unsigned int entries)
|
||||
int snd_hctl_element_list_alloc_space(snd_hctl_element_list_t *obj, unsigned int entries)
|
||||
{
|
||||
obj->pids = calloc(entries, sizeof(*obj->pids));
|
||||
if (!obj->pids) {
|
||||
|
|
@ -496,7 +496,7 @@ int snd_hcontrol_list_alloc_space(snd_hcontrol_list_t *obj, unsigned int entries
|
|||
return 0;
|
||||
}
|
||||
|
||||
void snd_hcontrol_list_free_space(snd_hcontrol_list_t *obj)
|
||||
void snd_hctl_element_list_free_space(snd_hctl_element_list_t *obj)
|
||||
{
|
||||
free(obj->pids);
|
||||
obj->pids = NULL;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "mixer_local.h"
|
||||
|
||||
static void snd_mixer_simple_read_rebuild(snd_ctl_t *ctl_handle, void *private_data);
|
||||
static void snd_mixer_simple_read_add(snd_ctl_t *ctl_handle, void *private_data, snd_hcontrol_t *hcontrol);
|
||||
static void snd_mixer_simple_read_add(snd_ctl_t *ctl_handle, void *private_data, snd_hctl_element_t *helem);
|
||||
|
||||
int snd_mixer_open(snd_mixer_t **r_handle, char *name)
|
||||
{
|
||||
|
|
@ -100,7 +100,7 @@ const char *snd_mixer_simple_channel_name(snd_mixer_channel_id_t channel)
|
|||
return p;
|
||||
}
|
||||
|
||||
int snd_mixer_simple_control_list(snd_mixer_t *handle, snd_mixer_simple_control_list_t *list)
|
||||
int snd_mixer_simple_element_list(snd_mixer_t *handle, snd_mixer_simple_element_list_t *list)
|
||||
{
|
||||
struct list_head *lh;
|
||||
mixer_simple_t *s;
|
||||
|
|
@ -145,7 +145,7 @@ static mixer_simple_t *look_for_simple(snd_mixer_t *handle, snd_mixer_sid_t *sid
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int snd_mixer_simple_control_read(snd_mixer_t *handle, snd_mixer_simple_control_t *control)
|
||||
int snd_mixer_simple_element_read(snd_mixer_t *handle, snd_mixer_simple_element_t *control)
|
||||
{
|
||||
mixer_simple_t *s;
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ int snd_mixer_simple_control_read(snd_mixer_t *handle, snd_mixer_simple_control_
|
|||
return s->get(handle, s, control);
|
||||
}
|
||||
|
||||
int snd_mixer_simple_control_write(snd_mixer_t *handle, snd_mixer_simple_control_t *control)
|
||||
int snd_mixer_simple_element_write(snd_mixer_t *handle, snd_mixer_simple_element_t *control)
|
||||
{
|
||||
mixer_simple_t *s;
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ static void snd_mixer_simple_read_rebuild(snd_ctl_t *ctl_handle, void *private_d
|
|||
handle->simple_changes++;
|
||||
}
|
||||
|
||||
static void snd_mixer_simple_read_add(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, void *private_data, snd_hcontrol_t *hcontrol)
|
||||
static void snd_mixer_simple_read_add(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, void *private_data, snd_hctl_element_t *helem)
|
||||
{
|
||||
snd_mixer_t *handle = (snd_mixer_t *)private_data;
|
||||
mixer_simple_t *s;
|
||||
|
|
@ -195,7 +195,7 @@ static void snd_mixer_simple_read_add(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, vo
|
|||
list_for_each(list, &handle->simples) {
|
||||
s = list_entry(list, mixer_simple_t, list);
|
||||
if (s->event_add)
|
||||
s->event_add(handle, hcontrol);
|
||||
s->event_add(handle, helem);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@
|
|||
#include "list.h"
|
||||
|
||||
typedef struct _mixer_simple mixer_simple_t;
|
||||
typedef struct _mixer_simple_hcontrol_private mixer_simple_hcontrol_private_t;
|
||||
typedef struct _mixer_simple_hctl_element_private mixer_simple_hctl_element_private_t;
|
||||
|
||||
typedef int (mixer_simple_get_t) (snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control);
|
||||
typedef int (mixer_simple_put_t) (snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control);
|
||||
typedef int (mixer_simple_event_add_t) (snd_mixer_t *handle, snd_hcontrol_t *hcontrol);
|
||||
typedef int (mixer_simple_get_t) (snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control);
|
||||
typedef int (mixer_simple_put_t) (snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control);
|
||||
typedef int (mixer_simple_event_add_t) (snd_mixer_t *handle, snd_hctl_element_t *helem);
|
||||
|
||||
#define MIXER_PRESENT_SINGLE_SWITCH (1<<0)
|
||||
#define MIXER_PRESENT_SINGLE_VOLUME (1<<1)
|
||||
|
|
@ -69,12 +69,12 @@ struct _mixer_simple {
|
|||
mixer_simple_put_t *put;
|
||||
mixer_simple_event_add_t *event_add;
|
||||
struct list_head list;
|
||||
void *hcontrols; /* bag of associated hcontrols */
|
||||
void *helems; /* bag of associated helems */
|
||||
unsigned long private_value;
|
||||
};
|
||||
|
||||
struct _mixer_simple_hcontrol_private {
|
||||
void *simples; /* list of associated hcontrols */
|
||||
struct _mixer_simple_hctl_element_private {
|
||||
void *simples; /* list of associated helems */
|
||||
};
|
||||
|
||||
struct _snd_mixer {
|
||||
|
|
|
|||
|
|
@ -39,48 +39,48 @@ static struct mixer_name_table {
|
|||
{0, 0},
|
||||
};
|
||||
|
||||
static snd_hcontrol_t *test_mixer_id(snd_mixer_t *handle, const char *name, int index)
|
||||
static snd_hctl_element_t *test_mixer_id(snd_mixer_t *handle, const char *name, int index)
|
||||
{
|
||||
snd_control_id_t id;
|
||||
snd_hcontrol_t *hcontrol;
|
||||
snd_ctl_element_id_t id;
|
||||
snd_hctl_element_t *helem;
|
||||
|
||||
memset(&id, 0, sizeof(id));
|
||||
id.iface = SNDRV_CONTROL_IFACE_MIXER;
|
||||
id.iface = SNDRV_CTL_ELEMENT_IFACE_MIXER;
|
||||
strcpy(id.name, name);
|
||||
id.index = index;
|
||||
hcontrol = snd_ctl_hfind(handle->ctl_handle, &id);
|
||||
// fprintf(stderr, "Looking for control: '%s', %i (0x%lx)\n", name, index, (long)hcontrol);
|
||||
return hcontrol;
|
||||
helem = snd_ctl_hfind(handle->ctl_handle, &id);
|
||||
// fprintf(stderr, "Looking for control: '%s', %i (0x%lx)\n", name, index, (long)helem);
|
||||
return helem;
|
||||
}
|
||||
|
||||
static int get_mixer_info(snd_mixer_t *handle, const char *name, int index, snd_control_info_t *info)
|
||||
static int get_mixer_info(snd_mixer_t *handle, const char *name, int index, snd_ctl_element_info_t *info)
|
||||
{
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->id.iface = SNDRV_CONTROL_IFACE_MIXER;
|
||||
info->id.iface = SNDRV_CTL_ELEMENT_IFACE_MIXER;
|
||||
strcpy(info->id.name, name);
|
||||
info->id.index = index;
|
||||
return snd_ctl_cinfo(handle->ctl_handle, info);
|
||||
return snd_ctl_element_info(handle->ctl_handle, info);
|
||||
}
|
||||
|
||||
static int get_mixer_read(snd_mixer_t *handle, const char *name, int index, snd_control_t *control)
|
||||
static int get_mixer_read(snd_mixer_t *handle, const char *name, int index, snd_ctl_element_t *control)
|
||||
{
|
||||
memset(control, 0, sizeof(*control));
|
||||
control->id.iface = SNDRV_CONTROL_IFACE_MIXER;
|
||||
control->id.iface = SNDRV_CTL_ELEMENT_IFACE_MIXER;
|
||||
strcpy(control->id.name, name);
|
||||
control->id.index = index;
|
||||
return snd_ctl_cread(handle->ctl_handle, control);
|
||||
return snd_ctl_element_read(handle->ctl_handle, control);
|
||||
}
|
||||
|
||||
static int put_mixer_write(snd_mixer_t *handle, const char *name, int index, snd_control_t *control)
|
||||
static int put_mixer_write(snd_mixer_t *handle, const char *name, int index, snd_ctl_element_t *control)
|
||||
{
|
||||
control->id.numid = 0;
|
||||
control->id.iface = SNDRV_CONTROL_IFACE_MIXER;
|
||||
control->id.iface = SNDRV_CTL_ELEMENT_IFACE_MIXER;
|
||||
strcpy(control->id.name, name);
|
||||
control->id.device = control->id.subdevice = 0;
|
||||
control->id.index = index;
|
||||
control->indirect = 0;
|
||||
memset(&control->reserved, 0, sizeof(control->reserved));
|
||||
return snd_ctl_cwrite(handle->ctl_handle, control);
|
||||
return snd_ctl_element_write(handle->ctl_handle, control);
|
||||
}
|
||||
|
||||
static mixer_simple_t *simple_new(mixer_simple_t *scontrol)
|
||||
|
|
@ -96,35 +96,35 @@ static mixer_simple_t *simple_new(mixer_simple_t *scontrol)
|
|||
return s;
|
||||
}
|
||||
|
||||
static void hcontrol_event_change(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED)
|
||||
static void hctl_element_event_change(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hctl_element_t *helem ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* ignore at this moment */
|
||||
}
|
||||
|
||||
static void hcontrol_event_value(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hcontrol_t *hcontrol)
|
||||
static void hctl_element_event_value(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hctl_element_t *helem)
|
||||
{
|
||||
snd_mixer_t *handle = (snd_mixer_t *)hcontrol->private_data;
|
||||
snd_mixer_t *handle = (snd_mixer_t *)helem->private_data;
|
||||
mixer_simple_t *s;
|
||||
struct list_head *list;
|
||||
list_for_each(list, &handle->simples) {
|
||||
s = list_entry(list, mixer_simple_t, list);
|
||||
if (snd_ctl_hbag_find(&s->hcontrols, &hcontrol->id))
|
||||
if (snd_ctl_hbag_find(&s->helems, &helem->id))
|
||||
s->change++;
|
||||
}
|
||||
}
|
||||
|
||||
static void hcontrol_event_remove(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED)
|
||||
static void hctl_element_event_remove(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hctl_element_t *helem ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* ignore at this moment */
|
||||
}
|
||||
|
||||
static void hcontrol_add(snd_mixer_t *handle, void **bag, snd_hcontrol_t *hcontrol)
|
||||
static void hctl_element_add(snd_mixer_t *handle, void **bag, snd_hctl_element_t *helem)
|
||||
{
|
||||
snd_ctl_hbag_add(bag, hcontrol);
|
||||
hcontrol->callback_change = hcontrol_event_change;
|
||||
hcontrol->callback_value = hcontrol_event_value;
|
||||
hcontrol->callback_remove = hcontrol_event_remove;
|
||||
hcontrol->private_data = handle;
|
||||
snd_ctl_hbag_add(bag, helem);
|
||||
helem->callback_change = hctl_element_event_change;
|
||||
helem->callback_value = hctl_element_event_value;
|
||||
helem->callback_remove = hctl_element_event_remove;
|
||||
helem->private_data = handle;
|
||||
}
|
||||
|
||||
static int simple_add(snd_mixer_t *handle, mixer_simple_t *scontrol)
|
||||
|
|
@ -142,7 +142,7 @@ static int simple_remove(snd_mixer_t *handle, mixer_simple_t *scontrol)
|
|||
return -EINVAL;
|
||||
list_del(&scontrol->list);
|
||||
handle->simple_count--;
|
||||
snd_ctl_hbag_destroy(&scontrol->hcontrols, NULL);
|
||||
snd_ctl_hbag_destroy(&scontrol->helems, NULL);
|
||||
free(scontrol);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -167,10 +167,10 @@ static const char *get_short_name(const char *lname)
|
|||
return lname;
|
||||
}
|
||||
|
||||
static int input_get_volume(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, const char *postfix, int voices)
|
||||
static int input_get_volume(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, const char *postfix, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s%s%s", get_full_name(simple->sid.name), direction, postfix);
|
||||
|
|
@ -181,10 +181,10 @@ static int input_get_volume(snd_mixer_t *handle, mixer_simple_t *simple, snd_mix
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_get_mute_switch(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, const char *postfix, int voices)
|
||||
static int input_get_mute_switch(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, const char *postfix, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s%s%s", get_full_name(simple->sid.name), direction, postfix);
|
||||
|
|
@ -196,10 +196,10 @@ static int input_get_mute_switch(snd_mixer_t *handle, mixer_simple_t *simple, sn
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_get_mute_route(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, int voices)
|
||||
static int input_get_mute_route(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s %sRoute", get_full_name(simple->sid.name), direction);
|
||||
|
|
@ -211,10 +211,10 @@ static int input_get_mute_route(snd_mixer_t *handle, mixer_simple_t *simple, snd
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_get_capture_switch(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, int voices)
|
||||
static int input_get_capture_switch(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s %sSwitch", get_full_name(simple->sid.name), direction);
|
||||
|
|
@ -226,10 +226,10 @@ static int input_get_capture_switch(snd_mixer_t *handle, mixer_simple_t *simple,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_get_capture_route(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, int voices)
|
||||
static int input_get_capture_route(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s %sRoute", get_full_name(simple->sid.name), direction);
|
||||
|
|
@ -241,7 +241,7 @@ static int input_get_capture_route(snd_mixer_t *handle, mixer_simple_t *simple,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_get(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control)
|
||||
static int input_get(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control)
|
||||
{
|
||||
int idx, err;
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ static int input_get(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simp
|
|||
} else if (simple->present & MIXER_PRESENT_CAPTURE_ROUTE) {
|
||||
input_get_capture_route(handle, simple, control, "Capture ", simple->croute_values);
|
||||
} else if (simple->present & MIXER_PRESENT_CAPTURE_SOURCE) {
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
if ((err = get_mixer_read(handle, "Capture Source", 0, &ctl)) < 0)
|
||||
return err;
|
||||
for (idx = 0; idx < simple->voices && idx < 32; idx++)
|
||||
|
|
@ -299,10 +299,10 @@ static int input_get(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simp
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_put_volume(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, const char *postfix, int voices)
|
||||
static int input_put_volume(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, const char *postfix, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s%s%s", get_full_name(simple->sid.name), direction, postfix);
|
||||
|
|
@ -317,10 +317,10 @@ static int input_put_volume(snd_mixer_t *handle, mixer_simple_t *simple, snd_mix
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_put_mute_switch(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, const char *postfix, int voices)
|
||||
static int input_put_mute_switch(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, const char *postfix, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s%s%s", get_full_name(simple->sid.name), direction, postfix);
|
||||
|
|
@ -333,10 +333,10 @@ static int input_put_mute_switch(snd_mixer_t *handle, mixer_simple_t *simple, sn
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_put_mute_route(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, int voices)
|
||||
static int input_put_mute_route(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s %sRoute", get_full_name(simple->sid.name), direction);
|
||||
|
|
@ -351,10 +351,10 @@ static int input_put_mute_route(snd_mixer_t *handle, mixer_simple_t *simple, snd
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_put_capture_switch(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, int voices)
|
||||
static int input_put_capture_switch(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s %sSwitch", get_full_name(simple->sid.name), direction);
|
||||
|
|
@ -367,10 +367,10 @@ static int input_put_capture_switch(snd_mixer_t *handle, mixer_simple_t *simple,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_put_capture_route(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, int voices)
|
||||
static int input_put_capture_route(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control, const char *direction, int voices)
|
||||
{
|
||||
char str[128];
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
int idx, err;
|
||||
|
||||
sprintf(str, "%s %sRoute", get_full_name(simple->sid.name), direction);
|
||||
|
|
@ -385,7 +385,7 @@ static int input_put_capture_route(snd_mixer_t *handle, mixer_simple_t *simple,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int input_put(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control)
|
||||
static int input_put(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_element_t *control)
|
||||
{
|
||||
int err, idx;
|
||||
|
||||
|
|
@ -422,7 +422,7 @@ static int input_put(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simp
|
|||
} else if (simple->present & MIXER_PRESENT_CAPTURE_ROUTE) {
|
||||
input_put_capture_route(handle, simple, control, "Capture ", simple->croute_values);
|
||||
} else if (simple->present & MIXER_PRESENT_CAPTURE_SOURCE) {
|
||||
snd_control_t ctl;
|
||||
snd_ctl_element_t ctl;
|
||||
if ((err = get_mixer_read(handle, "Capture Source", 0, &ctl)) < 0)
|
||||
return err;
|
||||
// fprintf(stderr, "put capture source : %i [0x%x]\n", simple->capture_item, control->capture);
|
||||
|
|
@ -458,15 +458,15 @@ static int build_input(snd_mixer_t *handle, const char *sname)
|
|||
char str[128];
|
||||
unsigned int present, caps, capture_item, voices;
|
||||
int index = -1, err;
|
||||
snd_control_info_t global_info;
|
||||
snd_control_info_t gswitch_info, pswitch_info, cswitch_info;
|
||||
snd_control_info_t gvolume_info, pvolume_info, cvolume_info;
|
||||
snd_control_info_t groute_info, proute_info, croute_info;
|
||||
snd_control_info_t csource_info;
|
||||
snd_ctl_element_info_t global_info;
|
||||
snd_ctl_element_info_t gswitch_info, pswitch_info, cswitch_info;
|
||||
snd_ctl_element_info_t gvolume_info, pvolume_info, cvolume_info;
|
||||
snd_ctl_element_info_t groute_info, proute_info, croute_info;
|
||||
snd_ctl_element_info_t csource_info;
|
||||
long min, max;
|
||||
void *bag;
|
||||
mixer_simple_t *simple;
|
||||
snd_hcontrol_t *hcontrol;
|
||||
snd_hctl_element_t *helem;
|
||||
const char *sname1;
|
||||
|
||||
memset(&gswitch_info, 0, sizeof(gswitch_info));
|
||||
|
|
@ -484,53 +484,53 @@ static int build_input(snd_mixer_t *handle, const char *sname)
|
|||
present = caps = capture_item = 0;
|
||||
min = max = 0;
|
||||
bag = NULL;
|
||||
if ((hcontrol = test_mixer_id(handle, sname, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, sname, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, sname, index, &global_info)) < 0)
|
||||
return err;
|
||||
if (global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN ||
|
||||
global_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
|
||||
if (global_info.type == SNDRV_CTL_ELEMENT_TYPE_BOOLEAN ||
|
||||
global_info.type == SNDRV_CTL_ELEMENT_TYPE_INTEGER) {
|
||||
if (voices < global_info.count)
|
||||
voices = global_info.count;
|
||||
caps |= global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN ? SND_MIXER_SCTCAP_MUTE : SND_MIXER_SCTCAP_VOLUME;
|
||||
present |= global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN ? MIXER_PRESENT_SINGLE_SWITCH : MIXER_PRESENT_SINGLE_VOLUME;
|
||||
if (global_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
|
||||
caps |= global_info.type == SNDRV_CTL_ELEMENT_TYPE_BOOLEAN ? SND_MIXER_SCTCAP_MUTE : SND_MIXER_SCTCAP_VOLUME;
|
||||
present |= global_info.type == SNDRV_CTL_ELEMENT_TYPE_BOOLEAN ? MIXER_PRESENT_SINGLE_SWITCH : MIXER_PRESENT_SINGLE_VOLUME;
|
||||
if (global_info.type == SNDRV_CTL_ELEMENT_TYPE_INTEGER) {
|
||||
if (min > global_info.value.integer.min)
|
||||
min = global_info.value.integer.min;
|
||||
if (max < global_info.value.integer.max)
|
||||
max = global_info.value.integer.max;
|
||||
}
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
sprintf(str, "%s Switch", sname);
|
||||
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, str, index, &gswitch_info)) < 0)
|
||||
return err;
|
||||
if (gswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) {
|
||||
if (gswitch_info.type == SNDRV_CTL_ELEMENT_TYPE_BOOLEAN) {
|
||||
if (voices < gswitch_info.count)
|
||||
voices = gswitch_info.count;
|
||||
caps |= SND_MIXER_SCTCAP_MUTE;
|
||||
present |= MIXER_PRESENT_GLOBAL_SWITCH;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
sprintf(str, "%s Route", sname);
|
||||
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, str, index, &groute_info)) < 0)
|
||||
return err;
|
||||
if (groute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && groute_info.count == 4) {
|
||||
if (groute_info.type == SNDRV_CTL_ELEMENT_TYPE_BOOLEAN && groute_info.count == 4) {
|
||||
if (voices < 2)
|
||||
voices = 2;
|
||||
caps |= SND_MIXER_SCTCAP_MUTE;
|
||||
present |= MIXER_PRESENT_GLOBAL_ROUTE;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
sprintf(str, "%s Volume", sname);
|
||||
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, str, index, &gvolume_info)) < 0)
|
||||
return err;
|
||||
if (gvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
|
||||
if (gvolume_info.type == SNDRV_CTL_ELEMENT_TYPE_INTEGER) {
|
||||
if (voices < gvolume_info.count)
|
||||
voices = gvolume_info.count;
|
||||
if (min > gvolume_info.value.integer.min)
|
||||
|
|
@ -539,62 +539,62 @@ static int build_input(snd_mixer_t *handle, const char *sname)
|
|||
max = gvolume_info.value.integer.max;
|
||||
caps |= SND_MIXER_SCTCAP_VOLUME;
|
||||
present |= MIXER_PRESENT_GLOBAL_VOLUME;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
sprintf(str, "%s Playback Switch", sname);
|
||||
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, str, index, &pswitch_info)) < 0)
|
||||
return err;
|
||||
if (pswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) {
|
||||
if (pswitch_info.type == SNDRV_CTL_ELEMENT_TYPE_BOOLEAN) {
|
||||
if (voices < pswitch_info.count)
|
||||
voices = pswitch_info.count;
|
||||
caps |= SND_MIXER_SCTCAP_MUTE;
|
||||
present |= MIXER_PRESENT_PLAYBACK_SWITCH;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
sprintf(str, "%s Playback Route", sname);
|
||||
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, str, index, &proute_info)) < 0)
|
||||
return err;
|
||||
if (proute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && proute_info.count == 4) {
|
||||
if (proute_info.type == SNDRV_CTL_ELEMENT_TYPE_BOOLEAN && proute_info.count == 4) {
|
||||
if (voices < 2)
|
||||
voices = 2;
|
||||
caps |= SND_MIXER_SCTCAP_MUTE;
|
||||
present |= MIXER_PRESENT_PLAYBACK_ROUTE;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
sprintf(str, "%s Capture Switch", sname);
|
||||
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, str, index, &cswitch_info)) < 0)
|
||||
return err;
|
||||
if (cswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) {
|
||||
if (cswitch_info.type == SNDRV_CTL_ELEMENT_TYPE_BOOLEAN) {
|
||||
if (voices < cswitch_info.count)
|
||||
voices = cswitch_info.count;
|
||||
caps |= SND_MIXER_SCTCAP_CAPTURE;
|
||||
present |= MIXER_PRESENT_CAPTURE_SWITCH;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
sprintf(str, "%s Capture Route", sname);
|
||||
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, str, index, &croute_info)) < 0)
|
||||
return err;
|
||||
if (croute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && croute_info.count == 4) {
|
||||
if (croute_info.type == SNDRV_CTL_ELEMENT_TYPE_BOOLEAN && croute_info.count == 4) {
|
||||
if (voices < 2)
|
||||
voices = 2;
|
||||
caps |= SND_MIXER_SCTCAP_CAPTURE;
|
||||
present |= MIXER_PRESENT_CAPTURE_ROUTE;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
sprintf(str, "%s Playback Volume", sname);
|
||||
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, str, index, &pvolume_info)) < 0)
|
||||
return err;
|
||||
if (pvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
|
||||
if (pvolume_info.type == SNDRV_CTL_ELEMENT_TYPE_INTEGER) {
|
||||
if (voices < pvolume_info.count)
|
||||
voices = pvolume_info.count;
|
||||
if (min > pvolume_info.value.integer.min)
|
||||
|
|
@ -603,14 +603,14 @@ static int build_input(snd_mixer_t *handle, const char *sname)
|
|||
max = pvolume_info.value.integer.max;
|
||||
caps |= SND_MIXER_SCTCAP_VOLUME;
|
||||
present |= MIXER_PRESENT_PLAYBACK_VOLUME;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
sprintf(str, "%s Capture Volume", sname);
|
||||
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((helem = test_mixer_id(handle, str, index)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, str, index, &cvolume_info)) < 0)
|
||||
return err;
|
||||
if (cvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
|
||||
if (cvolume_info.type == SNDRV_CTL_ELEMENT_TYPE_INTEGER) {
|
||||
if (voices < cvolume_info.count)
|
||||
voices = cvolume_info.count;
|
||||
if (min > pvolume_info.value.integer.min)
|
||||
|
|
@ -619,10 +619,10 @@ static int build_input(snd_mixer_t *handle, const char *sname)
|
|||
max = pvolume_info.value.integer.max;
|
||||
caps |= SND_MIXER_SCTCAP_VOLUME;
|
||||
present |= MIXER_PRESENT_CAPTURE_VOLUME;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
}
|
||||
}
|
||||
if (index == 0 && (hcontrol = test_mixer_id(handle, "Capture Source", 0)) != NULL) {
|
||||
if (index == 0 && (helem = test_mixer_id(handle, "Capture Source", 0)) != NULL) {
|
||||
if ((err = get_mixer_info(handle, "Capture Source", 0, &csource_info)) < 0)
|
||||
return err;
|
||||
strcpy(str, sname);
|
||||
|
|
@ -630,24 +630,24 @@ static int build_input(snd_mixer_t *handle, const char *sname)
|
|||
strcpy(str, "Mix");
|
||||
else if (!strcmp(str, "Master Mono")) /* special case */
|
||||
strcpy(str, "Mono Mix");
|
||||
if (csource_info.type == SNDRV_CONTROL_TYPE_ENUMERATED) {
|
||||
if (csource_info.type == SNDRV_CTL_ELEMENT_TYPE_ENUMERATED) {
|
||||
capture_item = 0;
|
||||
if (!strcmp(csource_info.value.enumerated.name, str)) {
|
||||
if (voices < csource_info.count)
|
||||
voices = csource_info.count;
|
||||
caps |= SND_MIXER_SCTCAP_CAPTURE;
|
||||
present |= MIXER_PRESENT_CAPTURE_SOURCE;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
} else for (capture_item = 1; capture_item < csource_info.value.enumerated.items; capture_item++) {
|
||||
csource_info.value.enumerated.item = capture_item;
|
||||
if ((err = snd_ctl_cinfo(handle->ctl_handle, &csource_info)) < 0)
|
||||
if ((err = snd_ctl_element_info(handle->ctl_handle, &csource_info)) < 0)
|
||||
return err;
|
||||
if (!strcmp(csource_info.value.enumerated.name, str)) {
|
||||
if (voices < csource_info.count)
|
||||
voices = csource_info.count;
|
||||
caps |= SND_MIXER_SCTCAP_CAPTURE;
|
||||
present |= MIXER_PRESENT_CAPTURE_SOURCE;
|
||||
hcontrol_add(handle, &bag, hcontrol);
|
||||
hctl_element_add(handle, &bag, helem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -722,7 +722,7 @@ static int build_input(snd_mixer_t *handle, const char *sname)
|
|||
simple->voices = voices;
|
||||
simple->min = min;
|
||||
simple->max = max;
|
||||
simple->hcontrols = bag;
|
||||
simple->helems = bag;
|
||||
// fprintf(stderr, "sname = '%s', index = %i, present = 0x%x, voices = %i\n", sname, index, present, voices);
|
||||
};
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -144,7 +144,6 @@ int snd_rawmidi_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
snd_config_t *rawmidi_conf, *conf, *type_conf;
|
||||
snd_config_iterator_t i;
|
||||
snd_rawmidi_params_t params;
|
||||
unsigned int stream;
|
||||
const char *lib = NULL, *open = NULL;
|
||||
int (*open_func)(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
||||
char *name, snd_config_t *conf, int mode);
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
snd_rawmidi_t *rmidi;
|
||||
snd_rawmidi_hw_t *hw = NULL;
|
||||
snd_rawmidi_info_t info;
|
||||
int fmode, str;
|
||||
int c;
|
||||
int fmode;
|
||||
|
||||
if (inputp)
|
||||
*inputp = NULL;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ int main(void)
|
|||
{
|
||||
int idx, idx1, cards, err;
|
||||
snd_ctl_t *handle;
|
||||
snd_ctl_info_t info;
|
||||
snd_ctl_card_info_t info;
|
||||
snd_pcm_info_t pcminfo;
|
||||
snd_mixer_info_t mixerinfo;
|
||||
snd_rawmidi_info_t rawmidiinfo;
|
||||
|
|
@ -23,7 +23,7 @@ int main(void)
|
|||
printf("Open error: %s\n", snd_strerror(err));
|
||||
continue;
|
||||
}
|
||||
if ((err = snd_ctl_info(handle, &info)) < 0) {
|
||||
if ((err = snd_ctl_card_info(handle, &info)) < 0) {
|
||||
printf("HW info error: %s\n", snd_strerror(err));
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ int main(void)
|
|||
{
|
||||
int idx, idx1, cards, err;
|
||||
snd_ctl_t *handle;
|
||||
snd_ctl_info_t info;
|
||||
snd_ctl_card_info_t info;
|
||||
|
||||
cards = snd_cards();
|
||||
printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
|
||||
|
|
@ -45,7 +45,7 @@ int main(void)
|
|||
printf("Open error: %s\n", snd_strerror(err));
|
||||
continue;
|
||||
}
|
||||
if ((err = snd_ctl_info(handle, &info)) < 0) {
|
||||
if ((err = snd_ctl_card_info(handle, &info)) < 0) {
|
||||
printf("HW info error: %s\n", snd_strerror(err));
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ int main(void)
|
|||
{
|
||||
snd_ctl_t *ctl_handle;
|
||||
int cards, card, err, idx;
|
||||
snd_ctl_info_t info;
|
||||
snd_ctl_card_info_t info;
|
||||
|
||||
cards = snd_cards();
|
||||
printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
|
||||
|
|
@ -122,7 +122,7 @@ int main(void)
|
|||
printf("CTL open error: %s\n", snd_strerror(err));
|
||||
continue;
|
||||
}
|
||||
if ((err = snd_ctl_info(ctl_handle, &info)) < 0) {
|
||||
if ((err = snd_ctl_card_info(ctl_handle, &info)) < 0) {
|
||||
printf("HWINFO error: %s\n", snd_strerror(err));
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue