#include <sys/un.h>
#include <sys/uio.h>
#include <stdio.h>
-#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
-#include <assert.h>
#include <stddef.h>
#include <getopt.h>
#include <netinet/in.h>
ctrl->cmd = 0;
ctl = client->device.control.handle;
switch (cmd) {
- case SNDRV_CTL_IOCTL_HW_INFO:
- ctrl->result = snd_ctl_hw_info(ctl, &ctrl->u.hw_info);
+ case SNDRV_CTL_IOCTL_INFO:
+ ctrl->result = snd_ctl_info(ctl, &ctrl->u.hw_info);
break;
case SNDRV_CTL_IOCTL_CONTROL_LIST:
{
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;
break;
}
return 0;
}
-int server(char *sockname, int port)
+int server(const char *sockname, int port)
{
int err;
unsigned int k;
int c;
snd_config_t *conf;
snd_config_iterator_t i;
- char *socket = NULL;
- char *host = NULL;
+ const char *socket = NULL;
+ const char *host = NULL;
long port = -1;
int err;
char *srvname;
#
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 \
- 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 \
conv.h instr.h conf.h footer.h
int cmd;
union {
int device;
- snd_ctl_hw_info_t hw_info;
+ snd_ctl_info_t hw_info;
snd_control_list_t clist;
snd_control_info_t cinfo;
snd_control_t cread;
+#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 {
SND_CONFIG_TYPE_INTEGER,
SND_CONFIG_TYPE_REAL,
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_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,
snd_config_t **result, ...);
int snd_config_add(snd_config_t *config, snd_config_t *leaf);
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);
-int snd_config_integer_make(snd_config_t **config, char *key);
-int snd_config_real_make(snd_config_t **config, char *key);
-int snd_config_string_make(snd_config_t **config, char *key);
-int snd_config_compound_make(snd_config_t **config, char *key, int join);
+int snd_config_integer_make(snd_config_t **config, const char *key);
+int snd_config_real_make(snd_config_t **config, const char *key);
+int snd_config_string_make(snd_config_t **config, const char *key);
+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_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_real_get(snd_config_t *config, double *value);
-int snd_config_string_get(snd_config_t *config, 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 *);
+int snd_config_string_get(snd_config_t *config, const char **value);
typedef struct list_head *snd_config_iterator_t;
****************************************************************************/
typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
-typedef union sndrv_digital_audio snd_digital_audio_t;
-typedef struct sndrv_ctl_hw_info snd_ctl_hw_info_t;
-typedef struct sndrv_control_id snd_control_id_t;
-typedef struct sndrv_control_list snd_control_list_t;
-typedef struct sndrv_control_info snd_control_info_t;
-typedef struct sndrv_control snd_control_t;
-typedef struct sndrv_ctl_event snd_ctl_event_t;
+typedef struct _snd_ctl_info snd_ctl_info_t;
+typedef struct _snd_control_id snd_control_id_t;
+typedef struct _snd_control_list snd_control_list_t;
+typedef struct _snd_control_info snd_control_info_t;
+typedef struct _snd_control snd_control_t;
+typedef struct _snd_ctl_event snd_ctl_event_t;
#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_iface *snd_control_iface_t;
typedef struct __snd_ctl_event_type *snd_ctl_event_type_t;
#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_iface snd_control_iface_t;
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_BYTES ((snd_control_type_t) SNDRV_CONTROL_TYPE_BYTES)
#define SND_CONTROL_TYPE_IEC958 ((snd_control_type_t) SNDRV_CONTROL_TYPE_IEC958)
+#define SND_CONTROL_TYPE_LAST ((snd_control_type_t) SNDRV_CONTROL_TYPE_LAST)
#define SND_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_RAWMIDI ((snd_control_iface_t) SNDRV_CONTROL_IFACE_RAWMIDI)
#define SND_CONTROL_IFACE_TIMER ((snd_control_iface_t) SNDRV_CONTROL_IFACE_TIMER)
#define SND_CONTROL_IFACE_SEQUENCER ((snd_control_iface_t) SNDRV_CONTROL_IFACE_SEQUENCER)
+#define SND_CONTROL_IFACE_LAST ((snd_control_iface_t) SNDRV_CONTROL_IFACE_LAST)
#define SND_CTL_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_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_REMOVE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_REMOVE)
-
-#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
+#define SND_CTL_EVENT_LAST ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_LAST)
enum _snd_ctl_type {
SND_CTL_TYPE_HW,
#define SND_CTL_TYPE_INET ((snd_ctl_type_t) SND_CTL_TYPE_INET)
typedef struct _snd_ctl snd_ctl_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;
+typedef struct _snd_ctl_callbacks snd_ctl_callbacks_t;
#ifdef __cplusplus
extern "C" {
int snd_ctl_close(snd_ctl_t *handle);
int snd_ctl_card(snd_ctl_t *handle);
int snd_ctl_poll_descriptor(snd_ctl_t *handle);
-int snd_ctl_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_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_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
}
#endif
* 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 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
extern "C" {
#endif
-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_add_t)(snd_ctl_t *handle, void *private_data, snd_hcontrol_t *hcontrol);
+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_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);
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_hfind(snd_ctl_t *handle, snd_control_id_t *id);
int snd_ctl_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist);
int snd_ctl_hsort(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2);
-int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t *csort);
-int snd_ctl_hcallback_rebuild(snd_ctl_t *handle, snd_ctl_hcallback_rebuild_t *callback, void *private_data);
-int snd_ctl_hcallback_add(snd_ctl_t *handle, snd_ctl_hcallback_add_t *callback, void *private_data);
+int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t csort);
+int snd_ctl_hcallback_rebuild(snd_ctl_t *handle, snd_ctl_hcallback_rebuild_t callback, void *private_data);
+int snd_ctl_hcallback_add(snd_ctl_t *handle, snd_ctl_hcallback_add_t callback, void *private_data);
int snd_ctl_hevent(snd_ctl_t *handle);
int snd_ctl_hbag_create(void **bag);
int snd_ctl_hbag_add(void **bag, snd_hcontrol_t *hcontrol);
int snd_ctl_hbag_del(void **bag, snd_hcontrol_t *hcontrol);
snd_hcontrol_t *snd_ctl_hbag_find(void **bag, snd_control_id_t *id);
+int snd_hcontrol_list_alloc_space(snd_hcontrol_list_t *obj, unsigned int entries);
+void snd_hcontrol_list_free_space(snd_hcontrol_list_t *obj);
#ifdef __cplusplus
}
--- /dev/null
+#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
#define SND_BIG_ENDIAN SNDRV_BIG_ENDIAN
#endif
-//#define SND_ENUM_TYPECHECK
+#define SND_ENUM_TYPECHECK
#ifdef SND_ENUM_TYPECHECK
#define snd_enum_to_int(v) ((unsigned int)(unsigned long)(v))
#define snd_enum_incr(v) (++(v))
#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)
-
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
+#include <assert.h>
#include <sys/uio.h>
#ifndef ATTRIBUTE_UNUSED
#endif
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);
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);
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);
*
*/
+#ifndef __LOCAL_H
+#define __LOCAL_H
+
#define _snd_interval sndrv_interval
#define _snd_pcm_info sndrv_pcm_info
#define _snd_pcm_hw_params sndrv_pcm_hw_params
#define _snd_pcm_sw_params sndrv_pcm_sw_params
#define _snd_pcm_status sndrv_pcm_status
+#define _snd_ctl_info sndrv_ctl_info
+#define _snd_control_id sndrv_control_id
+#define _snd_control_list sndrv_control_list
+#define _snd_control_info sndrv_control_info
+#define _snd_control sndrv_control
+#define _snd_ctl_event sndrv_ctl_event
+
#define _snd_rawmidi_info sndrv_rawmidi_info
#define _snd_rawmidi_params sndrv_rawmidi_params
#define _snd_rawmidi_status sndrv_rawmidi_status
#define _snd_hwdep_info sndrv_hwdep_info
#include "asoundlib.h"
+#include <errno.h>
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#define ERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__)
#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, ##args)
#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
#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_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_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_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_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_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_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_FORMAT_UNKNOWN ((snd_pcm_format_t) -1)
#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_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_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_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_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_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_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_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_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_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_MMAP ((snd_pcm_tstamp_t) SNDRV_PCM_TSTAMP_MMAP)
#define SND_PCM_TSTAMP_LAST ((snd_pcm_tstamp_t) SNDRV_PCM_TSTAMP_LAST)
extern "C" {
#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_type_t snd_pcm_type(snd_pcm_t *pcm);
unsigned int *rate_num,
unsigned int *rate_den);
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_dump(snd_pcm_hw_params_t *params, snd_output_t *out);
#endif
+
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);
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_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
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);
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_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
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);
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_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
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);
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);
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_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);
-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_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);
-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_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_min(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_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_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_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_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, 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_min(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, 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_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_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_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_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_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_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_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, 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_min(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, 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_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_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_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_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_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_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_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(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, unsigned int *val, int *dir);
+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_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);
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_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_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_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_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_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(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_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);
+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_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);
-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_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);
-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_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_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_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_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, 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_min(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, 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_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);
-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_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);
-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_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_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_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_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(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, unsigned int *val, int *dir);
+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_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);
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_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_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_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_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_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(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_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);
+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_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);
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_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_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_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_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_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(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, unsigned int *val, int *dir);
+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_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);
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);
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);
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);
+size_t snd_pcm_status_sizeof();
+#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);
+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);
+
+snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj);
+
+void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
+
+void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
+
+snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj);
+
+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);
+
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;})
+#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);
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_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_name(const snd_pcm_info_t *obj);
-const char * snd_pcm_info_get_subdevice_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);
void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val);
-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;})
-int snd_pcm_status_malloc(snd_pcm_status_t **ptr);
-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);
-
-snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj);
-
-void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
-
-void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
-
-snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj);
-
-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);
-
#ifdef __cplusplus
}
#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_LAST ((snd_rawmidi_stream_t) SNDRV_RAWMIDI_STREAM_LAST)
#define SND_RAWMIDI_INFO_OUTPUT SNDRV_RAWMIDI_INFO_OUTPUT
#define SND_RAWMIDI_INFO_INPUT SNDRV_RAWMIDI_INFO_INPUT
#endif
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);
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);
int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
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);
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);
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);
void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
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);
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);
#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_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_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_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_RTC SNDRV_TIMER_GLOBAL_RTC
*
*/
-#include <assert.h>
-#include <errno.h>
#include <stdarg.h>
#include <sys/stat.h>
#include "local.h"
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_foreach(i, config) {
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)
{
char *id1;
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);
}
-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);
}
-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);
}
-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 err;
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);
if (config->type != SND_CONFIG_TYPE_STRING)
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)
{
assert(config && ptr);
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);
if (config->type != SND_CONFIG_TYPE_STRING)
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)
{
unsigned char *p = str;
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);
while (1) {
snd_config_t *n;
int err;
- char *p = strchr(key, '.');
+ const char *p = strchr(key, '.');
if (config->type != SND_CONFIG_TYPE_COMPOUND)
return -ENOENT;
if (p) {
assert(config && result);
va_start(arg, result);
while (1) {
- char *k = va_arg(arg, char *);
+ const char *k = va_arg(arg, const char *);
int err;
if (!k)
break;
EXTRA_LTLIBRARIES = libcontrol.la
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
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <assert.h>
#define __USE_GNU
#include <search.h>
#include "control_local.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/ioctl.h>
{
int card;
snd_ctl_t *handle;
- snd_ctl_hw_info_t info;
+ snd_ctl_info_t info;
if (!string || *string == '\0')
return -EINVAL;
continue;
if (snd_ctl_hw_open(&handle, NULL, card) < 0)
continue;
- if (snd_ctl_hw_info(handle, &info) < 0) {
+ if (snd_ctl_info(handle, &info) < 0) {
snd_ctl_close(handle);
continue;
}
int snd_card_get_name(int card, char **name)
{
snd_ctl_t *handle;
- snd_ctl_hw_info_t info;
+ snd_ctl_info_t info;
int err;
if (name == NULL)
return -EINVAL;
if ((err = snd_ctl_hw_open(&handle, NULL, card)) < 0)
return err;
- if ((err = snd_ctl_hw_info(handle, &info)) < 0) {
+ if ((err = snd_ctl_info(handle, &info)) < 0) {
snd_ctl_close(handle);
return err;
}
int snd_card_get_longname(int card, char **name)
{
snd_ctl_t *handle;
- snd_ctl_hw_info_t info;
+ snd_ctl_info_t info;
int err;
if (name == NULL)
return -EINVAL;
if ((err = snd_ctl_hw_open(&handle, NULL, card)) < 0)
return err;
- if ((err = snd_ctl_hw_info(handle, &info)) < 0) {
+ if ((err = snd_ctl_info(handle, &info)) < 0) {
snd_ctl_close(handle);
return err;
}
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
-#include <assert.h>
#include <dlfcn.h>
#include "control_local.h"
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);
return ctl->ops->hw_info(ctl, info);
int snd_ctl_open(snd_ctl_t **ctlp, char *name)
{
- char *str;
+ const char *str;
int err;
snd_config_t *ctl_conf, *conf, *type_conf;
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);
void *h;
assert(ctlp && name);
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;
+}
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <assert.h>
#include "control_local.h"
#define SNDRV_FILE_CONTROL "/dev/snd/controlC%i"
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;
- if (ioctl(hw->fd, SNDRV_CTL_IOCTL_HW_INFO, info) < 0)
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_INFO, info) < 0)
return -errno;
return 0;
}
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;
char filename[32];
{
snd_config_iterator_t i;
long card = -1;
- char *str;
+ const char *str;
int err;
snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i);
*
*/
-#include <assert.h>
#include "local.h"
#include "list.h"
-typedef struct {
+typedef struct _snd_ctl_ops {
int (*close)(snd_ctl_t *handle);
int (*poll_descriptor)(snd_ctl_t *handle);
- int (*hw_info)(snd_ctl_t *handle, snd_ctl_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 (*cinfo)(snd_ctl_t *handle, snd_control_info_t *info);
int (*cread)(snd_ctl_t *handle, snd_control_t *control);
struct list_head hlist; /* list of all controls */
void *hroot; /* root of controls */
void *hroot_new; /* new croot */
- snd_ctl_hsort_t *hsort;
- snd_ctl_hcallback_rebuild_t *callback_rebuild;
+ snd_ctl_hsort_t hsort;
+ snd_ctl_hcallback_rebuild_t callback_rebuild;
void *callback_rebuild_private_data;
- snd_ctl_hcallback_add_t *callback_add;
+ snd_ctl_hcallback_add_t callback_add;
void *callback_add_private_data;
};
-int snd_ctl_hw_open(snd_ctl_t **handle, char *name, int card);
-int snd_ctl_shm_open(snd_ctl_t **handlep, char *name, char *socket, char *sname);
+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!!! */
+};
+
+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);
--- /dev/null
+/*
+ * 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;
+}
+
#include <stddef.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/shm.h>
#include <sys/socket.h>
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;
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
int err;
// ctrl->u.hw_info = *info;
- ctrl->cmd = SNDRV_CTL_IOCTL_HW_INFO;
+ ctrl->cmd = SNDRV_CTL_IOCTL_INFO;
err = snd_ctl_shm_action(ctl);
if (err < 0)
return err;
snd_ctl_shm_t *shm = ctl->private;
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
size_t maxsize = CTL_SHM_DATA_MAXLEN;
- size_t bytes = list->controls_request * sizeof(*list->pids);
+ size_t bytes = list->space * sizeof(*list->pids);
int err;
snd_control_id_t *pids = list->pids;
if (bytes > maxsize)
return err;
*list = ctrl->u.clist;
list->pids = pids;
+ bytes = list->used * sizeof(*list->pids);
memcpy(pids, (void *)ctrl->data, bytes);
return err;
}
}
#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_shm_t *shm = NULL;
int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf)
{
snd_config_iterator_t i;
- char *server = NULL;
- char *sname = NULL;
+ const char *server = NULL;
+ const char *sname = NULL;
snd_config_t *sconfig;
- char *host = NULL;
- char *socket = NULL;
+ const char *host = NULL;
+ const char *socket = NULL;
long port = -1;
int err;
int local;
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <assert.h>
#define __USE_GNU
#include <search.h>
#include "control_local.h"
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_hcontrol_t *hcontrol, *prev;
do {
if (list.pids != NULL)
free(list.pids);
- list.controls_offset = 0;
- list.controls_request = 0;
- list.controls_count = 0;
+ list.offset = 0;
+ list.space = 0;
if ((err = snd_ctl_clist(handle, &list)) < 0)
return err;
- if (list.controls == 0)
+ if (list.count == 0)
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)
return -ENOMEM;
- list.controls_request = list.controls;
+ list.space = list.count;
if ((err = snd_ctl_clist(handle, &list)) < 0)
return err;
- } while (list.controls != list.controls_count);
- for (idx = 0, prev = NULL; idx < list.controls_count; idx++) {
+ } while (list.count != list.used);
+ for (idx = 0, prev = NULL; idx < list.count; idx++) {
hcontrol = (snd_hcontrol_t *)calloc(1, sizeof(snd_hcontrol_t));
if (hcontrol == NULL)
goto __nomem;
handle = hcontrol->handle;
assert(handle != NULL);
assert(handle->hcount > 0);
- if (hcontrol->event_remove)
- hcontrol->event_remove(handle, hcontrol);
+ if (hcontrol->callback_remove)
+ hcontrol->callback_remove(handle, hcontrol);
if (hcontrol->private_free)
- hcontrol->private_free(hcontrol->private_data);
+ hcontrol->private_free(hcontrol);
list_del(&hcontrol->list);
free(hcontrol);
handle->hcount--;
/* 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;
snd_hcontrol_t *hcontrol;
unsigned int idx;
assert(hlist != NULL);
- if (hlist->controls_offset >= (unsigned int)handle->hcount)
+ if (hlist->offset >= (unsigned int)handle->hcount)
return -EINVAL;
- hlist->controls_count = 0;
- hlist->controls = handle->hcount;
- if (hlist->controls_request > 0) {
+ hlist->used = 0;
+ hlist->count = handle->hcount;
+ if (hlist->space > 0) {
if (hlist->pids == NULL)
return -EINVAL;
idx = 0;
list_for_each(list, &handle->hlist) {
hcontrol = list_entry(list, snd_hcontrol_t, list);
- if (idx >= hlist->controls_offset + hlist->controls_request)
+ if (idx >= hlist->offset + hlist->space)
break;
- if (idx >= hlist->controls_offset) {
+ if (idx >= hlist->offset) {
hlist->pids[idx] = hcontrol->id;
- hlist->controls_count++;
+ hlist->used++;
}
idx++;
}
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);
handle->callback_rebuild = callback;
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);
handle->callback_add = callback;
return handle->herr;
list_for_each(list, &handle->hlist) {
hcontrol = list_entry(list, snd_hcontrol_t, list);
- if (hcontrol->change && hcontrol->event_change) {
- hcontrol->event_change(hcontrol->handle, hcontrol);
+ if (hcontrol->change && hcontrol->callback_change) {
+ hcontrol->callback_change(hcontrol->handle, hcontrol);
hcontrol->change = 0;
}
- if (hcontrol->value && hcontrol->event_value) {
- hcontrol->event_value(hcontrol->handle, hcontrol);
+ if (hcontrol->value && hcontrol->callback_value) {
+ hcontrol->callback_value(hcontrol->handle, hcontrol);
hcontrol->value = 0;
}
}
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;
+}
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
#include "local.h"
static int defaults_card(const char *env)
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "local.h"
*
*/
-#include <errno.h>
-#include <assert.h>
#include "local.h"
size_t snd_hwdep_info_sizeof()
int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr)
{
assert(ptr);
- *ptr = malloc(sizeof(snd_hwdep_info_t));
+ *ptr = calloc(1, sizeof(snd_hwdep_info_t));
if (!*ptr)
return -ENOMEM;
return 0;
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);
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);
return obj->name;
*
*/
-#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include "local.h"
typedef struct _snd_input_ops {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
#include <sys/stat.h>
#include <stdio.h>
#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
#include <sys/stat.h>
#include <stdio.h>
#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
#include <sys/stat.h>
#include <stdio.h>
#include "local.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "mixer_local.h"
*
*/
-#include <assert.h>
#include "local.h"
#include "list.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
+#include "../control/control_local.h"
#include "mixer_local.h"
static struct mixer_name_table {
static void hcontrol_add(snd_mixer_t *handle, void **bag, snd_hcontrol_t *hcontrol)
{
snd_ctl_hbag_add(bag, hcontrol);
- hcontrol->event_change = hcontrol_event_change;
- hcontrol->event_value = hcontrol_event_value;
- hcontrol->event_remove = hcontrol_event_remove;
+ hcontrol->callback_change = hcontrol_event_change;
+ hcontrol->callback_value = hcontrol_event_value;
+ hcontrol->callback_remove = hcontrol_event_remove;
hcontrol->private_data = handle;
}
return err;
if (global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN ||
global_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
- if (voices < global_info.values_count)
- voices = global_info.values_count;
+ if (voices < global_info.count)
+ voices = global_info.count;
caps |= global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN ? SND_MIXER_SCTCAP_MUTE : SND_MIXER_SCTCAP_VOLUME;
present |= global_info.type == SNDRV_CONTROL_TYPE_BOOLEAN ? MIXER_PRESENT_SINGLE_SWITCH : MIXER_PRESENT_SINGLE_VOLUME;
if (global_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
if ((err = get_mixer_info(handle, str, index, &gswitch_info)) < 0)
return err;
if (gswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) {
- if (voices < gswitch_info.values_count)
- voices = gswitch_info.values_count;
+ if (voices < gswitch_info.count)
+ voices = gswitch_info.count;
caps |= SND_MIXER_SCTCAP_MUTE;
present |= MIXER_PRESENT_GLOBAL_SWITCH;
hcontrol_add(handle, &bag, hcontrol);
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &groute_info)) < 0)
return err;
- if (groute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && groute_info.values_count == 4) {
+ if (groute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && groute_info.count == 4) {
if (voices < 2)
voices = 2;
caps |= SND_MIXER_SCTCAP_MUTE;
if ((err = get_mixer_info(handle, str, index, &gvolume_info)) < 0)
return err;
if (gvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
- if (voices < gvolume_info.values_count)
- voices = gvolume_info.values_count;
+ if (voices < gvolume_info.count)
+ voices = gvolume_info.count;
if (min > gvolume_info.value.integer.min)
min = gvolume_info.value.integer.min;
if (max < gvolume_info.value.integer.max)
if ((err = get_mixer_info(handle, str, index, &pswitch_info)) < 0)
return err;
if (pswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) {
- if (voices < pswitch_info.values_count)
- voices = pswitch_info.values_count;
+ if (voices < pswitch_info.count)
+ voices = pswitch_info.count;
caps |= SND_MIXER_SCTCAP_MUTE;
present |= MIXER_PRESENT_PLAYBACK_SWITCH;
hcontrol_add(handle, &bag, hcontrol);
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &proute_info)) < 0)
return err;
- if (proute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && proute_info.values_count == 4) {
+ if (proute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && proute_info.count == 4) {
if (voices < 2)
voices = 2;
caps |= SND_MIXER_SCTCAP_MUTE;
if ((err = get_mixer_info(handle, str, index, &cswitch_info)) < 0)
return err;
if (cswitch_info.type == SNDRV_CONTROL_TYPE_BOOLEAN) {
- if (voices < cswitch_info.values_count)
- voices = cswitch_info.values_count;
+ if (voices < cswitch_info.count)
+ voices = cswitch_info.count;
caps |= SND_MIXER_SCTCAP_CAPTURE;
present |= MIXER_PRESENT_CAPTURE_SWITCH;
hcontrol_add(handle, &bag, hcontrol);
if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
if ((err = get_mixer_info(handle, str, index, &croute_info)) < 0)
return err;
- if (croute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && croute_info.values_count == 4) {
+ if (croute_info.type == SNDRV_CONTROL_TYPE_BOOLEAN && croute_info.count == 4) {
if (voices < 2)
voices = 2;
caps |= SND_MIXER_SCTCAP_CAPTURE;
if ((err = get_mixer_info(handle, str, index, &pvolume_info)) < 0)
return err;
if (pvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
- if (voices < pvolume_info.values_count)
- voices = pvolume_info.values_count;
+ if (voices < pvolume_info.count)
+ voices = pvolume_info.count;
if (min > pvolume_info.value.integer.min)
min = pvolume_info.value.integer.min;
if (max < pvolume_info.value.integer.max)
if ((err = get_mixer_info(handle, str, index, &cvolume_info)) < 0)
return err;
if (cvolume_info.type == SNDRV_CONTROL_TYPE_INTEGER) {
- if (voices < cvolume_info.values_count)
- voices = cvolume_info.values_count;
+ if (voices < cvolume_info.count)
+ voices = cvolume_info.count;
if (min > pvolume_info.value.integer.min)
min = pvolume_info.value.integer.min;
if (max < pvolume_info.value.integer.max)
if (csource_info.type == SNDRV_CONTROL_TYPE_ENUMERATED) {
capture_item = 0;
if (!strcmp(csource_info.value.enumerated.name, str)) {
- if (voices < csource_info.values_count)
- voices = csource_info.values_count;
+ if (voices < csource_info.count)
+ voices = csource_info.count;
caps |= SND_MIXER_SCTCAP_CAPTURE;
present |= MIXER_PRESENT_CAPTURE_SOURCE;
hcontrol_add(handle, &bag, hcontrol);
if ((err = snd_ctl_cinfo(handle->ctl_handle, &csource_info)) < 0)
return err;
if (!strcmp(csource_info.value.enumerated.name, str)) {
- if (voices < csource_info.values_count)
- voices = csource_info.values_count;
+ if (voices < csource_info.count)
+ voices = csource_info.count;
caps |= SND_MIXER_SCTCAP_CAPTURE;
present |= MIXER_PRESENT_CAPTURE_SOURCE;
hcontrol_add(handle, &bag, hcontrol);
if (present & (MIXER_PRESENT_SINGLE_VOLUME|MIXER_PRESENT_GLOBAL_VOLUME|MIXER_PRESENT_PLAYBACK_VOLUME|MIXER_PRESENT_CAPTURE_VOLUME))
caps |= SND_MIXER_SCTCAP_JOINTLY_VOLUME;
if (present & MIXER_PRESENT_SINGLE_SWITCH) {
- if (global_info.values_count > 1)
+ if (global_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE;
}
if (present & MIXER_PRESENT_GLOBAL_SWITCH) {
- if (gswitch_info.values_count > 1)
+ if (gswitch_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE;
}
if (present & MIXER_PRESENT_PLAYBACK_SWITCH) {
- if (pswitch_info.values_count > 1)
+ if (pswitch_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE;
}
if (present & (MIXER_PRESENT_GLOBAL_ROUTE | MIXER_PRESENT_PLAYBACK_ROUTE))
caps &= ~SND_MIXER_SCTCAP_JOINTLY_MUTE;
if (present & MIXER_PRESENT_CAPTURE_SWITCH) {
- if (cswitch_info.values_count > 1)
+ if (cswitch_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_CAPTURE;
}
if (present & MIXER_PRESENT_CAPTURE_ROUTE)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_CAPTURE;
if (present & MIXER_PRESENT_SINGLE_VOLUME) {
- if (global_info.values_count > 1)
+ if (global_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME;
}
if (present & MIXER_PRESENT_GLOBAL_VOLUME) {
- if (gvolume_info.values_count > 1)
+ if (gvolume_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME;
}
if (present & MIXER_PRESENT_PLAYBACK_VOLUME) {
- if (pvolume_info.values_count > 1)
+ if (pvolume_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME;
}
if (present & MIXER_PRESENT_CAPTURE_VOLUME) {
- if (cvolume_info.values_count > 1)
+ if (cvolume_info.count > 1)
caps &= ~SND_MIXER_SCTCAP_JOINTLY_VOLUME;
}
}
return -ENOMEM;
}
simple->present = present;
- simple->global_values = global_info.values_count;
- simple->gswitch_values = gswitch_info.values_count;
- simple->pswitch_values = pswitch_info.values_count;
- simple->cswitch_values = cswitch_info.values_count;
- simple->gvolume_values = gvolume_info.values_count;
- simple->pvolume_values = pvolume_info.values_count;
- simple->cvolume_values = cvolume_info.values_count;
+ simple->global_values = global_info.count;
+ simple->gswitch_values = gswitch_info.count;
+ simple->pswitch_values = pswitch_info.count;
+ simple->cswitch_values = cswitch_info.count;
+ simple->gvolume_values = gvolume_info.count;
+ simple->pvolume_values = pvolume_info.count;
+ simple->cvolume_values = cvolume_info.count;
simple->groute_values = 2;
simple->proute_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->caps = caps;
simple->voices = voices;
*
*/
-#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include "local.h"
typedef struct _snd_output_ops {
#include <sys/types.h>
#include <limits.h>
-#include <errno.h>
-#include <assert.h>
#include "pcm_local.h"
static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
#include <sys/types.h>
#include <limits.h>
-#include <errno.h>
-#include <assert.h>
#include "pcm_local.h"
*/
#include <sys/types.h>
-#include <assert.h>
#ifdef SND_MASK_C
#define MASK_INLINE inline
#include <stdio.h>
#include <string.h>
#include <malloc.h>
-#include <errno.h>
#include <stdarg.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#define FORMATD(v, d) [SND_PCM_FORMAT_##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(CAPTURE),
};
-char *snd_pcm_state_names[] = {
+const char *snd_pcm_state_names[] = {
STATE(OPEN),
STATE(SETUP),
STATE(PREPARED),
STATE(PAUSED),
};
-char *snd_pcm_hw_param_names[] = {
+const char *snd_pcm_hw_param_names[] = {
HW_PARAM(ACCESS),
HW_PARAM(FORMAT),
HW_PARAM(SUBFORMAT),
HW_PARAM(TICK_TIME),
};
-char *snd_pcm_access_names[] = {
+const char *snd_pcm_access_names[] = {
ACCESS(MMAP_INTERLEAVED),
ACCESS(MMAP_NONINTERLEAVED),
ACCESS(MMAP_COMPLEX),
ACCESS(RW_NONINTERLEAVED),
};
-char *snd_pcm_format_names[] = {
+const char *snd_pcm_format_names[] = {
FORMAT(S8),
FORMAT(U8),
FORMAT(S16_LE),
FORMAT(SPECIAL),
};
-char *snd_pcm_format_descriptions[] = {
+const char *snd_pcm_format_descriptions[] = {
FORMATD(S8, "Signed 8-bit"),
FORMATD(U8, "Unsigned 8-bit"),
FORMATD(S16_LE, "Signed 16-bit Little Endian"),
FORMATD(SPECIAL, "Special"),
};
-char *snd_pcm_subformat_names[] = {
+const char *snd_pcm_subformat_names[] = {
SUBFORMAT(STD),
};
-char *snd_pcm_subformat_descriptions[] = {
+const char *snd_pcm_subformat_descriptions[] = {
SUBFORMATD(STD, "Standard"),
};
-char *snd_pcm_start_mode_names[] = {
+const char *snd_pcm_start_mode_names[] = {
START(EXPLICIT),
START(DATA),
};
-char *snd_pcm_xrun_mode_names[] = {
+const char *snd_pcm_xrun_mode_names[] = {
XRUN(NONE),
XRUN(STOP),
};
-char *snd_pcm_tstamp_mode_names[] = {
+const char *snd_pcm_tstamp_mode_names[] = {
TSTAMP(NONE),
TSTAMP(MMAP),
};
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)
{
- char *str;
+ const char *str;
int err;
snd_config_t *pcm_conf, *conf, *type_conf;
snd_config_iterator_t i;
- char *lib = NULL, *open = NULL;
- int (*open_func)(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
+ const char *lib = NULL, *open = NULL;
+ int (*open_func)(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
void *h;
assert(pcmp && name);
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
continue;
}
if (strcmp(n->id, "sformat") == 0) {
- char *f;
+ const char *f;
err = snd_config_string_get(n, &f);
if (err < 0) {
ERR("Invalid type for %s", n->id);
if (!sname)
return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode);
- free(sname);
+ free((void *) sname);
if (err < 0)
return err;
err = snd_pcm_adpcm_open(pcmp, name, sformat, spcm, 1);
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
continue;
}
if (strcmp(n->id, "sformat") == 0) {
- char *f;
+ const char *f;
err = snd_config_string_get(n, &f);
if (err < 0) {
ERR("Invalid type for %s", n->id);
if (!sname)
return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode);
- free(sname);
+ free((void *) sname);
if (err < 0)
return err;
err = snd_pcm_alaw_open(pcmp, name, sformat, spcm, 1);
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_config_foreach(i, conf) {
if (!sname)
return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode);
- free(sname);
+ free((void *) sname);
if (err < 0)
return err;
err = snd_pcm_copy_open(pcmp, name, spcm, 1);
typedef struct {
snd_pcm_t *slave;
int close_slave;
- char *fname;
+ const char *fname;
int fd;
int format;
snd_pcm_uframes_t appl_ptr;
if (file->close_slave)
err = snd_pcm_close(file->slave);
if (file->fname) {
- free(file->fname);
+ free((void *)file->fname);
close(file->fd);
}
free(file);
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_file_t *file;
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
int err;
snd_pcm_t *spcm;
- char *fname = NULL;
- char *format = NULL;
+ const char *fname = NULL;
+ const char *format = NULL;
long fd = -1;
snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i);
if (!sname)
return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode);
- free(sname);
+ free((void *) sname);
if (err < 0)
return err;
err = snd_pcm_file_open(pcmp, name, fname, fd, format, spcm, 1);
#include <unistd.h>
#include <signal.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
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);
if (err < 0)
{
snd_config_iterator_t i;
long card = -1, device = 0, subdevice = -1;
- char *str;
+ const char *str;
int err;
snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i);
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
continue;
}
if (strcmp(n->id, "sformat") == 0) {
- char *f;
+ const char *f;
err = snd_config_string_get(n, &f);
if (err < 0) {
ERR("Invalid type for %s", n->id);
if (!sname)
return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode);
- free(sname);
+ free((void *) sname);
if (err < 0)
return err;
err = snd_pcm_linear_open(pcmp, name, sformat, spcm, 1);
*
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/uio.h>
-#include <errno.h>
#define _snd_pcm_access_mask _snd_mask
#define _snd_pcm_format_mask _snd_mask
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_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_shm_open(snd_pcm_t **pcmp, char *name, char *socket, 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_null_open(snd_pcm_t **pcmp, char *name, 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, 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, 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, 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, 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);
#include "pcm_local.h"
+
size_t snd_pcm_access_mask_sizeof()
{
return sizeof(snd_pcm_access_mask_t);
int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr)
{
assert(ptr);
- *ptr = malloc(sizeof(snd_pcm_access_mask_t));
+ *ptr = calloc(1, sizeof(snd_pcm_access_mask_t));
if (!*ptr)
return -ENOMEM;
return 0;
int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr)
{
assert(ptr);
- *ptr = malloc(sizeof(snd_pcm_format_mask_t));
+ *ptr = calloc(1, sizeof(snd_pcm_format_mask_t));
if (!*ptr)
return -ENOMEM;
return 0;
int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr)
{
assert(ptr);
- *ptr = malloc(sizeof(snd_pcm_subformat_mask_t));
+ *ptr = calloc(1, sizeof(snd_pcm_subformat_mask_t));
if (!*ptr)
return -ENOMEM;
return 0;
int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr)
{
assert(ptr);
- *ptr = malloc(sizeof(snd_pcm_hw_params_t));
+ *ptr = calloc(1, sizeof(snd_pcm_hw_params_t));
if (!*ptr)
return -ENOMEM;
return 0;
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)
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);
}
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, 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, mode, SND_PCM_HW_PARAM_FORMAT, snd_enum_to_int(val), 0);
+ 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)
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)
{
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)
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);
}
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)
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, SND_TEST, SND_PCM_HW_PARAM_RATE, val, 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(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_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_min(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_min(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_max(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_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, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
+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, mode, SND_PCM_HW_PARAM_RATE, min, mindir, max, 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)
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)
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;
- 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;
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;
- 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;
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 _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;
*max = _max;
return err;
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);
}
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, SND_TEST, SND_PCM_HW_PARAM_PERIODS, val, 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(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_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_min(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_min(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_max(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_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, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
+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, mode, SND_PCM_HW_PARAM_PERIODS, min, mindir, max, 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)
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);
}
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)
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;
- 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;
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;
- 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;
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 _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;
*max = _max;
return err;
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)
int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr)
{
assert(ptr);
- *ptr = malloc(sizeof(snd_pcm_sw_params_t));
+ *ptr = calloc(1, sizeof(snd_pcm_sw_params_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
+size_t snd_pcm_status_sizeof()
+{
+ return sizeof(snd_pcm_status_t);
+}
+
+int snd_pcm_status_malloc(snd_pcm_status_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_pcm_status_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+void snd_pcm_status_free(snd_pcm_status_t *obj)
+{
+ free(obj);
+}
+
+void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj)
+{
+ assert(obj);
+ return snd_int_to_enum(obj->state);
+}
+
+void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr)
+{
+ assert(obj && ptr);
+ *ptr = obj->trigger_tstamp;
+}
+
+void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr)
+{
+ assert(obj && ptr);
+ *ptr = obj->tstamp;
+}
+
+snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj)
+{
+ assert(obj);
+ return obj->delay;
+}
+
+snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj)
+{
+ assert(obj);
+ return obj->avail;
+}
+
+snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj)
+{
+ assert(obj);
+ 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 = malloc(sizeof(snd_pcm_info_t));
+ *ptr = calloc(1, sizeof(snd_pcm_info_t));
if (!*ptr)
return -ENOMEM;
return 0;
return obj->card;
}
-const char * snd_pcm_info_get_id(const snd_pcm_info_t *obj)
+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)
+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)
+const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj)
{
assert(obj);
return obj->subname;
obj->stream = snd_enum_to_int(val);
}
-size_t snd_pcm_status_sizeof()
-{
- return sizeof(snd_pcm_status_t);
-}
-
-int snd_pcm_status_malloc(snd_pcm_status_t **ptr)
-{
- assert(ptr);
- *ptr = malloc(sizeof(snd_pcm_status_t));
- if (!*ptr)
- return -ENOMEM;
- return 0;
-}
-
-void snd_pcm_status_free(snd_pcm_status_t *obj)
-{
- free(obj);
-}
-
-void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src)
-{
- assert(dst && src);
- *dst = *src;
-}
-
-snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj)
-{
- assert(obj);
- return snd_int_to_enum(obj->state);
-}
-
-void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr)
-{
- assert(obj && ptr);
- *ptr = obj->trigger_tstamp;
-}
-
-void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr)
-{
- assert(obj && ptr);
- *ptr = obj->tstamp;
-}
-
-snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj)
-{
- assert(obj);
- return obj->delay;
-}
-
-snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj)
-{
- assert(obj);
- return obj->avail;
-}
-
-snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj)
-{
- assert(obj);
- return obj->avail_max;
-}
-
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <byteswap.h>
#include "pcm_local.h"
#endif
#include <stdio.h>
#include <malloc.h>
#include <string.h>
-#include <errno.h>
#include <sys/poll.h>
#include <sys/mman.h>
#include <sys/shm.h>
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
continue;
}
if (strcmp(n->id, "sformat") == 0) {
- char *f;
+ const char *f;
err = snd_config_string_get(n, &f);
if (err < 0) {
ERR("Invalid type for %s", n->id);
if (!sname)
return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode);
- free(sname);
+ free((void *) sname);
if (err < 0)
return err;
err = snd_pcm_mulaw_open(pcmp, name, sformat, spcm, 1);
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <math.h>
#include "pcm_local.h"
idx = 0;
snd_config_foreach(i, slave) {
snd_config_t *m = snd_config_entry(i);
- char *name = NULL;
+ const char *name = NULL;
long channels = -1;
slaves_id[idx] = m->id;
snd_config_foreach(j, m) {
long schannel = -1;
int slave = -1;
long val;
- char *str;
+ const char *str;
cchannel = strtol(m->id, 0, 10);
if (cchannel < 0) {
ERR("Invalid channel number: %s", m->id);
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_null_t *null;
min = snd_pcm_hw_param_get_min(src, var, &mindir);
max = snd_pcm_hw_param_get_max(src, var, &maxdir);
snd_pcm_hw_param_set_near_minmax(pcm, params, var,
- min, &mindir, max, &maxdir);
+ min, &mindir, max, &maxdir);
}
/* ---- end of refinement functions ---- */
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 */
int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
{
if (!(clt_params.format == slv_params.format &&
clt_params.channels == slv_params.channels &&
clt_params.rate == slv_params.rate &&
- snd_pcm_hw_params_set_access(slave, &sparams, SND_TEST,
- clt_params.access) >= 0)) {
+ snd_pcm_hw_params_test_access(slave, &sparams,
+ clt_params.access) >= 0)) {
slv_params.access = snd_pcm_hw_params_set_access_first(slave, &sparams);
err = snd_pcm_plug_insert_plugins(pcm, &clt_params, &slv_params);
if (err < 0)
};
int snd_pcm_plug_open(snd_pcm_t **pcmp,
- char *name,
+ const char *name,
snd_pcm_route_ttable_entry_t *ttable,
unsigned int tt_ssize,
unsigned int tt_cused, unsigned int tt_sused,
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;
int err;
#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_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_config_t *tt = NULL;
if (!sname)
return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode);
- free(sname);
+ free((void *) sname);
if (err < 0)
return err;
err = snd_pcm_plug_open(pcmp, name, ttable, MAX_CHANNELS, cused, sused, spcm, 1);
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
continue;
}
if (strcmp(n->id, "sformat") == 0) {
- char *f;
+ const char *f;
err = snd_config_string_get(n, &f);
if (err < 0) {
ERR("Invalid type for %s", n->id);
if (!sname)
return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode);
- free(sname);
+ free((void *) sname);
if (err < 0)
return err;
err = snd_pcm_rate_open(pcmp, name, sformat, srate, spcm, 1);
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
continue;
}
if (strcmp(n->id, "sformat") == 0) {
- char *f;
+ const char *f;
err = snd_config_string_get(n, &f);
if (err < 0) {
ERR("Invalid type for %s", n->id);
if (!sname)
return -ENOMEM;
err = snd_pcm_open(&spcm, sname, stream, mode);
- free(sname);
+ free((void *) sname);
if (err < 0)
return err;
err = snd_pcm_route_open(pcmp, name, sformat, schannels,
#include <unistd.h>
#include <string.h>
#include <signal.h>
-#include <errno.h>
#include <math.h>
#include <sys/socket.h>
#include <sys/poll.h>
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,
unsigned int schannels_count,
unsigned int channels_count, int *channels_map,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *sname = NULL;
+ const char *sname = NULL;
snd_config_t *binding = NULL;
int err;
unsigned int idx;
continue;
}
if (strcmp(n->id, "sformat") == 0) {
- char *f;
+ const char *f;
err = snd_config_string_get(n, &f);
if (err < 0) {
ERR("Invalid type for %s", n->id);
#include <limits.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/shm.h>
}
#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_shm_t *shm = NULL;
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i;
- char *server = NULL;
- char *sname = NULL;
+ const char *server = NULL;
+ const char *sname = NULL;
snd_config_t *sconfig;
- char *host = NULL;
- char *socket = NULL;
+ const char *host = NULL;
+ const char *socket = NULL;
long port = -1;
int err;
int local;
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <dlfcn.h>
#include <asm/page.h>
#include "rawmidi_local.h"
int snd_rawmidi_open(snd_rawmidi_t **rawmidip, char *name,
int streams, int mode)
{
- char *str;
+ const char *str;
int err;
snd_config_t *rawmidi_conf, *conf, *type_conf;
snd_config_iterator_t i;
snd_rawmidi_params_t params;
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 streams, int mode);
void *h;
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "../control/control_local.h"
{
snd_config_iterator_t i;
long card = -1, device = 0, subdevice = -1;
- char *str;
+ const char *str;
int err;
snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i);
*
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
-#include <errno.h>
#include "local.h"
typedef struct {
int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr)
{
assert(ptr);
- *ptr = malloc(sizeof(snd_rawmidi_params_t));
+ *ptr = calloc(1, sizeof(snd_rawmidi_params_t));
if (!*ptr)
return -ENOMEM;
return 0;
int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr)
{
assert(ptr);
- *ptr = malloc(sizeof(snd_rawmidi_info_t));
+ *ptr = calloc(1, sizeof(snd_rawmidi_info_t));
if (!*ptr)
return -ENOMEM;
return 0;
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);
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);
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);
return obj->subname;
int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr)
{
assert(ptr);
- *ptr = malloc(sizeof(snd_rawmidi_status_t));
+ *ptr = calloc(1, sizeof(snd_rawmidi_status_t));
if (!*ptr)
return -ENOMEM;
return 0;
int snd_seq_open(snd_seq_t **seqp, char *name,
int streams, int mode)
{
- char *str;
+ const char *str;
int err;
snd_config_t *seq_conf, *conf, *type_conf;
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 streams, int mode);
void *h;
#ifndef __SEQ_LOCAL_H
#define __SEQ_LOCAL_H
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
-#include <errno.h>
#include "local.h"
#define SND_SEQ_OBUF_SIZE (16*1024) /* default size */
*/
#include <malloc.h>
-#include <errno.h>
#include "local.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "seq_local.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "local.h"
{
int idx, idx1, cards, err;
snd_ctl_t *handle;
- snd_ctl_hw_info_t info;
+ snd_ctl_info_t info;
snd_pcm_info_t pcminfo;
snd_mixer_info_t mixerinfo;
snd_rawmidi_info_t rawmidiinfo;
printf("Open error: %s\n", snd_strerror(err));
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));
continue;
}
{
int idx, idx1, cards, err;
snd_ctl_t *handle;
- snd_ctl_hw_info_t info;
+ snd_ctl_info_t info;
cards = snd_cards();
printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
printf("Open error: %s\n", snd_strerror(err));
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));
continue;
}
{
snd_ctl_t *ctl_handle;
int cards, card, err, idx;
- snd_ctl_hw_info_t info;
+ snd_ctl_info_t info;
cards = snd_cards();
printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
printf("CTL open error: %s\n", snd_strerror(err));
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));
continue;
}