Control API encapsulation. Better names for kernel API. Simpler PCM hw_params API. Added missing const.

This commit is contained in:
Abramo Bagnara 2001-02-06 23:48:10 +00:00
parent ccb399f0cd
commit 8f0cb26fdf
71 changed files with 2001 additions and 694 deletions

View file

@ -24,10 +24,8 @@
#include <sys/un.h> #include <sys/un.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <assert.h>
#include <stddef.h> #include <stddef.h>
#include <getopt.h> #include <getopt.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -573,13 +571,13 @@ int ctl_shm_cmd(client_t *client)
ctrl->cmd = 0; ctrl->cmd = 0;
ctl = client->device.control.handle; ctl = client->device.control.handle;
switch (cmd) { switch (cmd) {
case SNDRV_CTL_IOCTL_HW_INFO: case SNDRV_CTL_IOCTL_INFO:
ctrl->result = snd_ctl_hw_info(ctl, &ctrl->u.hw_info); ctrl->result = snd_ctl_info(ctl, &ctrl->u.hw_info);
break; break;
case SNDRV_CTL_IOCTL_CONTROL_LIST: case SNDRV_CTL_IOCTL_CONTROL_LIST:
{ {
size_t maxsize = CTL_SHM_DATA_MAXLEN; size_t maxsize = CTL_SHM_DATA_MAXLEN;
if (ctrl->u.clist.controls_request * sizeof(*ctrl->u.clist.pids) > maxsize) { if (ctrl->u.clist.space * sizeof(*ctrl->u.clist.pids) > maxsize) {
ctrl->result = -EFAULT; ctrl->result = -EFAULT;
break; break;
} }
@ -837,7 +835,7 @@ int inet_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
return 0; return 0;
} }
int server(char *sockname, int port) int server(const char *sockname, int port)
{ {
int err; int err;
unsigned int k; unsigned int k;
@ -939,8 +937,8 @@ int main(int argc, char **argv)
int c; int c;
snd_config_t *conf; snd_config_t *conf;
snd_config_iterator_t i; snd_config_iterator_t i;
char *socket = NULL; const char *socket = NULL;
char *host = NULL; const char *host = NULL;
long port = -1; long port = -1;
int err; int err;
char *srvname; char *srvname;

View file

@ -5,7 +5,7 @@ sysinclude_HEADERS = asoundlib.h
# #
header_files=header.h version.h global.h input.h output.h error.h mixer.h \ header_files=header.h version.h global.h input.h output.h error.h mixer.h \
pcm.h pcm_m4.h rawmidi.h rawmidi_m4.h timer.h \ pcm.h pcm_m4.h rawmidi.h rawmidi_m4.h timer.h \
hwdep.h hwdep_m4.h control.h \ hwdep.h hwdep_m4.h control.h control_m4.h \
seq.h seqmid.h seq_midi_event.h \ seq.h seqmid.h seq_midi_event.h \
conv.h instr.h conf.h footer.h conv.h instr.h conf.h footer.h

View file

@ -89,7 +89,7 @@ typedef struct {
int cmd; int cmd;
union { union {
int device; int device;
snd_ctl_hw_info_t hw_info; snd_ctl_info_t hw_info;
snd_control_list_t clist; snd_control_list_t clist;
snd_control_info_t cinfo; snd_control_info_t cinfo;
snd_control_t cread; snd_control_t cread;

View file

@ -1,4 +1,18 @@
#define LIST_HEAD_IS_DEFINED
struct list_head {
struct list_head *next, *prev;
};
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
enum _snd_config_type { enum _snd_config_type {
SND_CONFIG_TYPE_INTEGER, SND_CONFIG_TYPE_INTEGER,
SND_CONFIG_TYPE_REAL, SND_CONFIG_TYPE_REAL,
@ -50,30 +64,27 @@ int snd_config_top(snd_config_t **config);
int snd_config_load(snd_config_t *config, snd_input_t *in); int snd_config_load(snd_config_t *config, snd_input_t *in);
int snd_config_save(snd_config_t *config, snd_output_t *out); int snd_config_save(snd_config_t *config, snd_output_t *out);
int snd_config_search(snd_config_t *config, char *key, snd_config_t **result); int snd_config_search(snd_config_t *config, const char *key,
snd_config_t **result);
int snd_config_searchv(snd_config_t *config, int snd_config_searchv(snd_config_t *config,
snd_config_t **result, ...); snd_config_t **result, ...);
int snd_config_add(snd_config_t *config, snd_config_t *leaf); int snd_config_add(snd_config_t *config, snd_config_t *leaf);
int snd_config_delete(snd_config_t *config); int snd_config_delete(snd_config_t *config);
int snd_config_make(snd_config_t **config, char *key, int snd_config_make(snd_config_t **config, const char *key,
snd_config_type_t type); snd_config_type_t type);
int snd_config_integer_make(snd_config_t **config, char *key); int snd_config_integer_make(snd_config_t **config, const char *key);
int snd_config_real_make(snd_config_t **config, char *key); int snd_config_real_make(snd_config_t **config, const char *key);
int snd_config_string_make(snd_config_t **config, char *key); int snd_config_string_make(snd_config_t **config, const char *key);
int snd_config_compound_make(snd_config_t **config, char *key, int join); int snd_config_compound_make(snd_config_t **config, const char *key, int join);
int snd_config_integer_set(snd_config_t *config, long value); int snd_config_integer_set(snd_config_t *config, long value);
int snd_config_real_set(snd_config_t *config, double value); int snd_config_real_set(snd_config_t *config, double value);
int snd_config_string_set(snd_config_t *config, char *value); int snd_config_string_set(snd_config_t *config, const char *value);
int snd_config_integer_get(snd_config_t *config, long *value); int snd_config_integer_get(snd_config_t *config, long *value);
int snd_config_real_get(snd_config_t *config, double *value); int snd_config_real_get(snd_config_t *config, double *value);
int snd_config_string_get(snd_config_t *config, char **value); int snd_config_string_get(snd_config_t *config, const char **value);
/* One argument: long, double or char* */
int snd_config_set(snd_config_t *config, ...);
int snd_config_get(snd_config_t *config, void *);
typedef struct list_head *snd_config_iterator_t; typedef struct list_head *snd_config_iterator_t;

View file

@ -6,21 +6,20 @@
****************************************************************************/ ****************************************************************************/
typedef struct sndrv_aes_iec958 snd_aes_iec958_t; typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
typedef union sndrv_digital_audio snd_digital_audio_t; typedef struct _snd_ctl_info snd_ctl_info_t;
typedef struct sndrv_ctl_hw_info snd_ctl_hw_info_t; typedef struct _snd_control_id snd_control_id_t;
typedef struct sndrv_control_id snd_control_id_t; typedef struct _snd_control_list snd_control_list_t;
typedef struct sndrv_control_list snd_control_list_t; typedef struct _snd_control_info snd_control_info_t;
typedef struct sndrv_control_info snd_control_info_t; typedef struct _snd_control snd_control_t;
typedef struct sndrv_control snd_control_t; typedef struct _snd_ctl_event snd_ctl_event_t;
typedef struct sndrv_ctl_event snd_ctl_event_t;
#ifdef SND_ENUM_TYPECHECK #ifdef SND_ENUM_TYPECHECK
typedef struct __snd_card_type *snd_card_type; typedef struct __snd_card_type *snd_card_type_t;
typedef struct __snd_control_type *snd_control_type_t; typedef struct __snd_control_type *snd_control_type_t;
typedef struct __snd_control_iface *snd_control_iface_t; typedef struct __snd_control_iface *snd_control_iface_t;
typedef struct __snd_ctl_event_type *snd_ctl_event_type_t; typedef struct __snd_ctl_event_type *snd_ctl_event_type_t;
#else #else
typedef enum sndrv_card_type snd_card_type; typedef enum sndrv_card_type snd_card_type_t;
typedef enum sndrv_control_type snd_control_type_t; typedef enum sndrv_control_type snd_control_type_t;
typedef enum sndrv_control_iface snd_control_iface_t; typedef enum sndrv_control_iface snd_control_iface_t;
typedef enum sndrv_ctl_event_type snd_ctl_event_type_t; typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
@ -102,6 +101,7 @@ typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
#define SND_CONTROL_TYPE_ENUMERATED ((snd_control_type_t) SNDRV_CONTROL_TYPE_ENUMERATED) #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_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_IEC958 ((snd_control_type_t) SNDRV_CONTROL_TYPE_IEC958)
#define SND_CONTROL_TYPE_LAST ((snd_control_type_t) SNDRV_CONTROL_TYPE_LAST)
#define SND_CONTROL_IFACE_CARD ((snd_control_iface_t) SNDRV_CONTROL_IFACE_CARD) #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_HWDEP ((snd_control_iface_t) SNDRV_CONTROL_IFACE_HWDEP)
@ -110,20 +110,14 @@ typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
#define SND_CONTROL_IFACE_RAWMIDI ((snd_control_iface_t) SNDRV_CONTROL_IFACE_RAWMIDI) #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_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_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_EVENT_REBUILD ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_REBUILD) #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) #define SND_CTL_EVENT_VALUE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_VALUE)
#define SND_CTL_EVENT_CHANGE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_CHANGE) #define SND_CTL_EVENT_CHANGE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_CHANGE)
#define SND_CTL_EVENT_ADD ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_ADD) #define SND_CTL_EVENT_ADD ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_ADD)
#define SND_CTL_EVENT_REMOVE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_REMOVE) #define SND_CTL_EVENT_REMOVE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_REMOVE)
#define SND_CTL_EVENT_LAST ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_LAST)
#define SND_CONTROL_ACCESS_READ SNDRV_CONTROL_ACCESS_READ
#define SND_CONTROL_ACCESS_WRITE SNDRV_CONTROL_ACCESS_WRITE
#define SND_CONTROL_ACCESS_READWRITE SNDRV_CONTROL_ACCESS_READWRITE
#define SND_CONTROL_ACCESS_VOLATILE SNDRV_CONTROL_ACCESS_VOLATILE
#define SND_CONTROL_ACCESS_INACTIVE SNDRV_CONTROL_ACCESS_INACTIVE
#define SND_CONTROL_ACCESS_LOCK SNDRV_CONTROL_ACCESS_LOCK
#define SND_CONTROL_ACCESS_INDIRECT SNDRV_CONTROL_ACCESS_INDIRECT
enum _snd_ctl_type { enum _snd_ctl_type {
SND_CTL_TYPE_HW, SND_CTL_TYPE_HW,
@ -142,16 +136,7 @@ typedef enum _snd_ctl_type snd_ctl_type_t;
#define SND_CTL_TYPE_INET ((snd_ctl_type_t) SND_CTL_TYPE_INET) #define SND_CTL_TYPE_INET ((snd_ctl_type_t) SND_CTL_TYPE_INET)
typedef struct _snd_ctl snd_ctl_t; typedef struct _snd_ctl snd_ctl_t;
typedef struct _snd_ctl_callbacks snd_ctl_callbacks_t;
typedef 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 *reserved[58]; /* reserved for the future use - must be NULL!!! */
} snd_ctl_callbacks_t;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -175,7 +160,7 @@ int snd_ctl_open(snd_ctl_t **handle, char *name);
int snd_ctl_close(snd_ctl_t *handle); int snd_ctl_close(snd_ctl_t *handle);
int snd_ctl_card(snd_ctl_t *handle); int snd_ctl_card(snd_ctl_t *handle);
int snd_ctl_poll_descriptor(snd_ctl_t *handle); int snd_ctl_poll_descriptor(snd_ctl_t *handle);
int snd_ctl_hw_info(snd_ctl_t *handle, snd_ctl_hw_info_t *info); 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_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_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_cread(snd_ctl_t *handle, snd_control_t * control);
@ -191,6 +176,15 @@ 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); 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);
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_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);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
@ -199,57 +193,20 @@ int snd_ctl_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks);
* Highlevel API for controls * Highlevel API for controls
*/ */
#define LIST_HEAD_IS_DEFINED
struct list_head {
struct list_head *next, *prev;
};
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
typedef struct _snd_hcontrol_list snd_hcontrol_list_t; typedef struct _snd_hcontrol_list snd_hcontrol_list_t;
typedef struct _snd_hcontrol snd_hcontrol_t; typedef struct _snd_hcontrol snd_hcontrol_t;
struct _snd_hcontrol_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) controls */
unsigned int controls; /* R: count of all available controls */
snd_control_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 */
int change: 1, /* structure change */
value: 1; /* value change */
/* event callbacks */
void (*event_change)(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
void (*event_value)(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
void (*event_remove)(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
/* private data */
void *private_data;
void (*private_free)(void *private_data);
/* links */
snd_ctl_t *handle; /* associated handle */
};
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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_hcontrol_t *c1, const snd_hcontrol_t *c2);
typedef void (snd_ctl_hcallback_rebuild_t)(snd_ctl_t *handle, void *private_data); 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_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);
int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t *csort); int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t csort);
int snd_ctl_hfree(snd_ctl_t *handle); int snd_ctl_hfree(snd_ctl_t *handle);
snd_hcontrol_t *snd_ctl_hfirst(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_hlast(snd_ctl_t *handle);
@ -259,9 +216,9 @@ int snd_ctl_hcount(snd_ctl_t *handle);
snd_hcontrol_t *snd_ctl_hfind(snd_ctl_t *handle, snd_control_id_t *id); 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_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist);
int snd_ctl_hsort(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2); int snd_ctl_hsort(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2);
int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t *csort); 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_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_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_hevent(snd_ctl_t *handle);
int snd_ctl_hbag_create(void **bag); int snd_ctl_hbag_create(void **bag);
@ -269,6 +226,8 @@ int snd_ctl_hbag_destroy(void **bag, void (*hcontrol_free)(snd_hcontrol_t *hcont
int snd_ctl_hbag_add(void **bag, 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); 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); 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);
#ifdef __cplusplus #ifdef __cplusplus
} }

284
include/control_m4.h Normal file
View file

@ -0,0 +1,284 @@
#ifdef __cplusplus
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);
unsigned int snd_control_id_get_numid(const snd_control_id_t *obj);
snd_control_iface_t snd_control_id_get_interface(const snd_control_id_t *obj);
unsigned int snd_control_id_get_device(const snd_control_id_t *obj);
unsigned int snd_control_id_get_subdevice(const snd_control_id_t *obj);
const char *snd_control_id_get_name(const snd_control_id_t *obj);
unsigned int snd_control_id_get_index(const snd_control_id_t *obj);
void snd_control_id_set_numid(snd_control_id_t *obj, unsigned int val);
void snd_control_id_set_interface(snd_control_id_t *obj, snd_control_iface_t val);
void snd_control_id_set_device(snd_control_id_t *obj, unsigned int val);
void snd_control_id_set_subdevice(snd_control_id_t *obj, unsigned int val);
void snd_control_id_set_name(snd_control_id_t *obj, const char *val);
void snd_control_id_set_index(snd_control_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);
int snd_ctl_info_get_card(const snd_ctl_info_t *obj);
snd_card_type_t snd_ctl_info_get_type(const snd_ctl_info_t *obj);
const char *snd_ctl_info_get_id(const snd_ctl_info_t *obj);
const char *snd_ctl_info_get_abbreviation(const snd_ctl_info_t *obj);
const char *snd_ctl_info_get_name(const snd_ctl_info_t *obj);
const char *snd_ctl_info_get_longname(const snd_ctl_info_t *obj);
const char *snd_ctl_info_get_mixerid(const snd_ctl_info_t *obj);
const char *snd_ctl_info_get_mixername(const snd_ctl_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; })
int snd_ctl_event_malloc(snd_ctl_event_t **ptr);
void snd_ctl_event_free(snd_ctl_event_t *obj);
void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src);
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);
snd_control_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);
unsigned int snd_ctl_event_get_subdevice(const snd_ctl_event_t *obj);
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);
void snd_control_list_set_offset(snd_control_list_t *obj, unsigned int val);
unsigned int snd_control_list_get_used(const snd_control_list_t *obj);
unsigned int snd_control_list_get_count(const snd_control_list_t *obj);
void snd_control_list_get_id(const snd_control_list_t *obj, unsigned int idx, snd_control_id_t *ptr);
unsigned int snd_control_list_get_numid(const snd_control_list_t *obj, unsigned int idx);
snd_control_iface_t snd_control_list_get_interface(const snd_control_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_control_list_get_subdevice(const snd_control_list_t *obj, unsigned int idx);
const char *snd_control_list_get_name(const snd_control_list_t *obj, unsigned int idx);
unsigned int snd_control_list_get_index(const snd_control_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);
snd_control_type_t snd_control_info_get_type(const snd_control_info_t *obj);
int snd_control_info_is_readable(const snd_control_info_t *obj);
int snd_control_info_is_writable(const snd_control_info_t *obj);
int snd_control_info_is_volatile(const snd_control_info_t *obj);
int snd_control_info_is_inactive(const snd_control_info_t *obj);
int snd_control_info_is_locked(const snd_control_info_t *obj);
int snd_control_info_is_indirect(const snd_control_info_t *obj);
unsigned int snd_control_info_get_count(const snd_control_info_t *obj);
long snd_control_info_get_min(const snd_control_info_t *obj);
long snd_control_info_get_max(const snd_control_info_t *obj);
long snd_control_info_get_step(const snd_control_info_t *obj);
unsigned int snd_control_info_get_items(const snd_control_info_t *obj);
void snd_control_info_set_item(snd_control_info_t *obj, unsigned int val);
const char *snd_control_info_get_item_name(const snd_control_info_t *obj);
void snd_control_info_get_id(const snd_control_info_t *obj, snd_control_id_t *ptr);
unsigned int snd_control_info_get_numid(const snd_control_info_t *obj);
snd_control_iface_t snd_control_info_get_interface(const snd_control_info_t *obj);
unsigned int snd_control_info_get_device(const snd_control_info_t *obj);
unsigned int snd_control_info_get_subdevice(const snd_control_info_t *obj);
const char *snd_control_info_get_name(const snd_control_info_t *obj);
unsigned int snd_control_info_get_index(const snd_control_info_t *obj);
void snd_control_info_set_id(snd_control_info_t *obj, const snd_control_id_t *ptr);
void snd_control_info_set_numid(snd_control_info_t *obj, unsigned int val);
void snd_control_info_set_interface(snd_control_info_t *obj, snd_control_iface_t val);
void snd_control_info_set_device(snd_control_info_t *obj, unsigned int val);
void snd_control_info_set_subdevice(snd_control_info_t *obj, unsigned int val);
void snd_control_info_set_name(snd_control_info_t *obj, const char *val);
void snd_control_info_set_index(snd_control_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);
void snd_control_get_id(const snd_control_t *obj, snd_control_id_t *ptr);
unsigned int snd_control_get_numid(const snd_control_t *obj);
snd_control_iface_t snd_control_get_interface(const snd_control_t *obj);
unsigned int snd_control_get_device(const snd_control_t *obj);
unsigned int snd_control_get_subdevice(const snd_control_t *obj);
const char *snd_control_get_name(const snd_control_t *obj);
unsigned int snd_control_get_index(const snd_control_t *obj);
void snd_control_set_id(snd_control_t *obj, const snd_control_id_t *ptr);
void snd_control_set_numid(snd_control_t *obj, unsigned int val);
void snd_control_set_interface(snd_control_t *obj, snd_control_iface_t val);
void snd_control_set_device(snd_control_t *obj, unsigned int val);
void snd_control_set_subdevice(snd_control_t *obj, unsigned int val);
void snd_control_set_name(snd_control_t *obj, const char *val);
void snd_control_set_index(snd_control_t *obj, unsigned int val);
long snd_control_get_boolean(const snd_control_t *obj, unsigned int idx);
long snd_control_get_integer(const snd_control_t *obj, unsigned int idx);
unsigned int snd_control_get_enumerated(const snd_control_t *obj, unsigned int idx);
unsigned char snd_control_get_byte(const snd_control_t *obj, unsigned int idx);
void snd_control_set_boolean(snd_control_t *obj, unsigned int idx, long val);
void snd_control_set_integer(snd_control_t *obj, unsigned int idx, long val);
void snd_control_set_enumerated(snd_control_t *obj, unsigned int idx, unsigned int val);
void snd_control_set_byte(snd_control_t *obj, unsigned int idx, unsigned char val);
const void * snd_control_get_bytes(const snd_control_t *obj);
void snd_control_get_iec958(const snd_control_t *obj, snd_aes_iec958_t *ptr);
void snd_control_set_iec958(snd_control_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);
void snd_hcontrol_list_set_offset(snd_hcontrol_list_t *obj, unsigned int val);
unsigned int snd_hcontrol_list_get_used(const snd_hcontrol_list_t *obj);
unsigned int snd_hcontrol_list_get_count(const snd_hcontrol_list_t *obj);
void snd_hcontrol_list_get_id(const snd_hcontrol_list_t *obj, unsigned int idx, snd_control_id_t *ptr);
unsigned int snd_hcontrol_list_get_numid(const snd_hcontrol_list_t *obj, unsigned int idx);
snd_control_iface_t snd_hcontrol_list_get_interface(const snd_hcontrol_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_hcontrol_list_get_subdevice(const snd_hcontrol_list_t *obj, unsigned int idx);
const char *snd_hcontrol_list_get_name(const snd_hcontrol_list_t *obj, unsigned int idx);
unsigned int snd_hcontrol_list_get_index(const snd_hcontrol_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);
void snd_hcontrol_get_id(const snd_hcontrol_t *obj, snd_control_id_t *ptr);
unsigned int snd_hcontrol_get_numid(const snd_hcontrol_t *obj);
snd_control_iface_t snd_hcontrol_get_interface(const snd_hcontrol_t *obj);
unsigned int snd_hcontrol_get_device(const snd_hcontrol_t *obj);
unsigned int snd_hcontrol_get_subdevice(const snd_hcontrol_t *obj);
const char *snd_hcontrol_get_name(const snd_hcontrol_t *obj);
unsigned int snd_hcontrol_get_index(const snd_hcontrol_t *obj);
void snd_hcontrol_set_callback_change(snd_hcontrol_t *obj, snd_hcontrol_callback_t val);
void snd_hcontrol_set_callback_value(snd_hcontrol_t *obj, snd_hcontrol_callback_t val);
void snd_hcontrol_set_callback_remove(snd_hcontrol_t *obj, snd_hcontrol_callback_t val);
void * snd_hcontrol_get_private_data(const snd_hcontrol_t *obj);
void snd_hcontrol_set_private_data(snd_hcontrol_t *obj, void * val);
void snd_hcontrol_set_private_free(snd_hcontrol_t *obj, snd_hcontrol_private_free_t val);
#ifdef __cplusplus
}
#endif

View file

@ -10,7 +10,7 @@
#define SND_BIG_ENDIAN SNDRV_BIG_ENDIAN #define SND_BIG_ENDIAN SNDRV_BIG_ENDIAN
#endif #endif
//#define SND_ENUM_TYPECHECK #define SND_ENUM_TYPECHECK
#ifdef SND_ENUM_TYPECHECK #ifdef SND_ENUM_TYPECHECK
#define snd_enum_to_int(v) ((unsigned int)(unsigned long)(v)) #define snd_enum_to_int(v) ((unsigned int)(unsigned long)(v))
@ -22,19 +22,3 @@
#define snd_enum_incr(v) (++(v)) #define snd_enum_incr(v) (++(v))
#endif #endif
enum _snd_set_mode {
SND_CHANGE,
SND_TRY,
SND_TEST,
};
#ifdef SND_ENUM_TYPECHECK
typedef struct __snd_set_mode *snd_set_mode_t;
#else
typedef enum _snd_set_mode snd_set_mode_t;
#endif
#define SND_CHANGE ((snd_set_mode_t) SND_CHANGE)
#define SND_TRY ((snd_set_mode_t) SND_TRY)
#define SND_TEST ((snd_set_mode_t) SND_TEST)

View file

@ -31,6 +31,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <assert.h>
#include <sys/uio.h> #include <sys/uio.h>
#ifndef ATTRIBUTE_UNUSED #ifndef ATTRIBUTE_UNUSED

View file

@ -3,7 +3,7 @@ extern "C" {
#endif #endif
size_t snd_hwdep_info_sizeof(); size_t snd_hwdep_info_sizeof();
#define snd_hwdep_info_alloca(ptr) ({assert(ptr); *ptr = (snd_hwdep_info_t *) alloca(snd_hwdep_info_sizeof()); 0;}) #define snd_hwdep_info_alloca(ptr) ({ assert(ptr); *ptr = (snd_hwdep_info_t *) alloca(snd_hwdep_info_sizeof()); memset(*ptr, 0, snd_hwdep_info_sizeof()); 0; })
int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr); int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr);
void snd_hwdep_info_free(snd_hwdep_info_t *obj); void snd_hwdep_info_free(snd_hwdep_info_t *obj);
void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src); void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src);
@ -12,9 +12,9 @@ unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj);
int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj); int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj);
const char * snd_hwdep_info_get_id(const snd_hwdep_info_t *obj); const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj);
const char * snd_hwdep_info_get_name(const snd_hwdep_info_t *obj); const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj);
snd_hwdep_type_t snd_hwdep_info_get_type(const snd_hwdep_info_t *obj); snd_hwdep_type_t snd_hwdep_info_get_type(const snd_hwdep_info_t *obj);

View file

@ -19,12 +19,22 @@
* *
*/ */
#ifndef __LOCAL_H
#define __LOCAL_H
#define _snd_interval sndrv_interval #define _snd_interval sndrv_interval
#define _snd_pcm_info sndrv_pcm_info #define _snd_pcm_info sndrv_pcm_info
#define _snd_pcm_hw_params sndrv_pcm_hw_params #define _snd_pcm_hw_params sndrv_pcm_hw_params
#define _snd_pcm_sw_params sndrv_pcm_sw_params #define _snd_pcm_sw_params sndrv_pcm_sw_params
#define _snd_pcm_status sndrv_pcm_status #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_event sndrv_ctl_event
#define _snd_rawmidi_info sndrv_rawmidi_info #define _snd_rawmidi_info sndrv_rawmidi_info
#define _snd_rawmidi_params sndrv_rawmidi_params #define _snd_rawmidi_params sndrv_rawmidi_params
#define _snd_rawmidi_status sndrv_rawmidi_status #define _snd_rawmidi_status sndrv_rawmidi_status
@ -32,6 +42,7 @@
#define _snd_hwdep_info sndrv_hwdep_info #define _snd_hwdep_info sndrv_hwdep_info
#include "asoundlib.h" #include "asoundlib.h"
#include <errno.h>
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#define ERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__) #define ERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__)
@ -41,3 +52,20 @@
#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, ##args) #define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, ##args)
#endif #endif
enum _snd_set_mode {
SND_CHANGE,
SND_TRY,
SND_TEST,
};
#ifdef SND_ENUM_TYPECHECK
typedef struct __snd_set_mode *snd_set_mode_t;
#else
typedef enum _snd_set_mode snd_set_mode_t;
#endif
#define SND_CHANGE ((snd_set_mode_t) SND_CHANGE)
#define SND_TRY ((snd_set_mode_t) SND_TRY)
#define SND_TEST ((snd_set_mode_t) SND_TEST)
#endif

View file

@ -41,17 +41,23 @@ typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
#define SND_PCM_CLASS_MULTI ((snd_pcm_class_t) SNDRV_PCM_CLASS_MULTI) #define SND_PCM_CLASS_MULTI ((snd_pcm_class_t) SNDRV_PCM_CLASS_MULTI)
#define SND_PCM_CLASS_MODEM ((snd_pcm_class_t) SNDRV_PCM_CLASS_MODEM) #define SND_PCM_CLASS_MODEM ((snd_pcm_class_t) SNDRV_PCM_CLASS_MODEM)
#define SND_PCM_CLASS_DIGITIZER ((snd_pcm_class_t) SNDRV_PCM_CLASS_DIGITIZER) #define SND_PCM_CLASS_DIGITIZER ((snd_pcm_class_t) SNDRV_PCM_CLASS_DIGITIZER)
#define SND_PCM_CLASS_LAST ((snd_pcm_class_t) SNDRV_PCM_CLASS_LAST)
#define SND_PCM_SUBCLASS_GENERIC_MIX ((snd_pcm_subclass_t) SNDRV_PCM_SUBCLASS_GENERIC_MIX) #define SND_PCM_SUBCLASS_GENERIC_MIX ((snd_pcm_subclass_t) SNDRV_PCM_SUBCLASS_GENERIC_MIX)
#define SND_PCM_SUBCLASS_MULTI_MIX ((snd_pcm_subclass_t) SNDRV_PCM_SUBCLASS_MULTI_MIX) #define SND_PCM_SUBCLASS_MULTI_MIX ((snd_pcm_subclass_t) SNDRV_PCM_SUBCLASS_MULTI_MIX)
#define SND_PCM_SUBCLASS_LAST ((snd_pcm_subclass_t) SNDRV_PCM_SUBCLASS_LAST)
#define SND_PCM_STREAM_PLAYBACK ((snd_pcm_stream_t) SNDRV_PCM_STREAM_PLAYBACK) #define SND_PCM_STREAM_PLAYBACK ((snd_pcm_stream_t) SNDRV_PCM_STREAM_PLAYBACK)
#define SND_PCM_STREAM_CAPTURE ((snd_pcm_stream_t) SNDRV_PCM_STREAM_CAPTURE) #define SND_PCM_STREAM_CAPTURE ((snd_pcm_stream_t) SNDRV_PCM_STREAM_CAPTURE)
#define SND_PCM_STREAM_LAST ((snd_pcm_stream_t) SNDRV_PCM_STREAM_LAST) #define SND_PCM_STREAM_LAST ((snd_pcm_stream_t) SNDRV_PCM_STREAM_LAST)
#define SND_PCM_ACCESS_MMAP_INTERLEAVED ((snd_pcm_access_t) SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) #define SND_PCM_ACCESS_MMAP_INTERLEAVED ((snd_pcm_access_t) SNDRV_PCM_ACCESS_MMAP_INTERLEAVED)
#define SND_PCM_ACCESS_MMAP_NONINTERLEAVED ((snd_pcm_access_t) SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED) #define SND_PCM_ACCESS_MMAP_NONINTERLEAVED ((snd_pcm_access_t) SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED)
#define SND_PCM_ACCESS_MMAP_COMPLEX ((snd_pcm_access_t) SNDRV_PCM_ACCESS_MMAP_COMPLEX) #define SND_PCM_ACCESS_MMAP_COMPLEX ((snd_pcm_access_t) SNDRV_PCM_ACCESS_MMAP_COMPLEX)
#define SND_PCM_ACCESS_RW_INTERLEAVED ((snd_pcm_access_t) SNDRV_PCM_ACCESS_RW_INTERLEAVED) #define SND_PCM_ACCESS_RW_INTERLEAVED ((snd_pcm_access_t) SNDRV_PCM_ACCESS_RW_INTERLEAVED)
#define SND_PCM_ACCESS_RW_NONINTERLEAVED ((snd_pcm_access_t) SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) #define SND_PCM_ACCESS_RW_NONINTERLEAVED ((snd_pcm_access_t) SNDRV_PCM_ACCESS_RW_NONINTERLEAVED)
#define SND_PCM_ACCESS_LAST ((snd_pcm_access_t) SNDRV_PCM_ACCESS_LAST) #define SND_PCM_ACCESS_LAST ((snd_pcm_access_t) SNDRV_PCM_ACCESS_LAST)
#define SND_PCM_FORMAT_UNKNOWN ((snd_pcm_format_t) -1) #define SND_PCM_FORMAT_UNKNOWN ((snd_pcm_format_t) -1)
#define SND_PCM_FORMAT_S8 ((snd_pcm_format_t) SNDRV_PCM_FORMAT_S8) #define SND_PCM_FORMAT_S8 ((snd_pcm_format_t) SNDRV_PCM_FORMAT_S8)
#define SND_PCM_FORMAT_U8 ((snd_pcm_format_t) SNDRV_PCM_FORMAT_U8) #define SND_PCM_FORMAT_U8 ((snd_pcm_format_t) SNDRV_PCM_FORMAT_U8)
@ -98,8 +104,10 @@ typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
#define SND_PCM_FORMAT_FLOAT ((snd_pcm_format_t) SNDRV_PCM_FORMAT_FLOAT) #define SND_PCM_FORMAT_FLOAT ((snd_pcm_format_t) SNDRV_PCM_FORMAT_FLOAT)
#define SND_PCM_FORMAT_FLOAT64 ((snd_pcm_format_t) SNDRV_PCM_FORMAT_FLOAT64) #define SND_PCM_FORMAT_FLOAT64 ((snd_pcm_format_t) SNDRV_PCM_FORMAT_FLOAT64)
#define SND_PCM_FORMAT_IEC958_SUBFRAME ((snd_pcm_format_t) SNDRV_PCM_FORMAT_IEC958_SUBFRAME) #define SND_PCM_FORMAT_IEC958_SUBFRAME ((snd_pcm_format_t) SNDRV_PCM_FORMAT_IEC958_SUBFRAME)
#define SND_PCM_SUBFORMAT_STD ((snd_pcm_subformat_t) SNDRV_PCM_SUBFORMAT_STD) #define SND_PCM_SUBFORMAT_STD ((snd_pcm_subformat_t) SNDRV_PCM_SUBFORMAT_STD)
#define SND_PCM_SUBFORMAT_LAST ((snd_pcm_subformat_t) SNDRV_PCM_SUBFORMAT_LAST) #define SND_PCM_SUBFORMAT_LAST ((snd_pcm_subformat_t) SNDRV_PCM_SUBFORMAT_LAST)
#define SND_PCM_STATE_OPEN ((snd_pcm_state_t) SNDRV_PCM_STATE_OPEN) #define SND_PCM_STATE_OPEN ((snd_pcm_state_t) SNDRV_PCM_STATE_OPEN)
#define SND_PCM_STATE_SETUP ((snd_pcm_state_t) SNDRV_PCM_STATE_SETUP) #define SND_PCM_STATE_SETUP ((snd_pcm_state_t) SNDRV_PCM_STATE_SETUP)
#define SND_PCM_STATE_PREPARED ((snd_pcm_state_t) SNDRV_PCM_STATE_PREPARED) #define SND_PCM_STATE_PREPARED ((snd_pcm_state_t) SNDRV_PCM_STATE_PREPARED)
@ -108,12 +116,15 @@ typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
#define SND_PCM_STATE_DRAINING ((snd_pcm_state_t) SNDRV_PCM_STATE_DRAINING) #define SND_PCM_STATE_DRAINING ((snd_pcm_state_t) SNDRV_PCM_STATE_DRAINING)
#define SND_PCM_STATE_PAUSED ((snd_pcm_state_t) SNDRV_PCM_STATE_PAUSED) #define SND_PCM_STATE_PAUSED ((snd_pcm_state_t) SNDRV_PCM_STATE_PAUSED)
#define SND_PCM_STATE_LAST ((snd_pcm_state_t) SNDRV_PCM_STATE_LAST) #define SND_PCM_STATE_LAST ((snd_pcm_state_t) SNDRV_PCM_STATE_LAST)
#define SND_PCM_START_DATA ((snd_pcm_start_t) SNDRV_PCM_START_DATA) #define SND_PCM_START_DATA ((snd_pcm_start_t) SNDRV_PCM_START_DATA)
#define SND_PCM_START_EXPLICIT ((snd_pcm_start_t) SNDRV_PCM_START_EXPLICIT) #define SND_PCM_START_EXPLICIT ((snd_pcm_start_t) SNDRV_PCM_START_EXPLICIT)
#define SND_PCM_START_LAST ((snd_pcm_start_t) SNDRV_PCM_START_LAST) #define SND_PCM_START_LAST ((snd_pcm_start_t) SNDRV_PCM_START_LAST)
#define SND_PCM_XRUN_NONE ((snd_pcm_xrun_t) SNDRV_PCM_XRUN_NONE) #define SND_PCM_XRUN_NONE ((snd_pcm_xrun_t) SNDRV_PCM_XRUN_NONE)
#define SND_PCM_XRUN_STOP ((snd_pcm_xrun_t) SNDRV_PCM_XRUN_STOP) #define SND_PCM_XRUN_STOP ((snd_pcm_xrun_t) SNDRV_PCM_XRUN_STOP)
#define SND_PCM_XRUN_LAST ((snd_pcm_xrun_t) SNDRV_PCM_XRUN_LAST) #define SND_PCM_XRUN_LAST ((snd_pcm_xrun_t) SNDRV_PCM_XRUN_LAST)
#define SND_PCM_TSTAMP_NONE ((snd_pcm_tstamp_t) SNDRV_PCM_TSTAMP_NONE) #define SND_PCM_TSTAMP_NONE ((snd_pcm_tstamp_t) SNDRV_PCM_TSTAMP_NONE)
#define SND_PCM_TSTAMP_MMAP ((snd_pcm_tstamp_t) SNDRV_PCM_TSTAMP_MMAP) #define SND_PCM_TSTAMP_MMAP ((snd_pcm_tstamp_t) SNDRV_PCM_TSTAMP_MMAP)
#define SND_PCM_TSTAMP_LAST ((snd_pcm_tstamp_t) SNDRV_PCM_TSTAMP_LAST) #define SND_PCM_TSTAMP_LAST ((snd_pcm_tstamp_t) SNDRV_PCM_TSTAMP_LAST)
@ -200,7 +211,7 @@ typedef struct _snd_pcm_channel_area {
extern "C" { extern "C" {
#endif #endif
int snd_pcm_open(snd_pcm_t **pcm, char *name, int snd_pcm_open(snd_pcm_t **pcm, const char *name,
snd_pcm_stream_t stream, int mode); snd_pcm_stream_t stream, int mode);
snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm); snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);
@ -251,7 +262,6 @@ int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
unsigned int *rate_num, unsigned int *rate_num,
unsigned int *rate_den); unsigned int *rate_den);
int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params); int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_get_flags(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params); int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out); int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out);

View file

@ -3,8 +3,9 @@ extern "C" {
#endif #endif
size_t snd_pcm_access_mask_sizeof(); size_t snd_pcm_access_mask_sizeof();
#define snd_pcm_access_mask_alloca(ptr) ({assert(ptr); *ptr = (snd_pcm_access_mask_t *) alloca(snd_pcm_access_mask_sizeof()); 0;}) #define snd_pcm_access_mask_alloca(ptr) ({ assert(ptr); *ptr = (snd_pcm_access_mask_t *) alloca(snd_pcm_access_mask_sizeof()); memset(*ptr, 0, snd_pcm_access_mask_sizeof()); 0; })
int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr); int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr);
void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj); void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj);
void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src); void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src);
@ -16,7 +17,7 @@ void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val); void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
size_t snd_pcm_format_mask_sizeof(); size_t snd_pcm_format_mask_sizeof();
#define snd_pcm_format_mask_alloca(ptr) ({assert(ptr); *ptr = (snd_pcm_format_mask_t *) alloca(snd_pcm_format_mask_sizeof()); 0;}) #define snd_pcm_format_mask_alloca(ptr) ({ assert(ptr); *ptr = (snd_pcm_format_mask_t *) alloca(snd_pcm_format_mask_sizeof()); memset(*ptr, 0, snd_pcm_format_mask_sizeof()); 0; })
int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr); int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr);
void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj); void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj);
void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src); void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src);
@ -28,7 +29,7 @@ void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val); void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
size_t snd_pcm_subformat_mask_sizeof(); size_t snd_pcm_subformat_mask_sizeof();
#define snd_pcm_subformat_mask_alloca(ptr) ({assert(ptr); *ptr = (snd_pcm_subformat_mask_t *) alloca(snd_pcm_subformat_mask_sizeof()); 0;}) #define snd_pcm_subformat_mask_alloca(ptr) ({ assert(ptr); *ptr = (snd_pcm_subformat_mask_t *) alloca(snd_pcm_subformat_mask_sizeof()); memset(*ptr, 0, snd_pcm_subformat_mask_sizeof()); 0; })
int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr); int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr);
void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj); void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj);
void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src); void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src);
@ -40,36 +41,40 @@ void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subforma
void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val); void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
size_t snd_pcm_hw_params_sizeof(); size_t snd_pcm_hw_params_sizeof();
#define snd_pcm_hw_params_alloca(ptr) ({assert(ptr); *ptr = (snd_pcm_hw_params_t *) alloca(snd_pcm_hw_params_sizeof()); 0;}) #define snd_pcm_hw_params_alloca(ptr) ({ assert(ptr); *ptr = (snd_pcm_hw_params_t *) alloca(snd_pcm_hw_params_sizeof()); memset(*ptr, 0, snd_pcm_hw_params_sizeof()); 0; })
int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr); int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr);
void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj); void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj);
void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src); void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src);
snd_pcm_access_t snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params); snd_pcm_access_t snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_access_t val); int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_access_mask_t *mask); int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
snd_pcm_format_t snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params); snd_pcm_format_t snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_format_t val); int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_format_mask_t *mask); int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
snd_pcm_subformat_t snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params); snd_pcm_subformat_t snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_subformat_t val); int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_subformat_mask_t *mask); int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
unsigned int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params); unsigned int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params); unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params); unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val); int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val); int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val); int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, unsigned int *max); int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
@ -77,10 +82,11 @@ unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_para
unsigned int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir); int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
@ -88,10 +94,11 @@ unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t
unsigned int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir); int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
@ -99,34 +106,37 @@ unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_p
snd_pcm_uframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir); snd_pcm_uframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir);
snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir); snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir);
snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, int *dir); snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t val, int dir); int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val, int *dir); int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val, int *dir); int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir); int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir);
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int *dir); snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int *dir);
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode); int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir); int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode); int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir); int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
@ -134,10 +144,11 @@ unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_p
snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params); snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params);
snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params); snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params);
snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params); snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t val); int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val); int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val); int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max); int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max);
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
@ -145,16 +156,17 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm
unsigned int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir); int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir); int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
size_t snd_pcm_sw_params_sizeof(); size_t snd_pcm_sw_params_sizeof();
#define snd_pcm_sw_params_alloca(ptr) ({assert(ptr); *ptr = (snd_pcm_sw_params_t *) alloca(snd_pcm_sw_params_sizeof()); 0;}) #define snd_pcm_sw_params_alloca(ptr) ({ assert(ptr); *ptr = (snd_pcm_sw_params_t *) alloca(snd_pcm_sw_params_sizeof()); memset(*ptr, 0, snd_pcm_sw_params_sizeof()); 0; })
int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr); int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr);
void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj); void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj);
void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src); void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src);
@ -186,42 +198,8 @@ snd_pcm_uframes_t snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_param
int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params); snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params);
size_t snd_pcm_info_sizeof();
#define snd_pcm_info_alloca(ptr) ({assert(ptr); *ptr = (snd_pcm_info_t *) alloca(snd_pcm_info_sizeof()); 0;})
int snd_pcm_info_malloc(snd_pcm_info_t **ptr);
void snd_pcm_info_free(snd_pcm_info_t *obj);
void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);
unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj);
unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj);
snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj);
int snd_pcm_info_get_card(const snd_pcm_info_t *obj);
const char * snd_pcm_info_get_id(const snd_pcm_info_t *obj);
const char * snd_pcm_info_get_name(const snd_pcm_info_t *obj);
const char * snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj);
snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj);
snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj);
unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj);
unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj);
void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val);
void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val);
void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val);
size_t snd_pcm_status_sizeof(); size_t snd_pcm_status_sizeof();
#define snd_pcm_status_alloca(ptr) ({assert(ptr); *ptr = (snd_pcm_status_t *) alloca(snd_pcm_status_sizeof()); 0;}) #define snd_pcm_status_alloca(ptr) ({ assert(ptr); *ptr = (snd_pcm_status_t *) alloca(snd_pcm_status_sizeof()); memset(*ptr, 0, snd_pcm_status_sizeof()); 0; })
int snd_pcm_status_malloc(snd_pcm_status_t **ptr); int snd_pcm_status_malloc(snd_pcm_status_t **ptr);
void snd_pcm_status_free(snd_pcm_status_t *obj); void snd_pcm_status_free(snd_pcm_status_t *obj);
void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src); void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src);
@ -238,6 +216,40 @@ snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj);
snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj); snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj);
size_t snd_pcm_info_sizeof();
#define snd_pcm_info_alloca(ptr) ({ assert(ptr); *ptr = (snd_pcm_info_t *) alloca(snd_pcm_info_sizeof()); memset(*ptr, 0, snd_pcm_info_sizeof()); 0; })
int snd_pcm_info_malloc(snd_pcm_info_t **ptr);
void snd_pcm_info_free(snd_pcm_info_t *obj);
void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);
unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj);
unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj);
snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj);
int snd_pcm_info_get_card(const snd_pcm_info_t *obj);
const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj);
const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj);
const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj);
snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj);
snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj);
unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj);
unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj);
void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val);
void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val);
void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -17,6 +17,7 @@ typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t;
#define SND_RAWMIDI_STREAM_OUTPUT ((snd_rawmidi_stream_t) SNDRV_RAWMIDI_STREAM_OUTPUT) #define SND_RAWMIDI_STREAM_OUTPUT ((snd_rawmidi_stream_t) SNDRV_RAWMIDI_STREAM_OUTPUT)
#define SND_RAWMIDI_STREAM_INPUT ((snd_rawmidi_stream_t) SNDRV_RAWMIDI_STREAM_INPUT) #define SND_RAWMIDI_STREAM_INPUT ((snd_rawmidi_stream_t) SNDRV_RAWMIDI_STREAM_INPUT)
#define SND_RAWMIDI_STREAM_LAST ((snd_rawmidi_stream_t) SNDRV_RAWMIDI_STREAM_LAST)
#define SND_RAWMIDI_INFO_OUTPUT SNDRV_RAWMIDI_INFO_OUTPUT #define SND_RAWMIDI_INFO_OUTPUT SNDRV_RAWMIDI_INFO_OUTPUT
#define SND_RAWMIDI_INFO_INPUT SNDRV_RAWMIDI_INFO_INPUT #define SND_RAWMIDI_INFO_INPUT SNDRV_RAWMIDI_INFO_INPUT

View file

@ -3,7 +3,7 @@ extern "C" {
#endif #endif
size_t snd_rawmidi_params_sizeof(); size_t snd_rawmidi_params_sizeof();
#define snd_rawmidi_params_alloca(ptr) ({assert(ptr); *ptr = (snd_rawmidi_params_t *) alloca(snd_rawmidi_params_sizeof()); 0;}) #define snd_rawmidi_params_alloca(ptr) ({ assert(ptr); *ptr = (snd_rawmidi_params_t *) alloca(snd_rawmidi_params_sizeof()); memset(*ptr, 0, snd_rawmidi_params_sizeof()); 0; })
int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr); int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr);
void snd_rawmidi_params_free(snd_rawmidi_params_t *obj); void snd_rawmidi_params_free(snd_rawmidi_params_t *obj);
void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src); void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src);
@ -18,7 +18,7 @@ int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_p
int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params); int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
size_t snd_rawmidi_info_sizeof(); size_t snd_rawmidi_info_sizeof();
#define snd_rawmidi_info_alloca(ptr) ({assert(ptr); *ptr = (snd_rawmidi_info_t *) alloca(snd_rawmidi_info_sizeof()); 0;}) #define snd_rawmidi_info_alloca(ptr) ({ assert(ptr); *ptr = (snd_rawmidi_info_t *) alloca(snd_rawmidi_info_sizeof()); memset(*ptr, 0, snd_rawmidi_info_sizeof()); 0; })
int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr); int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr);
void snd_rawmidi_info_free(snd_rawmidi_info_t *obj); void snd_rawmidi_info_free(snd_rawmidi_info_t *obj);
void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src); void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src);
@ -33,11 +33,11 @@ int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj); unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj);
const char * snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj); const char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj);
const char * snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj); const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj);
const char * snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj); const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj);
unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj); unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj);
@ -50,7 +50,7 @@ void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val); void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
size_t snd_rawmidi_status_sizeof(); size_t snd_rawmidi_status_sizeof();
#define snd_rawmidi_status_alloca(ptr) ({assert(ptr); *ptr = (snd_rawmidi_status_t *) alloca(snd_rawmidi_status_sizeof()); 0;}) #define snd_rawmidi_status_alloca(ptr) ({ assert(ptr); *ptr = (snd_rawmidi_status_t *) alloca(snd_rawmidi_status_sizeof()); memset(*ptr, 0, snd_rawmidi_status_sizeof()); 0; })
int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr); int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr);
void snd_rawmidi_status_free(snd_rawmidi_status_t *obj); void snd_rawmidi_status_free(snd_rawmidi_status_t *obj);
void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src); void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src);

View file

@ -25,10 +25,13 @@ typedef enum sndrv_timer_slave_type snd_timer_slave_type_t;
#define SND_TIMER_TYPE_GLOBAL ((snd_timer_type_t) SNDRV_TIMER_TYPE_GLOBAL) #define SND_TIMER_TYPE_GLOBAL ((snd_timer_type_t) SNDRV_TIMER_TYPE_GLOBAL)
#define SND_TIMER_TYPE_CARD ((snd_timer_type_t) SNDRV_TIMER_TYPE_CARD) #define SND_TIMER_TYPE_CARD ((snd_timer_type_t) SNDRV_TIMER_TYPE_CARD)
#define SND_TIMER_TYPE_PCM ((snd_timer_type_t) SNDRV_TIMER_TYPE_PCM) #define SND_TIMER_TYPE_PCM ((snd_timer_type_t) SNDRV_TIMER_TYPE_PCM)
#define SND_TIMER_TYPE_LAST ((snd_timer_type_t) SNDRV_TIMER_TYPE_LAST)
#define SND_TIMER_STYPE_NONE ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_NONE #define SND_TIMER_STYPE_NONE ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_NONE
#define SND_TIMER_STYPE_APPLICATION ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_APPLICATION #define SND_TIMER_STYPE_APPLICATION ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_APPLICATION
#define SND_TIMER_STYPE_SEQUENCER ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_SEQUENCER #define SND_TIMER_STYPE_SEQUENCER ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_SEQUENCER
#define SND_TIMER_STYPE_OSS_SEQUENCER ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_OSS_SEQUENCER #define SND_TIMER_STYPE_OSS_SEQUENCER ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_OSS_SEQUENCER
#define SND_TIMER_STYPE_LAST ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_LAST
#define SND_TIMER_GLOBAL_SYSTEM SNDRV_TIMER_GLOBAL_SYSTEM #define SND_TIMER_GLOBAL_SYSTEM SNDRV_TIMER_GLOBAL_SYSTEM
#define SND_TIMER_GLOBAL_RTC SNDRV_TIMER_GLOBAL_RTC #define SND_TIMER_GLOBAL_RTC SNDRV_TIMER_GLOBAL_RTC

View file

@ -19,8 +19,6 @@
* *
*/ */
#include <assert.h>
#include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "local.h" #include "local.h"
@ -355,7 +353,7 @@ static int _snd_config_make_add(snd_config_t **config, char *id,
return 0; return 0;
} }
static int _snd_config_search(snd_config_t *config, char *id, int len, snd_config_t **result) static int _snd_config_search(snd_config_t *config, const char *id, int len, snd_config_t **result)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
snd_config_foreach(i, config) { snd_config_foreach(i, config) {
@ -679,7 +677,7 @@ int snd_config_delete(snd_config_t *config)
return 0; return 0;
} }
int snd_config_make(snd_config_t **config, char *id, int snd_config_make(snd_config_t **config, const char *id,
snd_config_type_t type) snd_config_type_t type)
{ {
char *id1; char *id1;
@ -693,22 +691,22 @@ int snd_config_make(snd_config_t **config, char *id,
return _snd_config_make(config, id1, type); return _snd_config_make(config, id1, type);
} }
int snd_config_integer_make(snd_config_t **config, char *id) int snd_config_integer_make(snd_config_t **config, const char *id)
{ {
return snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER); return snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER);
} }
int snd_config_real_make(snd_config_t **config, char *id) int snd_config_real_make(snd_config_t **config, const char *id)
{ {
return snd_config_make(config, id, SND_CONFIG_TYPE_REAL); return snd_config_make(config, id, SND_CONFIG_TYPE_REAL);
} }
int snd_config_string_make(snd_config_t **config, char *id) int snd_config_string_make(snd_config_t **config, const char *id)
{ {
return snd_config_make(config, id, SND_CONFIG_TYPE_STRING); return snd_config_make(config, id, SND_CONFIG_TYPE_STRING);
} }
int snd_config_compound_make(snd_config_t **config, char *id, int snd_config_compound_make(snd_config_t **config, const char *id,
int join) int join)
{ {
int err; int err;
@ -737,7 +735,7 @@ int snd_config_real_set(snd_config_t *config, double value)
return 0; return 0;
} }
int snd_config_string_set(snd_config_t *config, char *value) int snd_config_string_set(snd_config_t *config, const char *value)
{ {
assert(config); assert(config);
if (config->type != SND_CONFIG_TYPE_STRING) if (config->type != SND_CONFIG_TYPE_STRING)
@ -750,29 +748,6 @@ int snd_config_string_set(snd_config_t *config, char *value)
return 0; return 0;
} }
int snd_config_set(snd_config_t *config, ...)
{
va_list arg;
va_start(arg, config);
assert(config);
switch (snd_enum_to_int(config->type)) {
case SND_CONFIG_TYPE_INTEGER:
config->u.integer = va_arg(arg, long);
break;
case SND_CONFIG_TYPE_REAL:
config->u.real = va_arg(arg, double);
break;
case SND_CONFIG_TYPE_STRING:
config->u.string = va_arg(arg, char *);
break;
default:
assert(0);
return -EINVAL;
}
va_end(arg);
return 0;
}
int snd_config_integer_get(snd_config_t *config, long *ptr) int snd_config_integer_get(snd_config_t *config, long *ptr)
{ {
assert(config && ptr); assert(config && ptr);
@ -791,7 +766,7 @@ int snd_config_real_get(snd_config_t *config, double *ptr)
return 0; return 0;
} }
int snd_config_string_get(snd_config_t *config, char **ptr) int snd_config_string_get(snd_config_t *config, const char **ptr)
{ {
assert(config && ptr); assert(config && ptr);
if (config->type != SND_CONFIG_TYPE_STRING) if (config->type != SND_CONFIG_TYPE_STRING)
@ -800,26 +775,6 @@ int snd_config_string_get(snd_config_t *config, char **ptr)
return 0; return 0;
} }
int snd_config_get(snd_config_t *config, void *ptr)
{
assert(config && ptr);
switch (snd_enum_to_int(config->type)) {
case SND_CONFIG_TYPE_INTEGER:
* (long*) ptr = config->u.integer;
break;
case SND_CONFIG_TYPE_REAL:
* (double*) ptr = config->u.real;
break;
case SND_CONFIG_TYPE_STRING:
* (char **) ptr = config->u.string;
break;
default:
assert(0);
return -EINVAL;
}
return 0;
}
void string_print(char *str, int id, snd_output_t *out) void string_print(char *str, int id, snd_output_t *out)
{ {
unsigned char *p = str; unsigned char *p = str;
@ -980,13 +935,13 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
return _snd_config_save_leaves(config, out, 0, 0); return _snd_config_save_leaves(config, out, 0, 0);
} }
int snd_config_search(snd_config_t *config, char *key, snd_config_t **result) int snd_config_search(snd_config_t *config, const char *key, snd_config_t **result)
{ {
assert(config && key && result); assert(config && key && result);
while (1) { while (1) {
snd_config_t *n; snd_config_t *n;
int err; int err;
char *p = strchr(key, '.'); const char *p = strchr(key, '.');
if (config->type != SND_CONFIG_TYPE_COMPOUND) if (config->type != SND_CONFIG_TYPE_COMPOUND)
return -ENOENT; return -ENOENT;
if (p) { if (p) {
@ -1008,7 +963,7 @@ int snd_config_searchv(snd_config_t *config,
assert(config && result); assert(config && result);
va_start(arg, result); va_start(arg, result);
while (1) { while (1) {
char *k = va_arg(arg, char *); const char *k = va_arg(arg, const char *);
int err; int err;
if (!k) if (!k)
break; break;

View file

@ -1,7 +1,7 @@
EXTRA_LTLIBRARIES = libcontrol.la EXTRA_LTLIBRARIES = libcontrol.la
libcontrol_la_SOURCES = cards.c controls.c bag.c defaults.c \ libcontrol_la_SOURCES = cards.c controls.c bag.c defaults.c \
control.c control_hw.c control_shm.c control.c control_m4.c control_hw.c control_shm.c
all: libcontrol.la all: libcontrol.la

View file

@ -23,10 +23,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <assert.h>
#define __USE_GNU #define __USE_GNU
#include <search.h> #include <search.h>
#include "control_local.h" #include "control_local.h"

View file

@ -23,7 +23,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <ctype.h> #include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -73,7 +72,7 @@ int snd_card_get_index(const char *string)
{ {
int card; int card;
snd_ctl_t *handle; snd_ctl_t *handle;
snd_ctl_hw_info_t info; snd_ctl_info_t info;
if (!string || *string == '\0') if (!string || *string == '\0')
return -EINVAL; return -EINVAL;
@ -91,7 +90,7 @@ int snd_card_get_index(const char *string)
continue; continue;
if (snd_ctl_hw_open(&handle, NULL, card) < 0) if (snd_ctl_hw_open(&handle, NULL, card) < 0)
continue; continue;
if (snd_ctl_hw_info(handle, &info) < 0) { if (snd_ctl_info(handle, &info) < 0) {
snd_ctl_close(handle); snd_ctl_close(handle);
continue; continue;
} }
@ -105,14 +104,14 @@ int snd_card_get_index(const char *string)
int snd_card_get_name(int card, char **name) int snd_card_get_name(int card, char **name)
{ {
snd_ctl_t *handle; snd_ctl_t *handle;
snd_ctl_hw_info_t info; snd_ctl_info_t info;
int err; int err;
if (name == NULL) if (name == NULL)
return -EINVAL; return -EINVAL;
if ((err = snd_ctl_hw_open(&handle, NULL, card)) < 0) if ((err = snd_ctl_hw_open(&handle, NULL, card)) < 0)
return err; return err;
if ((err = snd_ctl_hw_info(handle, &info)) < 0) { if ((err = snd_ctl_info(handle, &info)) < 0) {
snd_ctl_close(handle); snd_ctl_close(handle);
return err; return err;
} }
@ -126,14 +125,14 @@ int snd_card_get_name(int card, char **name)
int snd_card_get_longname(int card, char **name) int snd_card_get_longname(int card, char **name)
{ {
snd_ctl_t *handle; snd_ctl_t *handle;
snd_ctl_hw_info_t info; snd_ctl_info_t info;
int err; int err;
if (name == NULL) if (name == NULL)
return -EINVAL; return -EINVAL;
if ((err = snd_ctl_hw_open(&handle, NULL, card)) < 0) if ((err = snd_ctl_hw_open(&handle, NULL, card)) < 0)
return err; return err;
if ((err = snd_ctl_hw_info(handle, &info)) < 0) { if ((err = snd_ctl_info(handle, &info)) < 0) {
snd_ctl_close(handle); snd_ctl_close(handle);
return err; return err;
} }

View file

@ -24,9 +24,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <assert.h>
#include <dlfcn.h> #include <dlfcn.h>
#include "control_local.h" #include "control_local.h"
@ -50,7 +48,7 @@ int snd_ctl_poll_descriptor(snd_ctl_t *ctl)
return ctl->ops->poll_descriptor(ctl); return ctl->ops->poll_descriptor(ctl);
} }
int snd_ctl_hw_info(snd_ctl_t *ctl, snd_ctl_hw_info_t *info) int snd_ctl_info(snd_ctl_t *ctl, snd_ctl_info_t *info)
{ {
assert(ctl && info); assert(ctl && info);
return ctl->ops->hw_info(ctl, info); return ctl->ops->hw_info(ctl, info);
@ -175,11 +173,11 @@ int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_callbacks_t * callbacks)
int snd_ctl_open(snd_ctl_t **ctlp, char *name) int snd_ctl_open(snd_ctl_t **ctlp, char *name)
{ {
char *str; const char *str;
int err; int err;
snd_config_t *ctl_conf, *conf, *type_conf; snd_config_t *ctl_conf, *conf, *type_conf;
snd_config_iterator_t i; snd_config_iterator_t i;
char *lib = NULL, *open = NULL; const char *lib = NULL, *open = NULL;
int (*open_func)(snd_ctl_t **ctlp, char *name, snd_config_t *conf); int (*open_func)(snd_ctl_t **ctlp, char *name, snd_config_t *conf);
void *h; void *h;
assert(ctlp && name); assert(ctlp && name);
@ -240,3 +238,75 @@ int snd_ctl_open(snd_ctl_t **ctlp, char *name)
return open_func(ctlp, name, ctl_conf); return open_func(ctlp, name, ctl_conf);
} }
void snd_control_set_bytes(snd_control_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 EVENT(v) [SND_CTL_EVENT_##v] = #v
const char *snd_control_type_names[] = {
TYPE(NONE),
TYPE(BOOLEAN),
TYPE(INTEGER),
TYPE(ENUMERATED),
TYPE(BYTES),
TYPE(IEC958),
};
const char *snd_control_iface_names[] = {
IFACE(CARD),
IFACE(HWDEP),
IFACE(MIXER),
IFACE(PCM),
IFACE(RAWMIDI),
IFACE(TIMER),
IFACE(SEQUENCER),
};
const char *snd_ctl_event_type_names[] = {
EVENT(REBUILD),
EVENT(VALUE),
EVENT(CHANGE),
EVENT(ADD),
EVENT(REMOVE),
};
const char *snd_control_type_name(snd_control_type_t type)
{
assert(type <= SND_CONTROL_TYPE_LAST);
return snd_control_type_names[snd_enum_to_int(type)];
}
const char *snd_control_iface_name(snd_control_iface_t iface)
{
assert(iface <= SND_CONTROL_IFACE_LAST);
return snd_control_iface_names[snd_enum_to_int(iface)];
}
const char *snd_ctl_event_type_name(snd_ctl_event_type_t type)
{
assert(type <= SND_CTL_EVENT_LAST);
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)
{
obj->pids = calloc(entries, sizeof(*obj->pids));
if (!obj->pids) {
obj->space = 0;
return -ENOMEM;
}
obj->space = entries;
return 0;
}
void snd_control_list_free_space(snd_control_list_t *obj)
{
free(obj->pids);
obj->pids = NULL;
}

View file

@ -24,10 +24,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <assert.h>
#include "control_local.h" #include "control_local.h"
#define SNDRV_FILE_CONTROL "/dev/snd/controlC%i" #define SNDRV_FILE_CONTROL "/dev/snd/controlC%i"
@ -53,10 +51,10 @@ static int snd_ctl_hw_poll_descriptor(snd_ctl_t *handle)
return hw->fd; return hw->fd;
} }
static int snd_ctl_hw_hw_info(snd_ctl_t *handle, snd_ctl_hw_info_t *info) static int snd_ctl_hw_hw_info(snd_ctl_t *handle, snd_ctl_info_t *info)
{ {
snd_ctl_hw_t *hw = handle->private; snd_ctl_hw_t *hw = handle->private;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_HW_INFO, info) < 0) if (ioctl(hw->fd, SNDRV_CTL_IOCTL_INFO, info) < 0)
return -errno; return -errno;
return 0; return 0;
} }
@ -182,7 +180,7 @@ snd_ctl_ops_t snd_ctl_hw_ops = {
read: snd_ctl_hw_read, read: snd_ctl_hw_read,
}; };
int snd_ctl_hw_open(snd_ctl_t **handle, char *name, int card) int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card)
{ {
int fd, ver; int fd, ver;
char filename[32]; char filename[32];
@ -234,7 +232,7 @@ int _snd_ctl_hw_open(snd_ctl_t **handlep, char *name, snd_config_t *conf)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
long card = -1; long card = -1;
char *str; const char *str;
int err; int err;
snd_config_foreach(i, conf) { snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i); snd_config_t *n = snd_config_entry(i);

View file

@ -19,14 +19,13 @@
* *
*/ */
#include <assert.h>
#include "local.h" #include "local.h"
#include "list.h" #include "list.h"
typedef struct { typedef struct _snd_ctl_ops {
int (*close)(snd_ctl_t *handle); int (*close)(snd_ctl_t *handle);
int (*poll_descriptor)(snd_ctl_t *handle); int (*poll_descriptor)(snd_ctl_t *handle);
int (*hw_info)(snd_ctl_t *handle, snd_ctl_hw_info_t *info); int (*hw_info)(snd_ctl_t *handle, snd_ctl_info_t *info);
int (*clist)(snd_ctl_t *handle, snd_control_list_t *list); int (*clist)(snd_ctl_t *handle, snd_control_list_t *list);
int (*cinfo)(snd_ctl_t *handle, snd_control_info_t *info); int (*cinfo)(snd_ctl_t *handle, snd_control_info_t *info);
int (*cread)(snd_ctl_t *handle, snd_control_t *control); int (*cread)(snd_ctl_t *handle, snd_control_t *control);
@ -53,12 +52,46 @@ struct _snd_ctl {
struct list_head hlist; /* list of all controls */ struct list_head hlist; /* list of all controls */
void *hroot; /* root of controls */ void *hroot; /* root of controls */
void *hroot_new; /* new croot */ void *hroot_new; /* new croot */
snd_ctl_hsort_t *hsort; snd_ctl_hsort_t hsort;
snd_ctl_hcallback_rebuild_t *callback_rebuild; snd_ctl_hcallback_rebuild_t callback_rebuild;
void *callback_rebuild_private_data; void *callback_rebuild_private_data;
snd_ctl_hcallback_add_t *callback_add; snd_ctl_hcallback_add_t callback_add;
void *callback_add_private_data; void *callback_add_private_data;
}; };
int snd_ctl_hw_open(snd_ctl_t **handle, char *name, int card); struct _snd_ctl_callbacks {
int snd_ctl_shm_open(snd_ctl_t **handlep, char *name, char *socket, char *sname); 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 *reserved[58]; /* reserved for the future use - must be NULL!!! */
};
struct _snd_hcontrol_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 */
};
struct _snd_hcontrol {
snd_control_id_t id; /* must be always on top */
struct list_head list; /* links for list of all hcontrols */
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;
/* private data */
void *private_data;
snd_hcontrol_private_free_t private_free;
/* links */
snd_ctl_t *handle; /* associated handle */
};
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card);
int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket, const char *sname);

937
src/control/control_m4.c Normal file
View file

@ -0,0 +1,937 @@
/*
* Control - Automatically generated functions
* Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "control_local.h"
size_t snd_control_id_sizeof()
{
return sizeof(snd_control_id_t);
}
int snd_control_id_malloc(snd_control_id_t **ptr)
{
assert(ptr);
*ptr = calloc(1, sizeof(snd_control_id_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_control_id_free(snd_control_id_t *obj)
{
free(obj);
}
void snd_control_id_copy(snd_control_id_t *dst, const snd_control_id_t *src)
{
assert(dst && src);
*dst = *src;
}
unsigned int snd_control_id_get_numid(const snd_control_id_t *obj)
{
assert(obj);
return obj->numid;
}
snd_control_iface_t snd_control_id_get_interface(const snd_control_id_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->iface);
}
unsigned int snd_control_id_get_device(const snd_control_id_t *obj)
{
assert(obj);
return obj->device;
}
unsigned int snd_control_id_get_subdevice(const snd_control_id_t *obj)
{
assert(obj);
return obj->subdevice;
}
const char *snd_control_id_get_name(const snd_control_id_t *obj)
{
assert(obj);
return obj->name;
}
unsigned int snd_control_id_get_index(const snd_control_id_t *obj)
{
assert(obj);
return obj->index;
}
void snd_control_id_set_numid(snd_control_id_t *obj, unsigned int val)
{
assert(obj);
obj->numid = val;
}
void snd_control_id_set_interface(snd_control_id_t *obj, snd_control_iface_t val)
{
assert(obj);
obj->iface = snd_enum_to_int(val);
}
void snd_control_id_set_device(snd_control_id_t *obj, unsigned int val)
{
assert(obj);
obj->device = val;
}
void snd_control_id_set_subdevice(snd_control_id_t *obj, unsigned int val)
{
assert(obj);
obj->subdevice = val;
}
void snd_control_id_set_name(snd_control_id_t *obj, const char *val)
{
assert(obj);
strncpy(obj->name, val, sizeof(obj->name));
}
void snd_control_id_set_index(snd_control_id_t *obj, unsigned int val)
{
assert(obj);
obj->index = val;
}
size_t snd_ctl_info_sizeof()
{
return sizeof(snd_ctl_info_t);
}
int snd_ctl_info_malloc(snd_ctl_info_t **ptr)
{
assert(ptr);
*ptr = calloc(1, sizeof(snd_ctl_info_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_ctl_info_free(snd_ctl_info_t *obj)
{
free(obj);
}
void snd_ctl_info_copy(snd_ctl_info_t *dst, const snd_ctl_info_t *src)
{
assert(dst && src);
*dst = *src;
}
int snd_ctl_info_get_card(const snd_ctl_info_t *obj)
{
assert(obj);
return obj->card;
}
snd_card_type_t snd_ctl_info_get_type(const snd_ctl_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->type);
}
const char *snd_ctl_info_get_id(const snd_ctl_info_t *obj)
{
assert(obj);
return obj->id;
}
const char *snd_ctl_info_get_abbreviation(const snd_ctl_info_t *obj)
{
assert(obj);
return obj->abbreviation;
}
const char *snd_ctl_info_get_name(const snd_ctl_info_t *obj)
{
assert(obj);
return obj->name;
}
const char *snd_ctl_info_get_longname(const snd_ctl_info_t *obj)
{
assert(obj);
return obj->longname;
}
const char *snd_ctl_info_get_mixerid(const snd_ctl_info_t *obj)
{
assert(obj);
return obj->mixerid;
}
const char *snd_ctl_info_get_mixername(const snd_ctl_info_t *obj)
{
assert(obj);
return obj->mixername;
}
size_t snd_ctl_event_sizeof()
{
return sizeof(snd_ctl_event_t);
}
int snd_ctl_event_malloc(snd_ctl_event_t **ptr)
{
assert(ptr);
*ptr = calloc(1, sizeof(snd_ctl_event_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_ctl_event_free(snd_ctl_event_t *obj)
{
free(obj);
}
void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src)
{
assert(dst && src);
*dst = *src;
}
snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->type);
}
unsigned int snd_ctl_event_get_numid(const snd_ctl_event_t *obj)
{
assert(obj);
assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
return obj->data.id.numid;
}
void snd_ctl_event_get_id(const snd_ctl_event_t *obj, snd_control_id_t *ptr)
{
assert(obj && ptr);
assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
*ptr = obj->data.id;
}
snd_control_iface_t snd_ctl_event_get_interface(const snd_ctl_event_t *obj)
{
assert(obj);
assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
return snd_int_to_enum(obj->data.id.iface);
}
unsigned int snd_ctl_event_get_device(const snd_ctl_event_t *obj)
{
assert(obj);
assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
return obj->data.id.device;
}
unsigned int snd_ctl_event_get_subdevice(const snd_ctl_event_t *obj)
{
assert(obj);
assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
return obj->data.id.subdevice;
}
const char *snd_ctl_event_get_name(const snd_ctl_event_t *obj)
{
assert(obj);
assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
return obj->data.id.name;
}
unsigned int snd_ctl_event_get_index(const snd_ctl_event_t *obj)
{
assert(obj);
assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
return obj->data.id.index;
}
size_t snd_control_list_sizeof()
{
return sizeof(snd_control_list_t);
}
int snd_control_list_malloc(snd_control_list_t **ptr)
{
assert(ptr);
*ptr = calloc(1, sizeof(snd_control_list_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_control_list_free(snd_control_list_t *obj)
{
free(obj);
}
void snd_control_list_copy(snd_control_list_t *dst, const snd_control_list_t *src)
{
assert(dst && src);
*dst = *src;
}
void snd_control_list_set_offset(snd_control_list_t *obj, unsigned int val)
{
assert(obj);
obj->offset = val;
}
unsigned int snd_control_list_get_used(const snd_control_list_t *obj)
{
assert(obj);
return obj->used;
}
unsigned int snd_control_list_get_count(const snd_control_list_t *obj)
{
assert(obj);
return obj->count;
}
void snd_control_list_get_id(const snd_control_list_t *obj, unsigned int idx, snd_control_id_t *ptr)
{
assert(obj && ptr);
assert(idx < obj->used);
*ptr = obj->pids[idx];
}
unsigned int snd_control_list_get_numid(const snd_control_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].numid;
}
snd_control_iface_t snd_control_list_get_interface(const snd_control_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return snd_int_to_enum(obj->pids[idx].iface);
}
unsigned int snd_control_list_get_device(const snd_control_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].device;
}
unsigned int snd_control_list_get_subdevice(const snd_control_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].subdevice;
}
const char *snd_control_list_get_name(const snd_control_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].name;
}
unsigned int snd_control_list_get_index(const snd_control_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].index;
}
size_t snd_control_info_sizeof()
{
return sizeof(snd_control_info_t);
}
int snd_control_info_malloc(snd_control_info_t **ptr)
{
assert(ptr);
*ptr = calloc(1, sizeof(snd_control_info_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_control_info_free(snd_control_info_t *obj)
{
free(obj);
}
void snd_control_info_copy(snd_control_info_t *dst, const snd_control_info_t *src)
{
assert(dst && src);
*dst = *src;
}
snd_control_type_t snd_control_info_get_type(const snd_control_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->type);
}
int snd_control_info_is_readable(const snd_control_info_t *obj)
{
assert(obj);
return !!(obj->access & SNDRV_CONTROL_ACCESS_READ);
}
int snd_control_info_is_writable(const snd_control_info_t *obj)
{
assert(obj);
return !!(obj->access & SNDRV_CONTROL_ACCESS_WRITE);
}
int snd_control_info_is_volatile(const snd_control_info_t *obj)
{
assert(obj);
return !!(obj->access & SNDRV_CONTROL_ACCESS_VOLATILE);
}
int snd_control_info_is_inactive(const snd_control_info_t *obj)
{
assert(obj);
return !!(obj->access & SNDRV_CONTROL_ACCESS_INACTIVE);
}
int snd_control_info_is_locked(const snd_control_info_t *obj)
{
assert(obj);
return !!(obj->access & SNDRV_CONTROL_ACCESS_LOCK);
}
int snd_control_info_is_indirect(const snd_control_info_t *obj)
{
assert(obj);
return !!(obj->access & SNDRV_CONTROL_ACCESS_INDIRECT);
}
unsigned int snd_control_info_get_count(const snd_control_info_t *obj)
{
assert(obj);
return obj->count;
}
long snd_control_info_get_min(const snd_control_info_t *obj)
{
assert(obj);
assert(obj->type == SNDRV_CONTROL_TYPE_INTEGER);
return obj->value.integer.min;
}
long snd_control_info_get_max(const snd_control_info_t *obj)
{
assert(obj);
assert(obj->type == SNDRV_CONTROL_TYPE_INTEGER);
return obj->value.integer.max;
}
long snd_control_info_get_step(const snd_control_info_t *obj)
{
assert(obj);
assert(obj->type == SNDRV_CONTROL_TYPE_INTEGER);
return obj->value.integer.step;
}
unsigned int snd_control_info_get_items(const snd_control_info_t *obj)
{
assert(obj);
assert(obj->type == SNDRV_CONTROL_TYPE_ENUMERATED);
return obj->value.enumerated.items;
}
void snd_control_info_set_item(snd_control_info_t *obj, unsigned int val)
{
assert(obj);
obj->value.enumerated.item = val;
}
const char *snd_control_info_get_item_name(const snd_control_info_t *obj)
{
assert(obj);
assert(obj->type == SNDRV_CONTROL_TYPE_ENUMERATED);
return obj->value.enumerated.name;
}
void snd_control_info_get_id(const snd_control_info_t *obj, snd_control_id_t *ptr)
{
assert(obj && ptr);
*ptr = obj->id;
}
unsigned int snd_control_info_get_numid(const snd_control_info_t *obj)
{
assert(obj);
return obj->id.numid;
}
snd_control_iface_t snd_control_info_get_interface(const snd_control_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->id.iface);
}
unsigned int snd_control_info_get_device(const snd_control_info_t *obj)
{
assert(obj);
return obj->id.device;
}
unsigned int snd_control_info_get_subdevice(const snd_control_info_t *obj)
{
assert(obj);
return obj->id.subdevice;
}
const char *snd_control_info_get_name(const snd_control_info_t *obj)
{
assert(obj);
return obj->id.name;
}
unsigned int snd_control_info_get_index(const snd_control_info_t *obj)
{
assert(obj);
return obj->id.index;
}
void snd_control_info_set_id(snd_control_info_t *obj, const snd_control_id_t *ptr)
{
assert(obj && ptr);
obj->id = *ptr;
}
void snd_control_info_set_numid(snd_control_info_t *obj, unsigned int val)
{
assert(obj);
obj->id.numid = val;
}
void snd_control_info_set_interface(snd_control_info_t *obj, snd_control_iface_t val)
{
assert(obj);
obj->id.iface = snd_enum_to_int(val);
}
void snd_control_info_set_device(snd_control_info_t *obj, unsigned int val)
{
assert(obj);
obj->id.device = val;
}
void snd_control_info_set_subdevice(snd_control_info_t *obj, unsigned int val)
{
assert(obj);
obj->id.subdevice = val;
}
void snd_control_info_set_name(snd_control_info_t *obj, const char *val)
{
assert(obj);
strncpy(obj->id.name, val, sizeof(obj->id.name));
}
void snd_control_info_set_index(snd_control_info_t *obj, unsigned int val)
{
assert(obj);
obj->id.index = val;
}
size_t snd_control_sizeof()
{
return sizeof(snd_control_t);
}
int snd_control_malloc(snd_control_t **ptr)
{
assert(ptr);
*ptr = calloc(1, sizeof(snd_control_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_control_free(snd_control_t *obj)
{
free(obj);
}
void snd_control_copy(snd_control_t *dst, const snd_control_t *src)
{
assert(dst && src);
*dst = *src;
}
void snd_control_get_id(const snd_control_t *obj, snd_control_id_t *ptr)
{
assert(obj && ptr);
*ptr = obj->id;
}
unsigned int snd_control_get_numid(const snd_control_t *obj)
{
assert(obj);
return obj->id.numid;
}
snd_control_iface_t snd_control_get_interface(const snd_control_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->id.iface);
}
unsigned int snd_control_get_device(const snd_control_t *obj)
{
assert(obj);
return obj->id.device;
}
unsigned int snd_control_get_subdevice(const snd_control_t *obj)
{
assert(obj);
return obj->id.subdevice;
}
const char *snd_control_get_name(const snd_control_t *obj)
{
assert(obj);
return obj->id.name;
}
unsigned int snd_control_get_index(const snd_control_t *obj)
{
assert(obj);
return obj->id.index;
}
void snd_control_set_id(snd_control_t *obj, const snd_control_id_t *ptr)
{
assert(obj && ptr);
obj->id = *ptr;
}
void snd_control_set_numid(snd_control_t *obj, unsigned int val)
{
assert(obj);
obj->id.numid = val;
}
void snd_control_set_interface(snd_control_t *obj, snd_control_iface_t val)
{
assert(obj);
obj->id.iface = snd_enum_to_int(val);
}
void snd_control_set_device(snd_control_t *obj, unsigned int val)
{
assert(obj);
obj->id.device = val;
}
void snd_control_set_subdevice(snd_control_t *obj, unsigned int val)
{
assert(obj);
obj->id.subdevice = val;
}
void snd_control_set_name(snd_control_t *obj, const char *val)
{
assert(obj);
strncpy(obj->id.name, val, sizeof(obj->id.name));
}
void snd_control_set_index(snd_control_t *obj, unsigned int val)
{
assert(obj);
obj->id.index = val;
}
long snd_control_get_boolean(const snd_control_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < sizeof(obj->value.integer.value) / sizeof(obj->value.integer.value[0]));
return obj->value.integer.value[idx];
}
long snd_control_get_integer(const snd_control_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < sizeof(obj->value.integer.value) / sizeof(obj->value.integer.value[0]));
return obj->value.integer.value[idx];
}
unsigned int snd_control_get_enumerated(const snd_control_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < sizeof(obj->value.enumerated.item) / sizeof(obj->value.enumerated.item[0]));
return obj->value.enumerated.item[idx];
}
unsigned char snd_control_get_byte(const snd_control_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < sizeof(obj->value.bytes.data));
return obj->value.bytes.data[idx];
}
void snd_control_set_boolean(snd_control_t *obj, unsigned int idx, long val)
{
assert(obj);
obj->value.integer.value[idx] = val;
}
void snd_control_set_integer(snd_control_t *obj, unsigned int idx, long val)
{
assert(obj);
obj->value.integer.value[idx] = val;
}
void snd_control_set_enumerated(snd_control_t *obj, unsigned int idx, unsigned int val)
{
assert(obj);
obj->value.enumerated.item[idx] = val;
}
void snd_control_set_byte(snd_control_t *obj, unsigned int idx, unsigned char val)
{
assert(obj);
obj->value.bytes.data[idx] = val;
}
const void * snd_control_get_bytes(const snd_control_t *obj)
{
assert(obj);
return obj->value.bytes.data;
}
void snd_control_get_iec958(const snd_control_t *obj, snd_aes_iec958_t *ptr)
{
assert(obj && ptr);
*ptr = obj->value.iec958;
}
void snd_control_set_iec958(snd_control_t *obj, const snd_aes_iec958_t *ptr)
{
assert(obj && ptr);
obj->value.iec958 = *ptr;
}
size_t snd_hcontrol_list_sizeof()
{
return sizeof(snd_hcontrol_list_t);
}
int snd_hcontrol_list_malloc(snd_hcontrol_list_t **ptr)
{
assert(ptr);
*ptr = calloc(1, sizeof(snd_hcontrol_list_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_hcontrol_list_free(snd_hcontrol_list_t *obj)
{
free(obj);
}
void snd_hcontrol_list_copy(snd_hcontrol_list_t *dst, const snd_hcontrol_list_t *src)
{
assert(dst && src);
*dst = *src;
}
void snd_hcontrol_list_set_offset(snd_hcontrol_list_t *obj, unsigned int val)
{
assert(obj);
obj->offset = val;
}
unsigned int snd_hcontrol_list_get_used(const snd_hcontrol_list_t *obj)
{
assert(obj);
return obj->used;
}
unsigned int snd_hcontrol_list_get_count(const snd_hcontrol_list_t *obj)
{
assert(obj);
return obj->count;
}
void snd_hcontrol_list_get_id(const snd_hcontrol_list_t *obj, unsigned int idx, snd_control_id_t *ptr)
{
assert(obj && ptr);
assert(idx < obj->used);
*ptr = obj->pids[idx];
}
unsigned int snd_hcontrol_list_get_numid(const snd_hcontrol_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].numid;
}
snd_control_iface_t snd_hcontrol_list_get_interface(const snd_hcontrol_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return snd_int_to_enum(obj->pids[idx].iface);
}
unsigned int snd_hcontrol_list_get_device(const snd_hcontrol_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].device;
}
unsigned int snd_hcontrol_list_get_subdevice(const snd_hcontrol_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].subdevice;
}
const char *snd_hcontrol_list_get_name(const snd_hcontrol_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].name;
}
unsigned int snd_hcontrol_list_get_index(const snd_hcontrol_list_t *obj, unsigned int idx)
{
assert(obj);
assert(idx < obj->used);
return obj->pids[idx].index;
}
size_t snd_hcontrol_sizeof()
{
return sizeof(snd_hcontrol_t);
}
int snd_hcontrol_malloc(snd_hcontrol_t **ptr)
{
assert(ptr);
*ptr = calloc(1, sizeof(snd_hcontrol_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_hcontrol_free(snd_hcontrol_t *obj)
{
free(obj);
}
void snd_hcontrol_copy(snd_hcontrol_t *dst, const snd_hcontrol_t *src)
{
assert(dst && src);
*dst = *src;
}
void snd_hcontrol_get_id(const snd_hcontrol_t *obj, snd_control_id_t *ptr)
{
assert(obj && ptr);
*ptr = obj->id;
}
unsigned int snd_hcontrol_get_numid(const snd_hcontrol_t *obj)
{
assert(obj);
return obj->id.numid;
}
snd_control_iface_t snd_hcontrol_get_interface(const snd_hcontrol_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->id.iface);
}
unsigned int snd_hcontrol_get_device(const snd_hcontrol_t *obj)
{
assert(obj);
return obj->id.device;
}
unsigned int snd_hcontrol_get_subdevice(const snd_hcontrol_t *obj)
{
assert(obj);
return obj->id.subdevice;
}
const char *snd_hcontrol_get_name(const snd_hcontrol_t *obj)
{
assert(obj);
return obj->id.name;
}
unsigned int snd_hcontrol_get_index(const snd_hcontrol_t *obj)
{
assert(obj);
return obj->id.index;
}
void snd_hcontrol_set_callback_change(snd_hcontrol_t *obj, snd_hcontrol_callback_t val)
{
assert(obj);
obj->callback_change = val;
}
void snd_hcontrol_set_callback_value(snd_hcontrol_t *obj, snd_hcontrol_callback_t val)
{
assert(obj);
obj->callback_value = val;
}
void snd_hcontrol_set_callback_remove(snd_hcontrol_t *obj, snd_hcontrol_callback_t val)
{
assert(obj);
obj->callback_remove = val;
}
void * snd_hcontrol_get_private_data(const snd_hcontrol_t *obj)
{
assert(obj);
return obj->private_data;
}
void snd_hcontrol_set_private_data(snd_hcontrol_t *obj, void * val)
{
assert(obj);
obj->private_data = val;
}
void snd_hcontrol_set_private_free(snd_hcontrol_t *obj, snd_hcontrol_private_free_t val)
{
assert(obj);
obj->private_free = val;
}

View file

@ -24,7 +24,6 @@
#include <stddef.h> #include <stddef.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/shm.h> #include <sys/shm.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -107,13 +106,13 @@ static int snd_ctl_shm_poll_descriptor(snd_ctl_t *ctl)
return fd; return fd;
} }
static int snd_ctl_shm_hw_info(snd_ctl_t *ctl, snd_ctl_hw_info_t *info) static int snd_ctl_shm_hw_info(snd_ctl_t *ctl, snd_ctl_info_t *info)
{ {
snd_ctl_shm_t *shm = ctl->private; snd_ctl_shm_t *shm = ctl->private;
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl; volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
int err; int err;
// ctrl->u.hw_info = *info; // ctrl->u.hw_info = *info;
ctrl->cmd = SNDRV_CTL_IOCTL_HW_INFO; ctrl->cmd = SNDRV_CTL_IOCTL_INFO;
err = snd_ctl_shm_action(ctl); err = snd_ctl_shm_action(ctl);
if (err < 0) if (err < 0)
return err; return err;
@ -126,7 +125,7 @@ static int snd_ctl_shm_clist(snd_ctl_t *ctl, snd_control_list_t *list)
snd_ctl_shm_t *shm = ctl->private; snd_ctl_shm_t *shm = ctl->private;
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl; volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
size_t maxsize = CTL_SHM_DATA_MAXLEN; size_t maxsize = CTL_SHM_DATA_MAXLEN;
size_t bytes = list->controls_request * sizeof(*list->pids); size_t bytes = list->space * sizeof(*list->pids);
int err; int err;
snd_control_id_t *pids = list->pids; snd_control_id_t *pids = list->pids;
if (bytes > maxsize) if (bytes > maxsize)
@ -138,6 +137,7 @@ static int snd_ctl_shm_clist(snd_ctl_t *ctl, snd_control_list_t *list)
return err; return err;
*list = ctrl->u.clist; *list = ctrl->u.clist;
list->pids = pids; list->pids = pids;
bytes = list->used * sizeof(*list->pids);
memcpy(pids, (void *)ctrl->data, bytes); memcpy(pids, (void *)ctrl->data, bytes);
return err; return err;
} }
@ -369,7 +369,7 @@ static int make_inet_socket(const char *host, int port)
} }
#endif #endif
int snd_ctl_shm_open(snd_ctl_t **handlep, char *name, char *socket, char *sname) int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket, const char *sname)
{ {
snd_ctl_t *ctl; snd_ctl_t *ctl;
snd_ctl_shm_t *shm = NULL; snd_ctl_shm_t *shm = NULL;
@ -469,11 +469,11 @@ extern int is_local(struct hostent *hent);
int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf) int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *server = NULL; const char *server = NULL;
char *sname = NULL; const char *sname = NULL;
snd_config_t *sconfig; snd_config_t *sconfig;
char *host = NULL; const char *host = NULL;
char *socket = NULL; const char *socket = NULL;
long port = -1; long port = -1;
int err; int err;
int local; int local;

View file

@ -23,17 +23,15 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <assert.h>
#define __USE_GNU #define __USE_GNU
#include <search.h> #include <search.h>
#include "control_local.h" #include "control_local.h"
static void snd_ctl_hfree1(snd_hcontrol_t *hcontrol); static void snd_ctl_hfree1(snd_hcontrol_t *hcontrol);
int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t *hsort) int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t hsort)
{ {
snd_control_list_t list; snd_control_list_t list;
snd_hcontrol_t *hcontrol, *prev; snd_hcontrol_t *hcontrol, *prev;
@ -49,21 +47,20 @@ int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t *hsort)
do { do {
if (list.pids != NULL) if (list.pids != NULL)
free(list.pids); free(list.pids);
list.controls_offset = 0; list.offset = 0;
list.controls_request = 0; list.space = 0;
list.controls_count = 0;
if ((err = snd_ctl_clist(handle, &list)) < 0) if ((err = snd_ctl_clist(handle, &list)) < 0)
return err; return err;
if (list.controls == 0) if (list.count == 0)
break; break;
list.pids = (snd_control_id_t *)calloc(list.controls, sizeof(snd_control_id_t)); list.pids = (snd_control_id_t *)calloc(list.count, sizeof(snd_control_id_t));
if (list.pids == NULL) if (list.pids == NULL)
return -ENOMEM; return -ENOMEM;
list.controls_request = list.controls; list.space = list.count;
if ((err = snd_ctl_clist(handle, &list)) < 0) if ((err = snd_ctl_clist(handle, &list)) < 0)
return err; return err;
} while (list.controls != list.controls_count); } while (list.count != list.used);
for (idx = 0, prev = NULL; idx < list.controls_count; idx++) { for (idx = 0, prev = NULL; idx < list.count; idx++) {
hcontrol = (snd_hcontrol_t *)calloc(1, sizeof(snd_hcontrol_t)); hcontrol = (snd_hcontrol_t *)calloc(1, sizeof(snd_hcontrol_t));
if (hcontrol == NULL) if (hcontrol == NULL)
goto __nomem; goto __nomem;
@ -101,10 +98,10 @@ static void snd_ctl_hfree1(snd_hcontrol_t *hcontrol)
handle = hcontrol->handle; handle = hcontrol->handle;
assert(handle != NULL); assert(handle != NULL);
assert(handle->hcount > 0); assert(handle->hcount > 0);
if (hcontrol->event_remove) if (hcontrol->callback_remove)
hcontrol->event_remove(handle, hcontrol); hcontrol->callback_remove(handle, hcontrol);
if (hcontrol->private_free) if (hcontrol->private_free)
hcontrol->private_free(hcontrol->private_data); hcontrol->private_free(hcontrol);
list_del(&hcontrol->list); list_del(&hcontrol->list);
free(hcontrol); free(hcontrol);
handle->hcount--; handle->hcount--;
@ -236,7 +233,7 @@ static void snd_ctl_hresort_free(snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED)
/* nothing */ /* nothing */
} }
int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t *hsort) int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t hsort)
{ {
struct list_head *list; struct list_head *list;
snd_hcontrol_t *hcontrol; snd_hcontrol_t *hcontrol;
@ -336,21 +333,21 @@ int snd_ctl_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist)
unsigned int idx; unsigned int idx;
assert(hlist != NULL); assert(hlist != NULL);
if (hlist->controls_offset >= (unsigned int)handle->hcount) if (hlist->offset >= (unsigned int)handle->hcount)
return -EINVAL; return -EINVAL;
hlist->controls_count = 0; hlist->used = 0;
hlist->controls = handle->hcount; hlist->count = handle->hcount;
if (hlist->controls_request > 0) { if (hlist->space > 0) {
if (hlist->pids == NULL) if (hlist->pids == NULL)
return -EINVAL; return -EINVAL;
idx = 0; idx = 0;
list_for_each(list, &handle->hlist) { list_for_each(list, &handle->hlist) {
hcontrol = list_entry(list, snd_hcontrol_t, list); hcontrol = list_entry(list, snd_hcontrol_t, list);
if (idx >= hlist->controls_offset + hlist->controls_request) if (idx >= hlist->offset + hlist->space)
break; break;
if (idx >= hlist->controls_offset) { if (idx >= hlist->offset) {
hlist->pids[idx] = hcontrol->id; hlist->pids[idx] = hcontrol->id;
hlist->controls_count++; hlist->used++;
} }
idx++; idx++;
} }
@ -358,7 +355,7 @@ int snd_ctl_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist)
return 0; return 0;
} }
int snd_ctl_hcallback_rebuild(snd_ctl_t *handle, snd_ctl_hcallback_rebuild_t *callback, void *private_data) int snd_ctl_hcallback_rebuild(snd_ctl_t *handle, snd_ctl_hcallback_rebuild_t callback, void *private_data)
{ {
assert(handle != NULL); assert(handle != NULL);
handle->callback_rebuild = callback; handle->callback_rebuild = callback;
@ -366,7 +363,7 @@ int snd_ctl_hcallback_rebuild(snd_ctl_t *handle, snd_ctl_hcallback_rebuild_t *ca
return 0; return 0;
} }
int snd_ctl_hcallback_add(snd_ctl_t *handle, snd_ctl_hcallback_add_t *callback, void *private_data) int snd_ctl_hcallback_add(snd_ctl_t *handle, snd_ctl_hcallback_add_t callback, void *private_data)
{ {
assert(handle != NULL); assert(handle != NULL);
handle->callback_add = callback; handle->callback_add = callback;
@ -476,14 +473,31 @@ int snd_ctl_hevent(snd_ctl_t *handle)
return handle->herr; return handle->herr;
list_for_each(list, &handle->hlist) { list_for_each(list, &handle->hlist) {
hcontrol = list_entry(list, snd_hcontrol_t, list); hcontrol = list_entry(list, snd_hcontrol_t, list);
if (hcontrol->change && hcontrol->event_change) { if (hcontrol->change && hcontrol->callback_change) {
hcontrol->event_change(hcontrol->handle, hcontrol); hcontrol->callback_change(hcontrol->handle, hcontrol);
hcontrol->change = 0; hcontrol->change = 0;
} }
if (hcontrol->value && hcontrol->event_value) { if (hcontrol->value && hcontrol->callback_value) {
hcontrol->event_value(hcontrol->handle, hcontrol); hcontrol->callback_value(hcontrol->handle, hcontrol);
hcontrol->value = 0; hcontrol->value = 0;
} }
} }
return res; return res;
} }
int snd_hcontrol_list_alloc_space(snd_hcontrol_list_t *obj, unsigned int entries)
{
obj->pids = calloc(entries, sizeof(*obj->pids));
if (!obj->pids) {
obj->space = 0;
return -ENOMEM;
}
obj->space = entries;
return 0;
}
void snd_hcontrol_list_free_space(snd_hcontrol_list_t *obj)
{
free(obj->pids);
obj->pids = NULL;
}

View file

@ -21,7 +21,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include "local.h" #include "local.h"
static int defaults_card(const char *env) static int defaults_card(const char *env)

View file

@ -23,7 +23,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "local.h" #include "local.h"

View file

@ -19,8 +19,6 @@
* *
*/ */
#include <errno.h>
#include <assert.h>
#include "local.h" #include "local.h"
size_t snd_hwdep_info_sizeof() size_t snd_hwdep_info_sizeof()
@ -31,7 +29,7 @@ size_t snd_hwdep_info_sizeof()
int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr) int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_hwdep_info_t)); *ptr = calloc(1, sizeof(snd_hwdep_info_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -60,13 +58,13 @@ int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj)
return obj->card; return obj->card;
} }
const char * snd_hwdep_info_get_id(const snd_hwdep_info_t *obj) const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj)
{ {
assert(obj); assert(obj);
return obj->id; return obj->id;
} }
const char * snd_hwdep_info_get_name(const snd_hwdep_info_t *obj) const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj)
{ {
assert(obj); assert(obj);
return obj->name; return obj->name;

View file

@ -19,12 +19,10 @@
* *
*/ */
#include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include "local.h" #include "local.h"
typedef struct _snd_input_ops { typedef struct _snd_input_ops {

View file

@ -21,7 +21,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"

View file

@ -22,7 +22,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"

View file

@ -22,7 +22,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"

View file

@ -23,7 +23,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "mixer_local.h" #include "mixer_local.h"

View file

@ -19,7 +19,6 @@
* *
*/ */
#include <assert.h>
#include "local.h" #include "local.h"
#include "list.h" #include "list.h"

View file

@ -23,9 +23,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "../control/control_local.h"
#include "mixer_local.h" #include "mixer_local.h"
static struct mixer_name_table { static struct mixer_name_table {
@ -121,9 +121,9 @@ static void hcontrol_event_remove(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hc
static void hcontrol_add(snd_mixer_t *handle, void **bag, snd_hcontrol_t *hcontrol) static void hcontrol_add(snd_mixer_t *handle, void **bag, snd_hcontrol_t *hcontrol)
{ {
snd_ctl_hbag_add(bag, hcontrol); snd_ctl_hbag_add(bag, hcontrol);
hcontrol->event_change = hcontrol_event_change; hcontrol->callback_change = hcontrol_event_change;
hcontrol->event_value = hcontrol_event_value; hcontrol->callback_value = hcontrol_event_value;
hcontrol->event_remove = hcontrol_event_remove; hcontrol->callback_remove = hcontrol_event_remove;
hcontrol->private_data = handle; hcontrol->private_data = handle;
} }
@ -489,8 +489,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
return err; return err;
if (global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN || if (global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN ||
global_info.type == SNDRV_CONTROL_TYPE_INTEGER) { global_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
if (voices < global_info.values_count) if (voices < global_info.count)
voices = global_info.values_count; voices = global_info.count;
caps |= global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN ? SND_MIXER_SCTCAP_MUTE : SND_MIXER_SCTCAP_VOLUME; 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; present |= global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN ? MIXER_PRESENT_SINGLE_SWITCH : MIXER_PRESENT_SINGLE_VOLUME;
if (global_info.type == SNDRV_CONTROL_TYPE_INTEGER) { if (global_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
@ -507,8 +507,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((err = get_mixer_info(handle, str, index, &gswitch_info)) < 0) if ((err = get_mixer_info(handle, str, index, &gswitch_info)) < 0)
return err; return err;
if (gswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) { if (gswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) {
if (voices < gswitch_info.values_count) if (voices < gswitch_info.count)
voices = gswitch_info.values_count; voices = gswitch_info.count;
caps |= SND_MIXER_SCTCAP_MUTE; caps |= SND_MIXER_SCTCAP_MUTE;
present |= MIXER_PRESENT_GLOBAL_SWITCH; present |= MIXER_PRESENT_GLOBAL_SWITCH;
hcontrol_add(handle, &bag, hcontrol); hcontrol_add(handle, &bag, hcontrol);
@ -518,7 +518,7 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) { if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &groute_info)) < 0) if ((err = get_mixer_info(handle, str, index, &groute_info)) < 0)
return err; return err;
if (groute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && groute_info.values_count == 4) { if (groute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && groute_info.count == 4) {
if (voices < 2) if (voices < 2)
voices = 2; voices = 2;
caps |= SND_MIXER_SCTCAP_MUTE; caps |= SND_MIXER_SCTCAP_MUTE;
@ -531,8 +531,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((err = get_mixer_info(handle, str, index, &gvolume_info)) < 0) if ((err = get_mixer_info(handle, str, index, &gvolume_info)) < 0)
return err; return err;
if (gvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) { if (gvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
if (voices < gvolume_info.values_count) if (voices < gvolume_info.count)
voices = gvolume_info.values_count; voices = gvolume_info.count;
if (min > gvolume_info.value.integer.min) if (min > gvolume_info.value.integer.min)
min = gvolume_info.value.integer.min; min = gvolume_info.value.integer.min;
if (max < gvolume_info.value.integer.max) if (max < gvolume_info.value.integer.max)
@ -547,8 +547,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((err = get_mixer_info(handle, str, index, &pswitch_info)) < 0) if ((err = get_mixer_info(handle, str, index, &pswitch_info)) < 0)
return err; return err;
if (pswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) { if (pswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) {
if (voices < pswitch_info.values_count) if (voices < pswitch_info.count)
voices = pswitch_info.values_count; voices = pswitch_info.count;
caps |= SND_MIXER_SCTCAP_MUTE; caps |= SND_MIXER_SCTCAP_MUTE;
present |= MIXER_PRESENT_PLAYBACK_SWITCH; present |= MIXER_PRESENT_PLAYBACK_SWITCH;
hcontrol_add(handle, &bag, hcontrol); hcontrol_add(handle, &bag, hcontrol);
@ -558,7 +558,7 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) { if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &proute_info)) < 0) if ((err = get_mixer_info(handle, str, index, &proute_info)) < 0)
return err; return err;
if (proute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && proute_info.values_count == 4) { if (proute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && proute_info.count == 4) {
if (voices < 2) if (voices < 2)
voices = 2; voices = 2;
caps |= SND_MIXER_SCTCAP_MUTE; caps |= SND_MIXER_SCTCAP_MUTE;
@ -571,8 +571,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((err = get_mixer_info(handle, str, index, &cswitch_info)) < 0) if ((err = get_mixer_info(handle, str, index, &cswitch_info)) < 0)
return err; return err;
if (cswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) { if (cswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) {
if (voices < cswitch_info.values_count) if (voices < cswitch_info.count)
voices = cswitch_info.values_count; voices = cswitch_info.count;
caps |= SND_MIXER_SCTCAP_CAPTURE; caps |= SND_MIXER_SCTCAP_CAPTURE;
present |= MIXER_PRESENT_CAPTURE_SWITCH; present |= MIXER_PRESENT_CAPTURE_SWITCH;
hcontrol_add(handle, &bag, hcontrol); hcontrol_add(handle, &bag, hcontrol);
@ -582,7 +582,7 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) { if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &croute_info)) < 0) if ((err = get_mixer_info(handle, str, index, &croute_info)) < 0)
return err; return err;
if (croute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && croute_info.values_count == 4) { if (croute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && croute_info.count == 4) {
if (voices < 2) if (voices < 2)
voices = 2; voices = 2;
caps |= SND_MIXER_SCTCAP_CAPTURE; caps |= SND_MIXER_SCTCAP_CAPTURE;
@ -595,8 +595,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((err = get_mixer_info(handle, str, index, &pvolume_info)) < 0) if ((err = get_mixer_info(handle, str, index, &pvolume_info)) < 0)
return err; return err;
if (pvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) { if (pvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
if (voices < pvolume_info.values_count) if (voices < pvolume_info.count)
voices = pvolume_info.values_count; voices = pvolume_info.count;
if (min > pvolume_info.value.integer.min) if (min > pvolume_info.value.integer.min)
min = pvolume_info.value.integer.min; min = pvolume_info.value.integer.min;
if (max < pvolume_info.value.integer.max) if (max < pvolume_info.value.integer.max)
@ -611,8 +611,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((err = get_mixer_info(handle, str, index, &cvolume_info)) < 0) if ((err = get_mixer_info(handle, str, index, &cvolume_info)) < 0)
return err; return err;
if (cvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) { if (cvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
if (voices < cvolume_info.values_count) if (voices < cvolume_info.count)
voices = cvolume_info.values_count; voices = cvolume_info.count;
if (min > pvolume_info.value.integer.min) if (min > pvolume_info.value.integer.min)
min = pvolume_info.value.integer.min; min = pvolume_info.value.integer.min;
if (max < pvolume_info.value.integer.max) if (max < pvolume_info.value.integer.max)
@ -633,8 +633,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if (csource_info.type == SNDRV_CONTROL_TYPE_ENUMERATED) { if (csource_info.type == SNDRV_CONTROL_TYPE_ENUMERATED) {
capture_item = 0; capture_item = 0;
if (!strcmp(csource_info.value.enumerated.name, str)) { if (!strcmp(csource_info.value.enumerated.name, str)) {
if (voices < csource_info.values_count) if (voices < csource_info.count)
voices = csource_info.values_count; voices = csource_info.count;
caps |= SND_MIXER_SCTCAP_CAPTURE; caps |= SND_MIXER_SCTCAP_CAPTURE;
present |= MIXER_PRESENT_CAPTURE_SOURCE; present |= MIXER_PRESENT_CAPTURE_SOURCE;
hcontrol_add(handle, &bag, hcontrol); hcontrol_add(handle, &bag, hcontrol);
@ -643,8 +643,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if ((err = snd_ctl_cinfo(handle->ctl_handle, &csource_info)) < 0) if ((err = snd_ctl_cinfo(handle->ctl_handle, &csource_info)) < 0)
return err; return err;
if (!strcmp(csource_info.value.enumerated.name, str)) { if (!strcmp(csource_info.value.enumerated.name, str)) {
if (voices < csource_info.values_count) if (voices < csource_info.count)
voices = csource_info.values_count; voices = csource_info.count;
caps |= SND_MIXER_SCTCAP_CAPTURE; caps |= SND_MIXER_SCTCAP_CAPTURE;
present |= MIXER_PRESENT_CAPTURE_SOURCE; present |= MIXER_PRESENT_CAPTURE_SOURCE;
hcontrol_add(handle, &bag, hcontrol); hcontrol_add(handle, &bag, hcontrol);
@ -661,39 +661,39 @@ static int build_input(snd_mixer_t *handle, const char *sname)
if (present & (MIXER_PRESENT_SINGLE_VOLUME|MIXER_PRESENT_GLOBAL_VOLUME|MIXER_PRESENT_PLAYBACK_VOLUME|MIXER_PRESENT_CAPTURE_VOLUME)) if (present & (MIXER_PRESENT_SINGLE_VOLUME|MIXER_PRESENT_GLOBAL_VOLUME|MIXER_PRESENT_PLAYBACK_VOLUME|MIXER_PRESENT_CAPTURE_VOLUME))
caps |= SND_MIXER_SCTCAP_JOINTLY_VOLUME; caps |= SND_MIXER_SCTCAP_JOINTLY_VOLUME;
if (present & MIXER_PRESENT_SINGLE_SWITCH) { if (present & MIXER_PRESENT_SINGLE_SWITCH) {
if (global_info.values_count > 1) if (global_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE; caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE;
} }
if (present & MIXER_PRESENT_GLOBAL_SWITCH) { if (present & MIXER_PRESENT_GLOBAL_SWITCH) {
if (gswitch_info.values_count > 1) if (gswitch_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE; caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE;
} }
if (present & MIXER_PRESENT_PLAYBACK_SWITCH) { if (present & MIXER_PRESENT_PLAYBACK_SWITCH) {
if (pswitch_info.values_count > 1) if (pswitch_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE; caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE;
} }
if (present & (MIXER_PRESENT_GLOBAL_ROUTE | MIXER_PRESENT_PLAYBACK_ROUTE)) if (present & (MIXER_PRESENT_GLOBAL_ROUTE | MIXER_PRESENT_PLAYBACK_ROUTE))
caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE; caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE;
if (present & MIXER_PRESENT_CAPTURE_SWITCH) { if (present & MIXER_PRESENT_CAPTURE_SWITCH) {
if (cswitch_info.values_count > 1) if (cswitch_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_CAPTURE; caps &= ~SND_MIXER_SCTCAP_JOINTLY_CAPTURE;
} }
if (present & MIXER_PRESENT_CAPTURE_ROUTE) if (present & MIXER_PRESENT_CAPTURE_ROUTE)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_CAPTURE; caps &= ~SND_MIXER_SCTCAP_JOINTLY_CAPTURE;
if (present & MIXER_PRESENT_SINGLE_VOLUME) { if (present & MIXER_PRESENT_SINGLE_VOLUME) {
if (global_info.values_count > 1) if (global_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME; caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME;
} }
if (present & MIXER_PRESENT_GLOBAL_VOLUME) { if (present & MIXER_PRESENT_GLOBAL_VOLUME) {
if (gvolume_info.values_count > 1) if (gvolume_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME; caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME;
} }
if (present & MIXER_PRESENT_PLAYBACK_VOLUME) { if (present & MIXER_PRESENT_PLAYBACK_VOLUME) {
if (pvolume_info.values_count > 1) if (pvolume_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME; caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME;
} }
if (present & MIXER_PRESENT_CAPTURE_VOLUME) { if (present & MIXER_PRESENT_CAPTURE_VOLUME) {
if (cvolume_info.values_count > 1) if (cvolume_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME; caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME;
} }
} }
@ -706,17 +706,17 @@ static int build_input(snd_mixer_t *handle, const char *sname)
return -ENOMEM; return -ENOMEM;
} }
simple->present = present; simple->present = present;
simple->global_values = global_info.values_count; simple->global_values = global_info.count;
simple->gswitch_values = gswitch_info.values_count; simple->gswitch_values = gswitch_info.count;
simple->pswitch_values = pswitch_info.values_count; simple->pswitch_values = pswitch_info.count;
simple->cswitch_values = cswitch_info.values_count; simple->cswitch_values = cswitch_info.count;
simple->gvolume_values = gvolume_info.values_count; simple->gvolume_values = gvolume_info.count;
simple->pvolume_values = pvolume_info.values_count; simple->pvolume_values = pvolume_info.count;
simple->cvolume_values = cvolume_info.values_count; simple->cvolume_values = cvolume_info.count;
simple->groute_values = 2; simple->groute_values = 2;
simple->proute_values = 2; simple->proute_values = 2;
simple->croute_values = 2; simple->croute_values = 2;
simple->ccapture_values = csource_info.values_count; simple->ccapture_values = csource_info.count;
simple->capture_item = capture_item; simple->capture_item = capture_item;
simple->caps = caps; simple->caps = caps;
simple->voices = voices; simple->voices = voices;

View file

@ -19,12 +19,10 @@
* *
*/ */
#include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include "local.h" #include "local.h"
typedef struct _snd_output_ops { typedef struct _snd_output_ops {

View file

@ -24,8 +24,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <limits.h> #include <limits.h>
#include <errno.h>
#include <assert.h>
#include "pcm_local.h" #include "pcm_local.h"
static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem) static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)

View file

@ -24,7 +24,5 @@
#include <sys/types.h> #include <sys/types.h>
#include <limits.h> #include <limits.h>
#include <errno.h>
#include <assert.h>
#include "pcm_local.h" #include "pcm_local.h"

View file

@ -20,7 +20,6 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <assert.h>
#ifdef SND_MASK_C #ifdef SND_MASK_C
#define MASK_INLINE inline #define MASK_INLINE inline

View file

@ -22,7 +22,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <malloc.h> #include <malloc.h>
#include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/poll.h> #include <sys/poll.h>
@ -248,12 +247,12 @@ int snd_pcm_poll_descriptor(snd_pcm_t *pcm)
#define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d #define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d
#define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d #define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d
char *snd_pcm_stream_names[] = { const char *snd_pcm_stream_names[] = {
STREAM(PLAYBACK), STREAM(PLAYBACK),
STREAM(CAPTURE), STREAM(CAPTURE),
}; };
char *snd_pcm_state_names[] = { const char *snd_pcm_state_names[] = {
STATE(OPEN), STATE(OPEN),
STATE(SETUP), STATE(SETUP),
STATE(PREPARED), STATE(PREPARED),
@ -262,7 +261,7 @@ char *snd_pcm_state_names[] = {
STATE(PAUSED), STATE(PAUSED),
}; };
char *snd_pcm_hw_param_names[] = { const char *snd_pcm_hw_param_names[] = {
HW_PARAM(ACCESS), HW_PARAM(ACCESS),
HW_PARAM(FORMAT), HW_PARAM(FORMAT),
HW_PARAM(SUBFORMAT), HW_PARAM(SUBFORMAT),
@ -280,7 +279,7 @@ char *snd_pcm_hw_param_names[] = {
HW_PARAM(TICK_TIME), HW_PARAM(TICK_TIME),
}; };
char *snd_pcm_access_names[] = { const char *snd_pcm_access_names[] = {
ACCESS(MMAP_INTERLEAVED), ACCESS(MMAP_INTERLEAVED),
ACCESS(MMAP_NONINTERLEAVED), ACCESS(MMAP_NONINTERLEAVED),
ACCESS(MMAP_COMPLEX), ACCESS(MMAP_COMPLEX),
@ -288,7 +287,7 @@ char *snd_pcm_access_names[] = {
ACCESS(RW_NONINTERLEAVED), ACCESS(RW_NONINTERLEAVED),
}; };
char *snd_pcm_format_names[] = { const char *snd_pcm_format_names[] = {
FORMAT(S8), FORMAT(S8),
FORMAT(U8), FORMAT(U8),
FORMAT(S16_LE), FORMAT(S16_LE),
@ -317,7 +316,7 @@ char *snd_pcm_format_names[] = {
FORMAT(SPECIAL), FORMAT(SPECIAL),
}; };
char *snd_pcm_format_descriptions[] = { const char *snd_pcm_format_descriptions[] = {
FORMATD(S8, "Signed 8-bit"), FORMATD(S8, "Signed 8-bit"),
FORMATD(U8, "Unsigned 8-bit"), FORMATD(U8, "Unsigned 8-bit"),
FORMATD(S16_LE, "Signed 16-bit Little Endian"), FORMATD(S16_LE, "Signed 16-bit Little Endian"),
@ -346,25 +345,25 @@ char *snd_pcm_format_descriptions[] = {
FORMATD(SPECIAL, "Special"), FORMATD(SPECIAL, "Special"),
}; };
char *snd_pcm_subformat_names[] = { const char *snd_pcm_subformat_names[] = {
SUBFORMAT(STD), SUBFORMAT(STD),
}; };
char *snd_pcm_subformat_descriptions[] = { const char *snd_pcm_subformat_descriptions[] = {
SUBFORMATD(STD, "Standard"), SUBFORMATD(STD, "Standard"),
}; };
char *snd_pcm_start_mode_names[] = { const char *snd_pcm_start_mode_names[] = {
START(EXPLICIT), START(EXPLICIT),
START(DATA), START(DATA),
}; };
char *snd_pcm_xrun_mode_names[] = { const char *snd_pcm_xrun_mode_names[] = {
XRUN(NONE), XRUN(NONE),
XRUN(STOP), XRUN(STOP),
}; };
char *snd_pcm_tstamp_mode_names[] = { const char *snd_pcm_tstamp_mode_names[] = {
TSTAMP(NONE), TSTAMP(NONE),
TSTAMP(MMAP), TSTAMP(MMAP),
}; };
@ -536,15 +535,15 @@ ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, int samples)
return samples * pcm->sample_bits / 8; return samples * pcm->sample_bits / 8;
} }
int snd_pcm_open(snd_pcm_t **pcmp, char *name, int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
char *str; const char *str;
int err; int err;
snd_config_t *pcm_conf, *conf, *type_conf; snd_config_t *pcm_conf, *conf, *type_conf;
snd_config_iterator_t i; snd_config_iterator_t i;
char *lib = NULL, *open = NULL; const char *lib = NULL, *open = NULL;
int (*open_func)(snd_pcm_t **pcmp, char *name, snd_config_t *conf, int (*open_func)(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
snd_pcm_stream_t stream, int mode); snd_pcm_stream_t stream, int mode);
void *h; void *h;
assert(pcmp && name); assert(pcmp && name);

View file

@ -597,7 +597,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
int err; int err;
snd_pcm_t *spcm; snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN; snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
@ -618,7 +618,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
continue; continue;
} }
if (strcmp(n->id, "sformat") == 0) { if (strcmp(n->id, "sformat") == 0) {
char *f; const char *f;
err = snd_config_string_get(n, &f); err = snd_config_string_get(n, &f);
if (err < 0) { if (err < 0) {
ERR("Invalid type for %s", n->id); ERR("Invalid type for %s", n->id);
@ -652,7 +652,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
if (!sname) if (!sname)
return -ENOMEM; return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode); err = snd_pcm_open(&spcm, sname, stream, mode);
free(sname); free((void *) sname);
if (err < 0) if (err < 0)
return err; return err;
err = snd_pcm_adpcm_open(pcmp, name, sformat, spcm, 1); err = snd_pcm_adpcm_open(pcmp, name, sformat, spcm, 1);

View file

@ -470,7 +470,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
int err; int err;
snd_pcm_t *spcm; snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN; snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
@ -491,7 +491,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
continue; continue;
} }
if (strcmp(n->id, "sformat") == 0) { if (strcmp(n->id, "sformat") == 0) {
char *f; const char *f;
err = snd_config_string_get(n, &f); err = snd_config_string_get(n, &f);
if (err < 0) { if (err < 0) {
ERR("Invalid type for %s", n->id); ERR("Invalid type for %s", n->id);
@ -525,7 +525,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
if (!sname) if (!sname)
return -ENOMEM; return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode); err = snd_pcm_open(&spcm, sname, stream, mode);
free(sname); free((void *) sname);
if (err < 0) if (err < 0)
return err; return err;
err = snd_pcm_alaw_open(pcmp, name, sformat, spcm, 1); err = snd_pcm_alaw_open(pcmp, name, sformat, spcm, 1);

View file

@ -228,7 +228,7 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
int err; int err;
snd_pcm_t *spcm; snd_pcm_t *spcm;
snd_config_foreach(i, conf) { snd_config_foreach(i, conf) {
@ -259,7 +259,7 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, char *name,
if (!sname) if (!sname)
return -ENOMEM; return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode); err = snd_pcm_open(&spcm, sname, stream, mode);
free(sname); free((void *) sname);
if (err < 0) if (err < 0)
return err; return err;
err = snd_pcm_copy_open(pcmp, name, spcm, 1); err = snd_pcm_copy_open(pcmp, name, spcm, 1);

View file

@ -30,7 +30,7 @@ typedef enum _snd_pcm_file_format {
typedef struct { typedef struct {
snd_pcm_t *slave; snd_pcm_t *slave;
int close_slave; int close_slave;
char *fname; const char *fname;
int fd; int fd;
int format; int format;
snd_pcm_uframes_t appl_ptr; snd_pcm_uframes_t appl_ptr;
@ -102,7 +102,7 @@ static int snd_pcm_file_close(snd_pcm_t *pcm)
if (file->close_slave) if (file->close_slave)
err = snd_pcm_close(file->slave); err = snd_pcm_close(file->slave);
if (file->fname) { if (file->fname) {
free(file->fname); free((void *)file->fname);
close(file->fd); close(file->fd);
} }
free(file); free(file);
@ -403,7 +403,7 @@ snd_pcm_fast_ops_t snd_pcm_file_fast_ops = {
mmap_forward: snd_pcm_file_mmap_forward, mmap_forward: snd_pcm_file_mmap_forward,
}; };
int snd_pcm_file_open(snd_pcm_t **pcmp, char *name, char *fname, int fd, char *fmt, snd_pcm_t *slave, int close_slave) int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int fd, const char *fmt, snd_pcm_t *slave, int close_slave)
{ {
snd_pcm_t *pcm; snd_pcm_t *pcm;
snd_pcm_file_t *file; snd_pcm_file_t *file;
@ -464,11 +464,11 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
int err; int err;
snd_pcm_t *spcm; snd_pcm_t *spcm;
char *fname = NULL; const char *fname = NULL;
char *format = NULL; const char *format = NULL;
long fd = -1; long fd = -1;
snd_config_foreach(i, conf) { snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i); snd_config_t *n = snd_config_entry(i);
@ -526,7 +526,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, char *name,
if (!sname) if (!sname)
return -ENOMEM; return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode); err = snd_pcm_open(&spcm, sname, stream, mode);
free(sname); free((void *) sname);
if (err < 0) if (err < 0)
return err; return err;
err = snd_pcm_file_open(pcmp, name, fname, fd, format, spcm, 1); err = snd_pcm_file_open(pcmp, name, fname, fd, format, spcm, 1);

View file

@ -24,7 +24,6 @@
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
@ -664,7 +663,7 @@ int snd_pcm_hw_open_device(snd_pcm_t **pcmp, int card, int device, snd_pcm_strea
return snd_pcm_hw_open_subdevice(pcmp, card, device, -1, stream, mode); return snd_pcm_hw_open_subdevice(pcmp, card, device, -1, stream, mode);
} }
int snd_pcm_hw_open(snd_pcm_t **pcmp, char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode) int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode)
{ {
int err = snd_pcm_hw_open_subdevice(pcmp, card, device, subdevice, stream, mode); int err = snd_pcm_hw_open_subdevice(pcmp, card, device, subdevice, stream, mode);
if (err < 0) if (err < 0)
@ -679,7 +678,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
long card = -1, device = 0, subdevice = -1; long card = -1, device = 0, subdevice = -1;
char *str; const char *str;
int err; int err;
snd_config_foreach(i, conf) { snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i); snd_config_t *n = snd_config_entry(i);

View file

@ -368,7 +368,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
int err; int err;
snd_pcm_t *spcm; snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN; snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
@ -389,7 +389,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
continue; continue;
} }
if (strcmp(n->id, "sformat") == 0) { if (strcmp(n->id, "sformat") == 0) {
char *f; const char *f;
err = snd_config_string_get(n, &f); err = snd_config_string_get(n, &f);
if (err < 0) { if (err < 0) {
ERR("Invalid type for %s", n->id); ERR("Invalid type for %s", n->id);
@ -422,7 +422,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
if (!sname) if (!sname)
return -ENOMEM; return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode); err = snd_pcm_open(&spcm, sname, stream, mode);
free(sname); free((void *) sname);
if (err < 0) if (err < 0)
return err; return err;
err = snd_pcm_linear_open(pcmp, name, sformat, spcm, 1); err = snd_pcm_linear_open(pcmp, name, sformat, spcm, 1);

View file

@ -20,12 +20,10 @@
* *
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <errno.h>
#define _snd_pcm_access_mask _snd_mask #define _snd_pcm_access_mask _snd_mask
#define _snd_pcm_format_mask _snd_mask #define _snd_pcm_format_mask _snd_mask
@ -167,11 +165,11 @@ struct _snd_pcm {
void *private; void *private;
}; };
int snd_pcm_hw_open(snd_pcm_t **pcm, char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode); int snd_pcm_hw_open(snd_pcm_t **pcm, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode);
int snd_pcm_plug_open_hw(snd_pcm_t **pcm, char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode); int snd_pcm_plug_open_hw(snd_pcm_t **pcm, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode);
int snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, char *socket, char *sname, snd_pcm_stream_t stream, int mode); int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *socket, const char *sname, snd_pcm_stream_t stream, int mode);
int snd_pcm_file_open(snd_pcm_t **pcmp, char *name, char *fname, int fd, char *fmt, snd_pcm_t *slave, int close_slave); int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int fd, const char *fmt, snd_pcm_t *slave, int close_slave);
int snd_pcm_null_open(snd_pcm_t **pcmp, char *name, snd_pcm_stream_t stream, int mode); int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode);
void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, void *buf); void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, void *buf);

View file

@ -22,6 +22,7 @@
#include "pcm_local.h" #include "pcm_local.h"
size_t snd_pcm_access_mask_sizeof() size_t snd_pcm_access_mask_sizeof()
{ {
return sizeof(snd_pcm_access_mask_t); return sizeof(snd_pcm_access_mask_t);
@ -30,7 +31,7 @@ size_t snd_pcm_access_mask_sizeof()
int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr) int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_pcm_access_mask_t)); *ptr = calloc(1, sizeof(snd_pcm_access_mask_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -81,7 +82,7 @@ size_t snd_pcm_format_mask_sizeof()
int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr) int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_pcm_format_mask_t)); *ptr = calloc(1, sizeof(snd_pcm_format_mask_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -132,7 +133,7 @@ size_t snd_pcm_subformat_mask_sizeof()
int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr) int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_pcm_subformat_mask_t)); *ptr = calloc(1, sizeof(snd_pcm_subformat_mask_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -183,7 +184,7 @@ size_t snd_pcm_hw_params_sizeof()
int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr) int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_pcm_hw_params_t)); *ptr = calloc(1, sizeof(snd_pcm_hw_params_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -205,9 +206,14 @@ snd_pcm_access_t snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params)
return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_ACCESS, NULL)); return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_ACCESS, NULL));
} }
int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_access_t val) int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_ACCESS, snd_enum_to_int(val), 0); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_ACCESS, snd_enum_to_int(val), 0);
}
int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val)
{
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_ACCESS, snd_enum_to_int(val), 0);
} }
snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
@ -220,9 +226,9 @@ snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_pa
return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_ACCESS, NULL)); return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_ACCESS, NULL));
} }
int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_access_mask_t *mask) int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask)
{ {
return snd_pcm_hw_param_set_mask(pcm, params, mode, SND_PCM_HW_PARAM_ACCESS, (snd_mask_t *) mask); return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_ACCESS, (snd_mask_t *) mask);
} }
@ -231,9 +237,14 @@ snd_pcm_format_t snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params)
return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, NULL)); return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, NULL));
} }
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_format_t val) int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_FORMAT, snd_enum_to_int(val), 0); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_FORMAT, snd_enum_to_int(val), 0);
}
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val)
{
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, snd_enum_to_int(val), 0);
} }
snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
@ -246,20 +257,25 @@ snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_pa
return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_FORMAT, NULL)); return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_FORMAT, NULL));
} }
int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_format_mask_t *mask) int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask)
{ {
return snd_pcm_hw_param_set_mask(pcm, params, mode, SND_PCM_HW_PARAM_FORMAT, (snd_mask_t *) mask); return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, (snd_mask_t *) mask);
} }
int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val)
{
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_SUBFORMAT, snd_enum_to_int(val), 0);
}
snd_pcm_subformat_t snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params) snd_pcm_subformat_t snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params)
{ {
return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, NULL)); return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, NULL));
} }
int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_subformat_t val) int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_SUBFORMAT, snd_enum_to_int(val), 0); return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_SUBFORMAT, snd_enum_to_int(val), 0);
} }
snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
@ -272,9 +288,9 @@ snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm
return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, NULL)); return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, NULL));
} }
int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_subformat_mask_t *mask) int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask)
{ {
return snd_pcm_hw_param_set_mask(pcm, params, mode, SND_PCM_HW_PARAM_SUBFORMAT, (snd_mask_t *) mask); return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_SUBFORMAT, (snd_mask_t *) mask);
} }
@ -293,24 +309,29 @@ unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *param
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, NULL); return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, NULL);
} }
int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val) int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_CHANNELS, val, 0); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_CHANNELS, val, 0);
} }
int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val) int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
{ {
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_CHANNELS, val, NULL); return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, val, 0);
} }
int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val) int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
{ {
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_CHANNELS, val, NULL); return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
} }
int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, unsigned int *max) int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
{ {
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_CHANNELS, min, NULL, max, NULL); return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
}
int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max)
{
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, min, NULL, max, NULL);
} }
unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val) unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
@ -344,24 +365,29 @@ unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, i
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_RATE, dir); return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_RATE, dir);
} }
int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir) int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_RATE, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_RATE, val, dir);
} }
int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_RATE, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, val, dir);
} }
int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_RATE, val, dir); return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, val, dir);
} }
int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir) int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_RATE, min, mindir, max, maxdir); return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, val, dir);
}
int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
{
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, min, mindir, max, maxdir);
} }
unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
@ -395,24 +421,29 @@ unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *pa
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, dir); return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, dir);
} }
int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir) int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
} }
int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
} }
int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir); return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
} }
int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir) int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_TIME, min, mindir, max, maxdir); return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
}
int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
{
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, min, mindir, max, maxdir);
} }
unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
@ -446,32 +477,37 @@ snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir); return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir);
} }
int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t val, int dir) int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_PERIOD_SIZE, val, dir);
} }
int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val, int *dir) int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir)
{
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, val, dir);
}
int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
{ {
unsigned int _val = *val; unsigned int _val = *val;
int err = snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); int err = snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
*val = _val; *val = _val;
return err; return err;
} }
int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val, int *dir) int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
{ {
unsigned int _val = *val; unsigned int _val = *val;
int err = snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); int err = snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
*val = _val; *val = _val;
return err; return err;
} }
int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir) int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir)
{ {
unsigned int _min = *min; unsigned int _min = *min;
unsigned int _max = *max; unsigned int _max = *max;
int err = snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE, &_min, mindir, &_max, maxdir); int err = snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_min, mindir, &_max, maxdir);
*min = _min; *min = _min;
*max = _max; *max = _max;
return err; return err;
@ -492,9 +528,9 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm
return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir); return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir);
} }
int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode) int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{ {
return snd_pcm_hw_param_set_integer(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE); return snd_pcm_hw_param_set_integer(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE);
} }
@ -513,24 +549,29 @@ unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIODS, dir); return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIODS, dir);
} }
int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir) int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_PERIODS, val, dir);
} }
int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, val, dir);
} }
int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS, val, dir); return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, val, dir);
} }
int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir) int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS, min, mindir, max, maxdir); return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, val, dir);
}
int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
{
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, min, mindir, max, maxdir);
} }
unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
@ -548,9 +589,9 @@ unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_param
return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIODS, dir); return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIODS, dir);
} }
int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode) int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{ {
return snd_pcm_hw_param_set_integer(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS); return snd_pcm_hw_param_set_integer(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS);
} }
@ -569,24 +610,29 @@ unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *pa
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_TIME, dir); return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_TIME, dir);
} }
int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir) int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
} }
int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
} }
int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir); return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
} }
int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir) int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_TIME, min, mindir, max, maxdir); return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
}
int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
{
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, min, mindir, max, maxdir);
} }
unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
@ -620,32 +666,37 @@ snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL); return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL);
} }
int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t val) int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_SIZE, val, 0); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_BUFFER_SIZE, val, 0);
} }
int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val) int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val)
{
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, val, 0);
}
int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
{ {
unsigned int _val = *val; unsigned int _val = *val;
int err = snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); int err = snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
*val = _val; *val = _val;
return err; return err;
} }
int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val) int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
{ {
unsigned int _val = *val; unsigned int _val = *val;
int err = snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); int err = snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
*val = _val; *val = _val;
return err; return err;
} }
int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max) int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max)
{ {
unsigned int _min = *min; unsigned int _min = *min;
unsigned int _max = *max; unsigned int _max = *max;
int err = snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_SIZE, &_min, NULL, &_max, NULL); int err = snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_min, NULL, &_max, NULL);
*min = _min; *min = _min;
*max = _max; *max = _max;
return err; return err;
@ -682,24 +733,29 @@ unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *para
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_TICK_TIME, dir); return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_TICK_TIME, dir);
} }
int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir) int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_TICK_TIME, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
} }
int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
{ {
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_TICK_TIME, val, dir); return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
} }
int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir) int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_TICK_TIME, val, dir); return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
} }
int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir) int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
{ {
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_TICK_TIME, min, mindir, max, maxdir); return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
}
int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
{
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, min, mindir, max, maxdir);
} }
unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
@ -726,7 +782,7 @@ size_t snd_pcm_sw_params_sizeof()
int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr) int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_pcm_sw_params_t)); *ptr = calloc(1, sizeof(snd_pcm_sw_params_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -875,115 +931,6 @@ snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *
} }
size_t snd_pcm_info_sizeof()
{
return sizeof(snd_pcm_info_t);
}
int snd_pcm_info_malloc(snd_pcm_info_t **ptr)
{
assert(ptr);
*ptr = malloc(sizeof(snd_pcm_info_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_pcm_info_free(snd_pcm_info_t *obj)
{
free(obj);
}
void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src)
{
assert(dst && src);
*dst = *src;
}
unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->device;
}
unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->subdevice;
}
snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->stream);
}
int snd_pcm_info_get_card(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->card;
}
const char * snd_pcm_info_get_id(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->id;
}
const char * snd_pcm_info_get_name(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->name;
}
const char * snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->subname;
}
snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->dev_class);
}
snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->dev_subclass);
}
unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->subdevices_count;
}
unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->subdevices_avail;
}
void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val)
{
assert(obj);
obj->device = val;
}
void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val)
{
assert(obj);
obj->subdevice = val;
}
void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val)
{
assert(obj);
obj->stream = snd_enum_to_int(val);
}
size_t snd_pcm_status_sizeof() size_t snd_pcm_status_sizeof()
{ {
return sizeof(snd_pcm_status_t); return sizeof(snd_pcm_status_t);
@ -992,7 +939,7 @@ size_t snd_pcm_status_sizeof()
int snd_pcm_status_malloc(snd_pcm_status_t **ptr) int snd_pcm_status_malloc(snd_pcm_status_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_pcm_status_t)); *ptr = calloc(1, sizeof(snd_pcm_status_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -1045,3 +992,112 @@ snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj)
return obj->avail_max; return obj->avail_max;
} }
size_t snd_pcm_info_sizeof()
{
return sizeof(snd_pcm_info_t);
}
int snd_pcm_info_malloc(snd_pcm_info_t **ptr)
{
assert(ptr);
*ptr = calloc(1, sizeof(snd_pcm_info_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_pcm_info_free(snd_pcm_info_t *obj)
{
free(obj);
}
void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src)
{
assert(dst && src);
*dst = *src;
}
unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->device;
}
unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->subdevice;
}
snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->stream);
}
int snd_pcm_info_get_card(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->card;
}
const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->id;
}
const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->name;
}
const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->subname;
}
snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->dev_class);
}
snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->dev_subclass);
}
unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->subdevices_count;
}
unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->subdevices_avail;
}
void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val)
{
assert(obj);
obj->device = val;
}
void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val)
{
assert(obj);
obj->subdevice = val;
}
void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val)
{
assert(obj);
obj->stream = snd_enum_to_int(val);
}

View file

@ -34,7 +34,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <byteswap.h> #include <byteswap.h>
#include "pcm_local.h" #include "pcm_local.h"
#endif #endif

View file

@ -21,7 +21,6 @@
#include <stdio.h> #include <stdio.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <sys/poll.h> #include <sys/poll.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/shm.h> #include <sys/shm.h>

View file

@ -485,7 +485,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
int err; int err;
snd_pcm_t *spcm; snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN; snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
@ -506,7 +506,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
continue; continue;
} }
if (strcmp(n->id, "sformat") == 0) { if (strcmp(n->id, "sformat") == 0) {
char *f; const char *f;
err = snd_config_string_get(n, &f); err = snd_config_string_get(n, &f);
if (err < 0) { if (err < 0) {
ERR("Invalid type for %s", n->id); ERR("Invalid type for %s", n->id);
@ -540,7 +540,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
if (!sname) if (!sname)
return -ENOMEM; return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode); err = snd_pcm_open(&spcm, sname, stream, mode);
free(sname); free((void *) sname);
if (err < 0) if (err < 0)
return err; return err;
err = snd_pcm_mulaw_open(pcmp, name, sformat, spcm, 1); err = snd_pcm_mulaw_open(pcmp, name, sformat, spcm, 1);

View file

@ -23,7 +23,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <math.h> #include <math.h>
#include "pcm_local.h" #include "pcm_local.h"
@ -664,7 +663,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
idx = 0; idx = 0;
snd_config_foreach(i, slave) { snd_config_foreach(i, slave) {
snd_config_t *m = snd_config_entry(i); snd_config_t *m = snd_config_entry(i);
char *name = NULL; const char *name = NULL;
long channels = -1; long channels = -1;
slaves_id[idx] = m->id; slaves_id[idx] = m->id;
snd_config_foreach(j, m) { snd_config_foreach(j, m) {
@ -712,7 +711,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
long schannel = -1; long schannel = -1;
int slave = -1; int slave = -1;
long val; long val;
char *str; const char *str;
cchannel = strtol(m->id, 0, 10); cchannel = strtol(m->id, 0, 10);
if (cchannel < 0) { if (cchannel < 0) {
ERR("Invalid channel number: %s", m->id); ERR("Invalid channel number: %s", m->id);

View file

@ -319,7 +319,7 @@ snd_pcm_fast_ops_t snd_pcm_null_fast_ops = {
mmap_forward: snd_pcm_null_mmap_forward, mmap_forward: snd_pcm_null_mmap_forward,
}; };
int snd_pcm_null_open(snd_pcm_t **pcmp, char *name, snd_pcm_stream_t stream, int mode) int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode)
{ {
snd_pcm_t *pcm; snd_pcm_t *pcm;
snd_pcm_null_t *null; snd_pcm_null_t *null;

View file

@ -902,7 +902,7 @@ void snd_pcm_hw_param_refine_near(snd_pcm_t *pcm,
min = snd_pcm_hw_param_get_min(src, var, &mindir); min = snd_pcm_hw_param_get_min(src, var, &mindir);
max = snd_pcm_hw_param_get_max(src, var, &maxdir); max = snd_pcm_hw_param_get_max(src, var, &maxdir);
snd_pcm_hw_param_set_near_minmax(pcm, params, var, snd_pcm_hw_param_set_near_minmax(pcm, params, var,
min, &mindir, max, &maxdir); min, &mindir, max, &maxdir);
} }
/* ---- end of refinement functions ---- */ /* ---- end of refinement functions ---- */
@ -968,14 +968,6 @@ int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params)
return params->msbits; return params->msbits;
} }
/* Return info for configuration space defined by PARAMS */
int snd_pcm_hw_params_get_flags(const snd_pcm_hw_params_t *params)
{
if (params->info == ~0U)
return -EINVAL;
return params->info;
}
/* Return fifo size for configuration space defined by PARAMS */ /* Return fifo size for configuration space defined by PARAMS */
int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
{ {

View file

@ -574,8 +574,8 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (!(clt_params.format == slv_params.format && if (!(clt_params.format == slv_params.format &&
clt_params.channels == slv_params.channels && clt_params.channels == slv_params.channels &&
clt_params.rate == slv_params.rate && clt_params.rate == slv_params.rate &&
snd_pcm_hw_params_set_access(slave, &sparams, SND_TEST, snd_pcm_hw_params_test_access(slave, &sparams,
clt_params.access) >= 0)) { clt_params.access) >= 0)) {
slv_params.access = snd_pcm_hw_params_set_access_first(slave, &sparams); slv_params.access = snd_pcm_hw_params_set_access_first(slave, &sparams);
err = snd_pcm_plug_insert_plugins(pcm, &clt_params, &slv_params); err = snd_pcm_plug_insert_plugins(pcm, &clt_params, &slv_params);
if (err < 0) if (err < 0)
@ -646,7 +646,7 @@ snd_pcm_ops_t snd_pcm_plug_ops = {
}; };
int snd_pcm_plug_open(snd_pcm_t **pcmp, int snd_pcm_plug_open(snd_pcm_t **pcmp,
char *name, const char *name,
snd_pcm_route_ttable_entry_t *ttable, snd_pcm_route_ttable_entry_t *ttable,
unsigned int tt_ssize, unsigned int tt_ssize,
unsigned int tt_cused, unsigned int tt_sused, unsigned int tt_cused, unsigned int tt_sused,
@ -688,7 +688,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
return 0; return 0;
} }
int snd_pcm_plug_open_hw(snd_pcm_t **pcmp, char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode) int snd_pcm_plug_open_hw(snd_pcm_t **pcmp, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode)
{ {
snd_pcm_t *slave; snd_pcm_t *slave;
int err; int err;
@ -700,12 +700,12 @@ int snd_pcm_plug_open_hw(snd_pcm_t **pcmp, char *name, int card, int device, int
#define MAX_CHANNELS 32 #define MAX_CHANNELS 32
int _snd_pcm_plug_open(snd_pcm_t **pcmp, char *name, int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *conf, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
int err; int err;
snd_pcm_t *spcm; snd_pcm_t *spcm;
snd_config_t *tt = NULL; snd_config_t *tt = NULL;
@ -755,7 +755,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, char *name,
if (!sname) if (!sname)
return -ENOMEM; return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode); err = snd_pcm_open(&spcm, sname, stream, mode);
free(sname); free((void *) sname);
if (err < 0) if (err < 0)
return err; return err;
err = snd_pcm_plug_open(pcmp, name, ttable, MAX_CHANNELS, cused, sused, spcm, 1); err = snd_pcm_plug_open(pcmp, name, ttable, MAX_CHANNELS, cused, sused, spcm, 1);

View file

@ -622,7 +622,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
int err; int err;
snd_pcm_t *spcm; snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN; snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
@ -644,7 +644,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
continue; continue;
} }
if (strcmp(n->id, "sformat") == 0) { if (strcmp(n->id, "sformat") == 0) {
char *f; const char *f;
err = snd_config_string_get(n, &f); err = snd_config_string_get(n, &f);
if (err < 0) { if (err < 0) {
ERR("Invalid type for %s", n->id); ERR("Invalid type for %s", n->id);
@ -685,7 +685,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
if (!sname) if (!sname)
return -ENOMEM; return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode); err = snd_pcm_open(&spcm, sname, stream, mode);
free(sname); free((void *) sname);
if (err < 0) if (err < 0)
return err; return err;
err = snd_pcm_rate_open(pcmp, name, sformat, srate, spcm, 1); err = snd_pcm_rate_open(pcmp, name, sformat, srate, spcm, 1);

View file

@ -883,7 +883,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
int err; int err;
snd_pcm_t *spcm; snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN; snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
@ -908,7 +908,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
continue; continue;
} }
if (strcmp(n->id, "sformat") == 0) { if (strcmp(n->id, "sformat") == 0) {
char *f; const char *f;
err = snd_config_string_get(n, &f); err = snd_config_string_get(n, &f);
if (err < 0) { if (err < 0) {
ERR("Invalid type for %s", n->id); ERR("Invalid type for %s", n->id);
@ -963,7 +963,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
if (!sname) if (!sname)
return -ENOMEM; return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode); err = snd_pcm_open(&spcm, sname, stream, mode);
free(sname); free((void *) sname);
if (err < 0) if (err < 0)
return err; return err;
err = snd_pcm_route_open(pcmp, name, sformat, schannels, err = snd_pcm_route_open(pcmp, name, sformat, schannels,

View file

@ -25,7 +25,6 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <errno.h>
#include <math.h> #include <math.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/poll.h> #include <sys/poll.h>
@ -1181,7 +1180,7 @@ snd_pcm_fast_ops_t snd_pcm_share_fast_ops = {
mmap_forward: snd_pcm_share_mmap_forward, mmap_forward: snd_pcm_share_mmap_forward,
}; };
int snd_pcm_share_open(snd_pcm_t **pcmp, char *name, char *sname, int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
snd_pcm_format_t sformat, int srate, snd_pcm_format_t sformat, int srate,
unsigned int schannels_count, unsigned int schannels_count,
unsigned int channels_count, int *channels_map, unsigned int channels_count, int *channels_map,
@ -1363,7 +1362,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *sname = NULL; const char *sname = NULL;
snd_config_t *binding = NULL; snd_config_t *binding = NULL;
int err; int err;
unsigned int idx; unsigned int idx;
@ -1391,7 +1390,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
continue; continue;
} }
if (strcmp(n->id, "sformat") == 0) { if (strcmp(n->id, "sformat") == 0) {
char *f; const char *f;
err = snd_config_string_get(n, &f); err = snd_config_string_get(n, &f);
if (err < 0) { if (err < 0) {
ERR("Invalid type for %s", n->id); ERR("Invalid type for %s", n->id);

View file

@ -25,7 +25,6 @@
#include <limits.h> #include <limits.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/shm.h> #include <sys/shm.h>
@ -564,7 +563,7 @@ static int make_inet_socket(const char *host, int port)
} }
#endif #endif
int snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, char *socket, char *sname, snd_pcm_stream_t stream, int mode) int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *socket, const char *sname, snd_pcm_stream_t stream, int mode)
{ {
snd_pcm_t *pcm; snd_pcm_t *pcm;
snd_pcm_shm_t *shm = NULL; snd_pcm_shm_t *shm = NULL;
@ -721,11 +720,11 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
char *server = NULL; const char *server = NULL;
char *sname = NULL; const char *sname = NULL;
snd_config_t *sconfig; snd_config_t *sconfig;
char *host = NULL; const char *host = NULL;
char *socket = NULL; const char *socket = NULL;
long port = -1; long port = -1;
int err; int err;
int local; int local;

View file

@ -24,7 +24,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <asm/page.h> #include <asm/page.h>
#include "rawmidi_local.h" #include "rawmidi_local.h"
@ -162,13 +161,13 @@ int snd_rawmidi_params_default(snd_rawmidi_t *rmidi, snd_rawmidi_stream_t stream
int snd_rawmidi_open(snd_rawmidi_t **rawmidip, char *name, int snd_rawmidi_open(snd_rawmidi_t **rawmidip, char *name,
int streams, int mode) int streams, int mode)
{ {
char *str; const char *str;
int err; int err;
snd_config_t *rawmidi_conf, *conf, *type_conf; snd_config_t *rawmidi_conf, *conf, *type_conf;
snd_config_iterator_t i; snd_config_iterator_t i;
snd_rawmidi_params_t params; snd_rawmidi_params_t params;
unsigned int stream; unsigned int stream;
char *lib = NULL, *open = NULL; const char *lib = NULL, *open = NULL;
int (*open_func)(snd_rawmidi_t **rawmidip, char *name, snd_config_t *conf, int (*open_func)(snd_rawmidi_t **rawmidip, char *name, snd_config_t *conf,
int streams, int mode); int streams, int mode);
void *h; void *h;

View file

@ -24,7 +24,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "../control/control_local.h" #include "../control/control_local.h"
@ -276,7 +275,7 @@ int _snd_rawmidi_hw_open(snd_rawmidi_t **handlep, char *name, snd_config_t *conf
{ {
snd_config_iterator_t i; snd_config_iterator_t i;
long card = -1, device = 0, subdevice = -1; long card = -1, device = 0, subdevice = -1;
char *str; const char *str;
int err; int err;
snd_config_foreach(i, conf) { snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i); snd_config_t *n = snd_config_entry(i);

View file

@ -19,11 +19,9 @@
* *
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
#include <errno.h>
#include "local.h" #include "local.h"
typedef struct { typedef struct {

View file

@ -29,7 +29,7 @@ size_t snd_rawmidi_params_sizeof()
int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr) int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_rawmidi_params_t)); *ptr = calloc(1, sizeof(snd_rawmidi_params_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -98,7 +98,7 @@ size_t snd_rawmidi_info_sizeof()
int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr) int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_rawmidi_info_t)); *ptr = calloc(1, sizeof(snd_rawmidi_info_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
@ -145,19 +145,19 @@ unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj)
return obj->flags; return obj->flags;
} }
const char * snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj) const char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj)
{ {
assert(obj); assert(obj);
return obj->id; return obj->id;
} }
const char * snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj) const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj)
{ {
assert(obj); assert(obj);
return obj->name; return obj->name;
} }
const char * snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj) const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj)
{ {
assert(obj); assert(obj);
return obj->subname; return obj->subname;
@ -201,7 +201,7 @@ size_t snd_rawmidi_status_sizeof()
int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr) int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr)
{ {
assert(ptr); assert(ptr);
*ptr = malloc(sizeof(snd_rawmidi_status_t)); *ptr = calloc(1, sizeof(snd_rawmidi_status_t));
if (!*ptr) if (!*ptr)
return -ENOMEM; return -ENOMEM;
return 0; return 0;

View file

@ -27,11 +27,11 @@
int snd_seq_open(snd_seq_t **seqp, char *name, int snd_seq_open(snd_seq_t **seqp, char *name,
int streams, int mode) int streams, int mode)
{ {
char *str; const char *str;
int err; int err;
snd_config_t *seq_conf, *conf, *type_conf; snd_config_t *seq_conf, *conf, *type_conf;
snd_config_iterator_t i; snd_config_iterator_t i;
char *lib = NULL, *open = NULL; const char *lib = NULL, *open = NULL;
int (*open_func)(snd_seq_t **seqp, char *name, snd_config_t *conf, int (*open_func)(snd_seq_t **seqp, char *name, snd_config_t *conf,
int streams, int mode); int streams, int mode);
void *h; void *h;

View file

@ -23,11 +23,9 @@
#ifndef __SEQ_LOCAL_H #ifndef __SEQ_LOCAL_H
#define __SEQ_LOCAL_H #define __SEQ_LOCAL_H
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
#include <errno.h>
#include "local.h" #include "local.h"
#define SND_SEQ_OBUF_SIZE (16*1024) /* default size */ #define SND_SEQ_OBUF_SIZE (16*1024) /* default size */

View file

@ -20,7 +20,6 @@
*/ */
#include <malloc.h> #include <malloc.h>
#include <errno.h>
#include "local.h" #include "local.h"

View file

@ -24,7 +24,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "seq_local.h" #include "seq_local.h"

View file

@ -23,7 +23,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "local.h" #include "local.h"

View file

@ -6,7 +6,7 @@ int main(void)
{ {
int idx, idx1, cards, err; int idx, idx1, cards, err;
snd_ctl_t *handle; snd_ctl_t *handle;
snd_ctl_hw_info_t info; snd_ctl_info_t info;
snd_pcm_info_t pcminfo; snd_pcm_info_t pcminfo;
snd_mixer_info_t mixerinfo; snd_mixer_info_t mixerinfo;
snd_rawmidi_info_t rawmidiinfo; snd_rawmidi_info_t rawmidiinfo;
@ -23,7 +23,7 @@ int main(void)
printf("Open error: %s\n", snd_strerror(err)); printf("Open error: %s\n", snd_strerror(err));
continue; continue;
} }
if ((err = snd_ctl_hw_info(handle, &info)) < 0) { if ((err = snd_ctl_info(handle, &info)) < 0) {
printf("HW info error: %s\n", snd_strerror(err)); printf("HW info error: %s\n", snd_strerror(err));
continue; continue;
} }

View file

@ -32,7 +32,7 @@ int main(void)
{ {
int idx, idx1, cards, err; int idx, idx1, cards, err;
snd_ctl_t *handle; snd_ctl_t *handle;
snd_ctl_hw_info_t info; snd_ctl_info_t info;
cards = snd_cards(); cards = snd_cards();
printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : ""); 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)); printf("Open error: %s\n", snd_strerror(err));
continue; continue;
} }
if ((err = snd_ctl_hw_info(handle, &info)) < 0) { if ((err = snd_ctl_info(handle, &info)) < 0) {
printf("HW info error: %s\n", snd_strerror(err)); printf("HW info error: %s\n", snd_strerror(err));
continue; continue;
} }

View file

@ -108,7 +108,7 @@ int main(void)
{ {
snd_ctl_t *ctl_handle; snd_ctl_t *ctl_handle;
int cards, card, err, idx; int cards, card, err, idx;
snd_ctl_hw_info_t info; snd_ctl_info_t info;
cards = snd_cards(); cards = snd_cards();
printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : ""); 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)); printf("CTL open error: %s\n", snd_strerror(err));
continue; continue;
} }
if ((err = snd_ctl_hw_info(ctl_handle, &info)) < 0) { if ((err = snd_ctl_info(ctl_handle, &info)) < 0) {
printf("HWINFO error: %s\n", snd_strerror(err)); printf("HWINFO error: %s\n", snd_strerror(err));
continue; continue;
} }