]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Control API encapsulation. Better names for kernel API. Simpler PCM hw_params API...
authorAbramo Bagnara <abramo@alsa-project.org>
Tue, 6 Feb 2001 23:48:10 +0000 (23:48 +0000)
committerAbramo Bagnara <abramo@alsa-project.org>
Tue, 6 Feb 2001 23:48:10 +0000 (23:48 +0000)
71 files changed:
aserver/aserver.c
include/Makefile.am
include/aserver.h
include/conf.h
include/control.h
include/control_m4.h [new file with mode: 0644]
include/global.h
include/header.h
include/hwdep_m4.h
include/local.h
include/pcm.h
include/pcm_m4.h
include/rawmidi.h
include/rawmidi_m4.h
include/timer.h
src/conf.c
src/control/Makefile.am
src/control/bag.c
src/control/cards.c
src/control/control.c
src/control/control_hw.c
src/control/control_local.h
src/control/control_m4.c [new file with mode: 0644]
src/control/control_shm.c
src/control/controls.c
src/control/defaults.c
src/hwdep/hwdep.c
src/hwdep/hwdep_m4.c
src/input.c
src/instr/fm.c
src/instr/iwffff.c
src/instr/simple.c
src/mixer/mixer.c
src/mixer/mixer_local.h
src/mixer/simple.c
src/output.c
src/pcm/interval.c
src/pcm/mask.c
src/pcm/mask_inline.h
src/pcm/pcm.c
src/pcm/pcm_adpcm.c
src/pcm/pcm_alaw.c
src/pcm/pcm_copy.c
src/pcm/pcm_file.c
src/pcm/pcm_hw.c
src/pcm/pcm_linear.c
src/pcm/pcm_local.h
src/pcm/pcm_m4.c
src/pcm/pcm_misc.c
src/pcm/pcm_mmap.c
src/pcm/pcm_mulaw.c
src/pcm/pcm_multi.c
src/pcm/pcm_null.c
src/pcm/pcm_params.c
src/pcm/pcm_plug.c
src/pcm/pcm_rate.c
src/pcm/pcm_route.c
src/pcm/pcm_share.c
src/pcm/pcm_shm.c
src/rawmidi/rawmidi.c
src/rawmidi/rawmidi_hw.c
src/rawmidi/rawmidi_local.h
src/rawmidi/rawmidi_m4.c
src/seq/seq.c
src/seq/seq_local.h
src/seq/seq_midi_event.c
src/seq/seqmid.c
src/timer/timer.c
test/control.c
test/mixer.c
test/switches.c

index f143c264cee838ffcc825097f9f88d40d140ea76..6f879824583697ee3bb9b0afc6d6476aa0ad623c 100644 (file)
 #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>
@@ -573,13 +571,13 @@ int ctl_shm_cmd(client_t *client)
        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;
                }
@@ -837,7 +835,7 @@ int inet_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
        return 0;
 }
 
-int server(char *sockname, int port)
+int server(const char *sockname, int port)
 {
        int err;
        unsigned int k;
@@ -939,8 +937,8 @@ int main(int argc, char **argv)
        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;
index e6fcfe2bdb1ecf033ed4e61fda09e952a37357c4..c0d741ca66c17577cbdc59d9ff64c7afdf9572db 100644 (file)
@@ -5,7 +5,7 @@ sysinclude_HEADERS = asoundlib.h
 #
 header_files=header.h version.h global.h input.h output.h error.h mixer.h \
             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
 
index de092bc6ad08003a048fe169fc507618786f2d95..2f7f523c4e681045a6e53da97386f7f35ce3f914 100644 (file)
@@ -89,7 +89,7 @@ typedef struct {
        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;
index 6e83042a92446b0d3d0d8654843c7d72bc46db14..178be798d09fbc0b4f99394dc8d8728c2b17323c 100644 (file)
@@ -1,4 +1,18 @@
 
+#define LIST_HEAD_IS_DEFINED
+struct list_head {
+        struct list_head *next, *prev;
+};        
+
+/**
+ * list_entry - get the struct for this entry
+ * @ptr:        the &struct list_head pointer.
+ * @type:       the type of the struct this is embedded in.
+ * @member:     the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+        ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
 enum _snd_config_type {
         SND_CONFIG_TYPE_INTEGER,
         SND_CONFIG_TYPE_REAL,
@@ -50,30 +64,27 @@ int snd_config_top(snd_config_t **config);
 int snd_config_load(snd_config_t *config, snd_input_t *in);
 int snd_config_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;
 
index f4c3fff505e6265275698066a46a9a2023431009..f629888dc0832acdab3062db5d41674670d52fd4 100644 (file)
@@ -6,21 +6,20 @@
  ****************************************************************************/
 
 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;
@@ -102,6 +101,7 @@ typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
 #define SND_CONTROL_TYPE_ENUMERATED ((snd_control_type_t) SNDRV_CONTROL_TYPE_ENUMERATED)
 #define SND_CONTROL_TYPE_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)
@@ -110,20 +110,14 @@ typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
 #define SND_CONTROL_IFACE_RAWMIDI ((snd_control_iface_t) SNDRV_CONTROL_IFACE_RAWMIDI)
 #define SND_CONTROL_IFACE_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,
@@ -142,16 +136,7 @@ typedef enum _snd_ctl_type snd_ctl_type_t;
 #define SND_CTL_TYPE_INET ((snd_ctl_type_t) SND_CTL_TYPE_INET)
 
 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" {
@@ -175,7 +160,7 @@ int snd_ctl_open(snd_ctl_t **handle, char *name);
 int snd_ctl_close(snd_ctl_t *handle);
 int snd_ctl_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);
@@ -191,6 +176,15 @@ int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *handle, int subdev);
 
 int snd_ctl_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks);
 
+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
@@ -199,57 +193,20 @@ int snd_ctl_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks);
  *  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);
@@ -259,9 +216,9 @@ int snd_ctl_hcount(snd_ctl_t *handle);
 snd_hcontrol_t *snd_ctl_hfind(snd_ctl_t *handle, snd_control_id_t *id);
 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);
@@ -269,6 +226,8 @@ int snd_ctl_hbag_destroy(void **bag, void (*hcontrol_free)(snd_hcontrol_t *hcont
 int snd_ctl_hbag_add(void **bag, snd_hcontrol_t *hcontrol);
 int snd_ctl_hbag_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
 }
diff --git a/include/control_m4.h b/include/control_m4.h
new file mode 100644 (file)
index 0000000..0e30d54
--- /dev/null
@@ -0,0 +1,284 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+size_t snd_control_id_sizeof();
+#define snd_control_id_alloca(ptr) ({ assert(ptr); *ptr = (snd_control_id_t *) alloca(snd_control_id_sizeof()); memset(*ptr, 0, snd_control_id_sizeof()); 0; })
+int snd_control_id_malloc(snd_control_id_t **ptr);
+void snd_control_id_free(snd_control_id_t *obj);
+void snd_control_id_copy(snd_control_id_t *dst, const snd_control_id_t *src);
+
+unsigned int snd_control_id_get_numid(const snd_control_id_t *obj);
+
+snd_control_iface_t snd_control_id_get_interface(const snd_control_id_t *obj);
+
+unsigned int snd_control_id_get_device(const snd_control_id_t *obj);
+
+unsigned int snd_control_id_get_subdevice(const snd_control_id_t *obj);
+
+const char *snd_control_id_get_name(const snd_control_id_t *obj);
+
+unsigned int snd_control_id_get_index(const snd_control_id_t *obj);
+
+void snd_control_id_set_numid(snd_control_id_t *obj, unsigned int val);
+
+void snd_control_id_set_interface(snd_control_id_t *obj, snd_control_iface_t val);
+
+void snd_control_id_set_device(snd_control_id_t *obj, unsigned int val);
+
+void snd_control_id_set_subdevice(snd_control_id_t *obj, unsigned int val);
+
+void snd_control_id_set_name(snd_control_id_t *obj, const char *val);
+
+void snd_control_id_set_index(snd_control_id_t *obj, unsigned int val);
+
+size_t snd_ctl_info_sizeof();
+#define snd_ctl_info_alloca(ptr) ({ assert(ptr); *ptr = (snd_ctl_info_t *) alloca(snd_ctl_info_sizeof()); memset(*ptr, 0, snd_ctl_info_sizeof()); 0; })
+int snd_ctl_info_malloc(snd_ctl_info_t **ptr);
+void snd_ctl_info_free(snd_ctl_info_t *obj);
+void snd_ctl_info_copy(snd_ctl_info_t *dst, const snd_ctl_info_t *src);
+
+int snd_ctl_info_get_card(const snd_ctl_info_t *obj);
+
+snd_card_type_t snd_ctl_info_get_type(const snd_ctl_info_t *obj);
+
+const char *snd_ctl_info_get_id(const snd_ctl_info_t *obj);
+
+const char *snd_ctl_info_get_abbreviation(const snd_ctl_info_t *obj);
+
+const char *snd_ctl_info_get_name(const snd_ctl_info_t *obj);
+
+const char *snd_ctl_info_get_longname(const snd_ctl_info_t *obj);
+
+const char *snd_ctl_info_get_mixerid(const snd_ctl_info_t *obj);
+
+const char *snd_ctl_info_get_mixername(const snd_ctl_info_t *obj);
+
+size_t snd_ctl_event_sizeof();
+#define snd_ctl_event_alloca(ptr) ({ assert(ptr); *ptr = (snd_ctl_event_t *) alloca(snd_ctl_event_sizeof()); memset(*ptr, 0, snd_ctl_event_sizeof()); 0; })
+int snd_ctl_event_malloc(snd_ctl_event_t **ptr);
+void snd_ctl_event_free(snd_ctl_event_t *obj);
+void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src);
+
+snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj);
+
+unsigned int snd_ctl_event_get_numid(const snd_ctl_event_t *obj);
+
+void snd_ctl_event_get_id(const snd_ctl_event_t *obj, snd_control_id_t *ptr);
+
+snd_control_iface_t snd_ctl_event_get_interface(const snd_ctl_event_t *obj);
+
+unsigned int snd_ctl_event_get_device(const snd_ctl_event_t *obj);
+
+unsigned int snd_ctl_event_get_subdevice(const snd_ctl_event_t *obj);
+
+const char *snd_ctl_event_get_name(const snd_ctl_event_t *obj);
+
+unsigned int snd_ctl_event_get_index(const snd_ctl_event_t *obj);
+
+size_t snd_control_list_sizeof();
+#define snd_control_list_alloca(ptr) ({ assert(ptr); *ptr = (snd_control_list_t *) alloca(snd_control_list_sizeof()); memset(*ptr, 0, snd_control_list_sizeof()); 0; })
+int snd_control_list_malloc(snd_control_list_t **ptr);
+void snd_control_list_free(snd_control_list_t *obj);
+void snd_control_list_copy(snd_control_list_t *dst, const snd_control_list_t *src);
+
+void snd_control_list_set_offset(snd_control_list_t *obj, unsigned int val);
+
+unsigned int snd_control_list_get_used(const snd_control_list_t *obj);
+
+unsigned int snd_control_list_get_count(const snd_control_list_t *obj);
+
+void snd_control_list_get_id(const snd_control_list_t *obj, unsigned int idx, snd_control_id_t *ptr);
+
+unsigned int snd_control_list_get_numid(const snd_control_list_t *obj, unsigned int idx);
+
+snd_control_iface_t snd_control_list_get_interface(const snd_control_list_t *obj, unsigned int idx);
+
+unsigned int snd_control_list_get_device(const snd_control_list_t *obj, unsigned int idx);
+
+unsigned int snd_control_list_get_subdevice(const snd_control_list_t *obj, unsigned int idx);
+
+const char *snd_control_list_get_name(const snd_control_list_t *obj, unsigned int idx);
+
+unsigned int snd_control_list_get_index(const snd_control_list_t *obj, unsigned int idx);
+
+size_t snd_control_info_sizeof();
+#define snd_control_info_alloca(ptr) ({ assert(ptr); *ptr = (snd_control_info_t *) alloca(snd_control_info_sizeof()); memset(*ptr, 0, snd_control_info_sizeof()); 0; })
+int snd_control_info_malloc(snd_control_info_t **ptr);
+void snd_control_info_free(snd_control_info_t *obj);
+void snd_control_info_copy(snd_control_info_t *dst, const snd_control_info_t *src);
+
+snd_control_type_t snd_control_info_get_type(const snd_control_info_t *obj);
+
+int snd_control_info_is_readable(const snd_control_info_t *obj);
+
+int snd_control_info_is_writable(const snd_control_info_t *obj);
+
+int snd_control_info_is_volatile(const snd_control_info_t *obj);
+
+int snd_control_info_is_inactive(const snd_control_info_t *obj);
+
+int snd_control_info_is_locked(const snd_control_info_t *obj);
+
+int snd_control_info_is_indirect(const snd_control_info_t *obj);
+
+unsigned int snd_control_info_get_count(const snd_control_info_t *obj);
+
+long snd_control_info_get_min(const snd_control_info_t *obj);
+
+long snd_control_info_get_max(const snd_control_info_t *obj);
+
+long snd_control_info_get_step(const snd_control_info_t *obj);
+
+unsigned int snd_control_info_get_items(const snd_control_info_t *obj);
+
+void snd_control_info_set_item(snd_control_info_t *obj, unsigned int val);
+
+const char *snd_control_info_get_item_name(const snd_control_info_t *obj);
+
+void snd_control_info_get_id(const snd_control_info_t *obj, snd_control_id_t *ptr);
+
+unsigned int snd_control_info_get_numid(const snd_control_info_t *obj);
+
+snd_control_iface_t snd_control_info_get_interface(const snd_control_info_t *obj);
+
+unsigned int snd_control_info_get_device(const snd_control_info_t *obj);
+
+unsigned int snd_control_info_get_subdevice(const snd_control_info_t *obj);
+
+const char *snd_control_info_get_name(const snd_control_info_t *obj);
+
+unsigned int snd_control_info_get_index(const snd_control_info_t *obj);
+
+void snd_control_info_set_id(snd_control_info_t *obj, const snd_control_id_t *ptr);
+
+void snd_control_info_set_numid(snd_control_info_t *obj, unsigned int val);
+
+void snd_control_info_set_interface(snd_control_info_t *obj, snd_control_iface_t val);
+
+void snd_control_info_set_device(snd_control_info_t *obj, unsigned int val);
+
+void snd_control_info_set_subdevice(snd_control_info_t *obj, unsigned int val);
+
+void snd_control_info_set_name(snd_control_info_t *obj, const char *val);
+
+void snd_control_info_set_index(snd_control_info_t *obj, unsigned int val);
+
+size_t snd_control_sizeof();
+#define snd_control_alloca(ptr) ({ assert(ptr); *ptr = (snd_control_t *) alloca(snd_control_sizeof()); memset(*ptr, 0, snd_control_sizeof()); 0; })
+int snd_control_malloc(snd_control_t **ptr);
+void snd_control_free(snd_control_t *obj);
+void snd_control_copy(snd_control_t *dst, const snd_control_t *src);
+
+void snd_control_get_id(const snd_control_t *obj, snd_control_id_t *ptr);
+
+unsigned int snd_control_get_numid(const snd_control_t *obj);
+
+snd_control_iface_t snd_control_get_interface(const snd_control_t *obj);
+
+unsigned int snd_control_get_device(const snd_control_t *obj);
+
+unsigned int snd_control_get_subdevice(const snd_control_t *obj);
+
+const char *snd_control_get_name(const snd_control_t *obj);
+
+unsigned int snd_control_get_index(const snd_control_t *obj);
+
+void snd_control_set_id(snd_control_t *obj, const snd_control_id_t *ptr);
+
+void snd_control_set_numid(snd_control_t *obj, unsigned int val);
+
+void snd_control_set_interface(snd_control_t *obj, snd_control_iface_t val);
+
+void snd_control_set_device(snd_control_t *obj, unsigned int val);
+
+void snd_control_set_subdevice(snd_control_t *obj, unsigned int val);
+
+void snd_control_set_name(snd_control_t *obj, const char *val);
+
+void snd_control_set_index(snd_control_t *obj, unsigned int val);
+
+long snd_control_get_boolean(const snd_control_t *obj, unsigned int idx);
+
+long snd_control_get_integer(const snd_control_t *obj, unsigned int idx);
+
+unsigned int snd_control_get_enumerated(const snd_control_t *obj, unsigned int idx);
+
+unsigned char snd_control_get_byte(const snd_control_t *obj, unsigned int idx);
+
+void snd_control_set_boolean(snd_control_t *obj, unsigned int idx, long val);
+
+void snd_control_set_integer(snd_control_t *obj, unsigned int idx, long val);
+
+void snd_control_set_enumerated(snd_control_t *obj, unsigned int idx, unsigned int val);
+
+void snd_control_set_byte(snd_control_t *obj, unsigned int idx, unsigned char val);
+
+const void * snd_control_get_bytes(const snd_control_t *obj);
+
+void snd_control_get_iec958(const snd_control_t *obj, snd_aes_iec958_t *ptr);
+
+void snd_control_set_iec958(snd_control_t *obj, const snd_aes_iec958_t *ptr);
+
+size_t snd_hcontrol_list_sizeof();
+#define snd_hcontrol_list_alloca(ptr) ({ assert(ptr); *ptr = (snd_hcontrol_list_t *) alloca(snd_hcontrol_list_sizeof()); memset(*ptr, 0, snd_hcontrol_list_sizeof()); 0; })
+int snd_hcontrol_list_malloc(snd_hcontrol_list_t **ptr);
+void snd_hcontrol_list_free(snd_hcontrol_list_t *obj);
+void snd_hcontrol_list_copy(snd_hcontrol_list_t *dst, const snd_hcontrol_list_t *src);
+
+void snd_hcontrol_list_set_offset(snd_hcontrol_list_t *obj, unsigned int val);
+
+unsigned int snd_hcontrol_list_get_used(const snd_hcontrol_list_t *obj);
+
+unsigned int snd_hcontrol_list_get_count(const snd_hcontrol_list_t *obj);
+
+void snd_hcontrol_list_get_id(const snd_hcontrol_list_t *obj, unsigned int idx, snd_control_id_t *ptr);
+
+unsigned int snd_hcontrol_list_get_numid(const snd_hcontrol_list_t *obj, unsigned int idx);
+
+snd_control_iface_t snd_hcontrol_list_get_interface(const snd_hcontrol_list_t *obj, unsigned int idx);
+
+unsigned int snd_hcontrol_list_get_device(const snd_hcontrol_list_t *obj, unsigned int idx);
+
+unsigned int snd_hcontrol_list_get_subdevice(const snd_hcontrol_list_t *obj, unsigned int idx);
+
+const char *snd_hcontrol_list_get_name(const snd_hcontrol_list_t *obj, unsigned int idx);
+
+unsigned int snd_hcontrol_list_get_index(const snd_hcontrol_list_t *obj, unsigned int idx);
+
+size_t snd_hcontrol_sizeof();
+#define snd_hcontrol_alloca(ptr) ({ assert(ptr); *ptr = (snd_hcontrol_t *) alloca(snd_hcontrol_sizeof()); memset(*ptr, 0, snd_hcontrol_sizeof()); 0; })
+int snd_hcontrol_malloc(snd_hcontrol_t **ptr);
+void snd_hcontrol_free(snd_hcontrol_t *obj);
+void snd_hcontrol_copy(snd_hcontrol_t *dst, const snd_hcontrol_t *src);
+
+void snd_hcontrol_get_id(const snd_hcontrol_t *obj, snd_control_id_t *ptr);
+
+unsigned int snd_hcontrol_get_numid(const snd_hcontrol_t *obj);
+
+snd_control_iface_t snd_hcontrol_get_interface(const snd_hcontrol_t *obj);
+
+unsigned int snd_hcontrol_get_device(const snd_hcontrol_t *obj);
+
+unsigned int snd_hcontrol_get_subdevice(const snd_hcontrol_t *obj);
+
+const char *snd_hcontrol_get_name(const snd_hcontrol_t *obj);
+
+unsigned int snd_hcontrol_get_index(const snd_hcontrol_t *obj);
+
+void snd_hcontrol_set_callback_change(snd_hcontrol_t *obj, snd_hcontrol_callback_t val);
+
+void snd_hcontrol_set_callback_value(snd_hcontrol_t *obj, snd_hcontrol_callback_t val);
+
+void snd_hcontrol_set_callback_remove(snd_hcontrol_t *obj, snd_hcontrol_callback_t val);
+
+void * snd_hcontrol_get_private_data(const snd_hcontrol_t *obj);
+
+void snd_hcontrol_set_private_data(snd_hcontrol_t *obj, void * val);
+
+void snd_hcontrol_set_private_free(snd_hcontrol_t *obj, snd_hcontrol_private_free_t val);
+
+
+#ifdef __cplusplus
+}
+#endif
index 1b69491b7eb296d33f0ececda3b7cf353ab5d7fc..a42e0b6a8990a8ecefaa4022bc250263cbec013e 100644 (file)
@@ -10,7 +10,7 @@
 #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)
-
index f73560910a4148f7a1fc6fddcb702bb3480fc584..e2fa5efc80c07f6c3f730bd613ed495eeca48603 100644 (file)
@@ -31,6 +31,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <fcntl.h>
+#include <assert.h>
 #include <sys/uio.h>
 
 #ifndef ATTRIBUTE_UNUSED
index dd02c4d07fdece496f68be84ab4f01897b3f08d7..19b5072c244a21f6899cd3971403d34b45f8fe2c 100644 (file)
@@ -3,7 +3,7 @@ extern "C" {
 #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);
@@ -12,9 +12,9 @@ unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj);
 
 int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj);
 
-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);
 
index ecf16653cc714e8d4661c7a800295b3ad116dd03..278aacc5f6d2b0c429ddf77f7b6586db756b9667 100644 (file)
  *
  */
 
+#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
@@ -32,6 +42,7 @@
 #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
index 0c3687ca1a631a7b571a3ab74bfc4b7d2006e7bf..d10549470f5115a734564f6b3fd3f38650006404 100644 (file)
@@ -41,17 +41,23 @@ typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
 #define SND_PCM_CLASS_MULTI ((snd_pcm_class_t) SNDRV_PCM_CLASS_MULTI)
 #define SND_PCM_CLASS_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)
@@ -98,8 +104,10 @@ typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
 #define SND_PCM_FORMAT_FLOAT ((snd_pcm_format_t) SNDRV_PCM_FORMAT_FLOAT)
 #define SND_PCM_FORMAT_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)
@@ -108,12 +116,15 @@ typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
 #define SND_PCM_STATE_DRAINING ((snd_pcm_state_t) SNDRV_PCM_STATE_DRAINING)
 #define SND_PCM_STATE_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)
@@ -200,7 +211,7 @@ typedef struct _snd_pcm_channel_area {
 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);
@@ -251,7 +262,6 @@ int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
                                      unsigned int *rate_num,
                                      unsigned int *rate_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);
 
index bb7e4848a0af9613c209e736963802e395591b47..2089c805b991166a83dcb963c353c36de9c9a4d8 100644 (file)
@@ -3,8 +3,9 @@ extern "C" {
 #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);
@@ -16,7 +17,7 @@ void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
 void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
 
 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);
@@ -28,7 +29,7 @@ void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
 void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
 
 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);
@@ -40,36 +41,40 @@ void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subforma
 void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
 
 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);
@@ -77,10 +82,11 @@ unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_para
 unsigned int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir);
 unsigned int snd_pcm_hw_params_get_rate_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);
@@ -88,10 +94,11 @@ unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t
 unsigned int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir);
 unsigned int snd_pcm_hw_params_get_period_time_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);
@@ -99,34 +106,37 @@ unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_p
 snd_pcm_uframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir);
 snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_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);
@@ -134,10 +144,11 @@ unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_p
 snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params);
 snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_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);
@@ -145,16 +156,17 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm
 unsigned int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir);
 unsigned int snd_pcm_hw_params_get_tick_time_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);
@@ -186,8 +198,26 @@ snd_pcm_uframes_t snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_param
 int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
 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);
@@ -200,11 +230,11 @@ snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj);
 
 int snd_pcm_info_get_card(const snd_pcm_info_t *obj);
 
-const char * snd_pcm_info_get_id(const snd_pcm_info_t *obj);
+const char *snd_pcm_info_get_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);
 
@@ -220,24 +250,6 @@ void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val);
 
 void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val);
 
-size_t snd_pcm_status_sizeof();
-#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
 }
index dbcb8b42c8f51f2640491eb5364f9537f544e327..20aa7db527cfd0dafcbc28506c9408051c0c8486 100644 (file)
@@ -17,6 +17,7 @@ typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t;
 
 #define SND_RAWMIDI_STREAM_OUTPUT ((snd_rawmidi_stream_t) SNDRV_RAWMIDI_STREAM_OUTPUT)
 #define SND_RAWMIDI_STREAM_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
index 5d5e9e3782ff1203cad7ec713afb567bb85c4ffc..7c40c97e1aa4113deb2444c29365b87611197ee1 100644 (file)
@@ -3,7 +3,7 @@ extern "C" {
 #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);
@@ -18,7 +18,7 @@ int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_p
 int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
 
 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);
@@ -33,11 +33,11 @@ int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
 
 unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj);
 
-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);
 
@@ -50,7 +50,7 @@ void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
 void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
 
 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);
index f88623b8c28418f9bd11f5e387ff77d27b3206b2..f146f9097039b742ae806ad019b27331dad351c7 100644 (file)
@@ -25,10 +25,13 @@ typedef enum sndrv_timer_slave_type snd_timer_slave_type_t;
 #define SND_TIMER_TYPE_GLOBAL ((snd_timer_type_t) SNDRV_TIMER_TYPE_GLOBAL)
 #define SND_TIMER_TYPE_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
index db0b5c99ce5a29b6b4aed5dcb1b6547675bbdc3a..82077e4c517d8e6ed7f9c24d81741e1ebabde472 100644 (file)
@@ -19,8 +19,6 @@
  *
  */
 
-#include <assert.h>
-#include <errno.h>
 #include <stdarg.h>
 #include <sys/stat.h>
 #include "local.h"
@@ -355,7 +353,7 @@ static int _snd_config_make_add(snd_config_t **config, char *id,
        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) {
@@ -679,7 +677,7 @@ int snd_config_delete(snd_config_t *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;
@@ -693,22 +691,22 @@ int snd_config_make(snd_config_t **config, char *id,
        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;
@@ -737,7 +735,7 @@ int snd_config_real_set(snd_config_t *config, double value)
        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)
@@ -750,29 +748,6 @@ int snd_config_string_set(snd_config_t *config, char *value)
        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);
@@ -791,7 +766,7 @@ int snd_config_real_get(snd_config_t *config, double *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)
@@ -800,26 +775,6 @@ int snd_config_string_get(snd_config_t *config, char **ptr)
        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;
@@ -980,13 +935,13 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
        return _snd_config_save_leaves(config, out, 0, 0);
 }
 
-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) {
@@ -1008,7 +963,7 @@ int snd_config_searchv(snd_config_t *config,
        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;
index 4bfbf2603c870dcbe59b4c31d2c364a20cbce2fd..1c358b5cf6731e9ef74e42322416460bbde27b71 100644 (file)
@@ -1,7 +1,7 @@
 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
 
index 88d0387b40c4ed2eb1452df6d7d415b7a3fdb8e8..e143a23ca6146708fe0fffe08652aaa90df58efd 100644 (file)
 #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"
index 3a3742e8680ac760b98dc067971621a1900691ef..0510994fc31788c10d67e6ed61fd3d172ffea3d4 100644 (file)
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <ctype.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
@@ -73,7 +72,7 @@ int snd_card_get_index(const char *string)
 {
        int card;
        snd_ctl_t *handle;
-       snd_ctl_hw_info_t info;
+       snd_ctl_info_t info;
 
        if (!string || *string == '\0')
                return -EINVAL;
@@ -91,7 +90,7 @@ int snd_card_get_index(const char *string)
                        continue;
                if (snd_ctl_hw_open(&handle, NULL, card) < 0)
                        continue;
-               if (snd_ctl_hw_info(handle, &info) < 0) {
+               if (snd_ctl_info(handle, &info) < 0) {
                        snd_ctl_close(handle);
                        continue;
                }
@@ -105,14 +104,14 @@ int snd_card_get_index(const char *string)
 int snd_card_get_name(int card, char **name)
 {
        snd_ctl_t *handle;
-       snd_ctl_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;
        }
@@ -126,14 +125,14 @@ int snd_card_get_name(int card, char **name)
 int snd_card_get_longname(int card, char **name)
 {
        snd_ctl_t *handle;
-       snd_ctl_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;
        }
index b0a2b049a28c280b686c8205676a632c0f5921b7..ce856d38b411f519608e623ec44945cb7d66a59f 100644 (file)
@@ -24,9 +24,7 @@
 #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"
 
@@ -50,7 +48,7 @@ int snd_ctl_poll_descriptor(snd_ctl_t *ctl)
        return ctl->ops->poll_descriptor(ctl);
 }
 
-int snd_ctl_hw_info(snd_ctl_t *ctl, snd_ctl_hw_info_t *info)
+int snd_ctl_info(snd_ctl_t *ctl, snd_ctl_info_t *info)
 {
        assert(ctl && info);
        return ctl->ops->hw_info(ctl, info);
@@ -175,11 +173,11 @@ int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_callbacks_t * callbacks)
 
 int snd_ctl_open(snd_ctl_t **ctlp, char *name)
 {
-       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);
@@ -240,3 +238,75 @@ int snd_ctl_open(snd_ctl_t **ctlp, char *name)
        return open_func(ctlp, name, ctl_conf);
 }
 
+void snd_control_set_bytes(snd_control_t *obj, void *data, size_t size)
+{
+       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;
+}
index bd0552e0f0b365fbb6e5f077f738997ffdedb310..cc51b47865c3dfbace46b308c4a55ba98c72efd3 100644 (file)
 #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"
@@ -53,10 +51,10 @@ static int snd_ctl_hw_poll_descriptor(snd_ctl_t *handle)
        return hw->fd;
 }
 
-static int snd_ctl_hw_hw_info(snd_ctl_t *handle, snd_ctl_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;
 }
@@ -182,7 +180,7 @@ snd_ctl_ops_t snd_ctl_hw_ops = {
        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];
@@ -234,7 +232,7 @@ int _snd_ctl_hw_open(snd_ctl_t **handlep, char *name, snd_config_t *conf)
 {
        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);
index f4953c970da52845797f017dc8c93d2fbabcff5e..b2b07af93f210a6df56a269e9ecc333fef18c68c 100644 (file)
  *
  */
 
-#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);
@@ -53,12 +52,46 @@ struct _snd_ctl {
        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);
diff --git a/src/control/control_m4.c b/src/control/control_m4.c
new file mode 100644 (file)
index 0000000..99403ca
--- /dev/null
@@ -0,0 +1,937 @@
+/*
+ *  Control - Automatically generated functions
+ *  Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ *   This library is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as
+ *   published by the Free Software Foundation; either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Library General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this library; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+  
+#include "control_local.h"
+
+size_t snd_control_id_sizeof()
+{
+       return sizeof(snd_control_id_t);
+}
+
+int snd_control_id_malloc(snd_control_id_t **ptr)
+{
+       assert(ptr);
+       *ptr = calloc(1, sizeof(snd_control_id_t));
+       if (!*ptr)
+               return -ENOMEM;
+       return 0;
+}
+
+void snd_control_id_free(snd_control_id_t *obj)
+{
+       free(obj);
+}
+
+void snd_control_id_copy(snd_control_id_t *dst, const snd_control_id_t *src)
+{
+       assert(dst && src);
+       *dst = *src;
+}
+
+unsigned int snd_control_id_get_numid(const snd_control_id_t *obj)
+{
+       assert(obj);
+       return obj->numid;
+}
+
+snd_control_iface_t snd_control_id_get_interface(const snd_control_id_t *obj)
+{
+       assert(obj);
+       return snd_int_to_enum(obj->iface);
+}
+
+unsigned int snd_control_id_get_device(const snd_control_id_t *obj)
+{
+       assert(obj);
+       return obj->device;
+}
+
+unsigned int snd_control_id_get_subdevice(const snd_control_id_t *obj)
+{
+       assert(obj);
+       return obj->subdevice;
+}
+
+const char *snd_control_id_get_name(const snd_control_id_t *obj)
+{
+       assert(obj);
+       return obj->name;
+}
+
+unsigned int snd_control_id_get_index(const snd_control_id_t *obj)
+{
+       assert(obj);
+       return obj->index;
+}
+
+void snd_control_id_set_numid(snd_control_id_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->numid = val;
+}
+
+void snd_control_id_set_interface(snd_control_id_t *obj, snd_control_iface_t val)
+{
+       assert(obj);
+       obj->iface = snd_enum_to_int(val);
+}
+
+void snd_control_id_set_device(snd_control_id_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->device = val;
+}
+
+void snd_control_id_set_subdevice(snd_control_id_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->subdevice = val;
+}
+
+void snd_control_id_set_name(snd_control_id_t *obj, const char *val)
+{
+       assert(obj);
+       strncpy(obj->name, val, sizeof(obj->name));
+}
+
+void snd_control_id_set_index(snd_control_id_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->index = val;
+}
+
+size_t snd_ctl_info_sizeof()
+{
+       return sizeof(snd_ctl_info_t);
+}
+
+int snd_ctl_info_malloc(snd_ctl_info_t **ptr)
+{
+       assert(ptr);
+       *ptr = calloc(1, sizeof(snd_ctl_info_t));
+       if (!*ptr)
+               return -ENOMEM;
+       return 0;
+}
+
+void snd_ctl_info_free(snd_ctl_info_t *obj)
+{
+       free(obj);
+}
+
+void snd_ctl_info_copy(snd_ctl_info_t *dst, const snd_ctl_info_t *src)
+{
+       assert(dst && src);
+       *dst = *src;
+}
+
+int snd_ctl_info_get_card(const snd_ctl_info_t *obj)
+{
+       assert(obj);
+       return obj->card;
+}
+
+snd_card_type_t snd_ctl_info_get_type(const snd_ctl_info_t *obj)
+{
+       assert(obj);
+       return snd_int_to_enum(obj->type);
+}
+
+const char *snd_ctl_info_get_id(const snd_ctl_info_t *obj)
+{
+       assert(obj);
+       return obj->id;
+}
+
+const char *snd_ctl_info_get_abbreviation(const snd_ctl_info_t *obj)
+{
+       assert(obj);
+       return obj->abbreviation;
+}
+
+const char *snd_ctl_info_get_name(const snd_ctl_info_t *obj)
+{
+       assert(obj);
+       return obj->name;
+}
+
+const char *snd_ctl_info_get_longname(const snd_ctl_info_t *obj)
+{
+       assert(obj);
+       return obj->longname;
+}
+
+const char *snd_ctl_info_get_mixerid(const snd_ctl_info_t *obj)
+{
+       assert(obj);
+       return obj->mixerid;
+}
+
+const char *snd_ctl_info_get_mixername(const snd_ctl_info_t *obj)
+{
+       assert(obj);
+       return obj->mixername;
+}
+
+size_t snd_ctl_event_sizeof()
+{
+       return sizeof(snd_ctl_event_t);
+}
+
+int snd_ctl_event_malloc(snd_ctl_event_t **ptr)
+{
+       assert(ptr);
+       *ptr = calloc(1, sizeof(snd_ctl_event_t));
+       if (!*ptr)
+               return -ENOMEM;
+       return 0;
+}
+
+void snd_ctl_event_free(snd_ctl_event_t *obj)
+{
+       free(obj);
+}
+
+void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src)
+{
+       assert(dst && src);
+       *dst = *src;
+}
+
+snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj)
+{
+       assert(obj);
+       return snd_int_to_enum(obj->type);
+}
+
+unsigned int snd_ctl_event_get_numid(const snd_ctl_event_t *obj)
+{
+       assert(obj);
+       assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
+       return obj->data.id.numid;
+}
+
+void snd_ctl_event_get_id(const snd_ctl_event_t *obj, snd_control_id_t *ptr)
+{
+       assert(obj && ptr);
+       assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
+       *ptr = obj->data.id;
+}
+
+snd_control_iface_t snd_ctl_event_get_interface(const snd_ctl_event_t *obj)
+{
+       assert(obj);
+       assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
+       return snd_int_to_enum(obj->data.id.iface);
+}
+
+unsigned int snd_ctl_event_get_device(const snd_ctl_event_t *obj)
+{
+       assert(obj);
+       assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
+       return obj->data.id.device;
+}
+
+unsigned int snd_ctl_event_get_subdevice(const snd_ctl_event_t *obj)
+{
+       assert(obj);
+       assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
+       return obj->data.id.subdevice;
+}
+
+const char *snd_ctl_event_get_name(const snd_ctl_event_t *obj)
+{
+       assert(obj);
+       assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
+       return obj->data.id.name;
+}
+
+unsigned int snd_ctl_event_get_index(const snd_ctl_event_t *obj)
+{
+       assert(obj);
+       assert(obj->type != SNDRV_CTL_EVENT_REBUILD);
+       return obj->data.id.index;
+}
+
+size_t snd_control_list_sizeof()
+{
+       return sizeof(snd_control_list_t);
+}
+
+int snd_control_list_malloc(snd_control_list_t **ptr)
+{
+       assert(ptr);
+       *ptr = calloc(1, sizeof(snd_control_list_t));
+       if (!*ptr)
+               return -ENOMEM;
+       return 0;
+}
+
+void snd_control_list_free(snd_control_list_t *obj)
+{
+       free(obj);
+}
+
+void snd_control_list_copy(snd_control_list_t *dst, const snd_control_list_t *src)
+{
+       assert(dst && src);
+       *dst = *src;
+}
+
+void snd_control_list_set_offset(snd_control_list_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->offset = val;
+}
+
+unsigned int snd_control_list_get_used(const snd_control_list_t *obj)
+{
+       assert(obj);
+       return obj->used;
+}
+
+unsigned int snd_control_list_get_count(const snd_control_list_t *obj)
+{
+       assert(obj);
+       return obj->count;
+}
+
+void snd_control_list_get_id(const snd_control_list_t *obj, unsigned int idx, snd_control_id_t *ptr)
+{
+       assert(obj && ptr);
+       assert(idx < obj->used);
+       *ptr = obj->pids[idx];
+}
+
+unsigned int snd_control_list_get_numid(const snd_control_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].numid;
+}
+
+snd_control_iface_t snd_control_list_get_interface(const snd_control_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return snd_int_to_enum(obj->pids[idx].iface);
+}
+
+unsigned int snd_control_list_get_device(const snd_control_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].device;
+}
+
+unsigned int snd_control_list_get_subdevice(const snd_control_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].subdevice;
+}
+
+const char *snd_control_list_get_name(const snd_control_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].name;
+}
+
+unsigned int snd_control_list_get_index(const snd_control_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].index;
+}
+
+size_t snd_control_info_sizeof()
+{
+       return sizeof(snd_control_info_t);
+}
+
+int snd_control_info_malloc(snd_control_info_t **ptr)
+{
+       assert(ptr);
+       *ptr = calloc(1, sizeof(snd_control_info_t));
+       if (!*ptr)
+               return -ENOMEM;
+       return 0;
+}
+
+void snd_control_info_free(snd_control_info_t *obj)
+{
+       free(obj);
+}
+
+void snd_control_info_copy(snd_control_info_t *dst, const snd_control_info_t *src)
+{
+       assert(dst && src);
+       *dst = *src;
+}
+
+snd_control_type_t snd_control_info_get_type(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return snd_int_to_enum(obj->type);
+}
+
+int snd_control_info_is_readable(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return !!(obj->access & SNDRV_CONTROL_ACCESS_READ);
+}
+
+int snd_control_info_is_writable(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return !!(obj->access & SNDRV_CONTROL_ACCESS_WRITE);
+}
+
+int snd_control_info_is_volatile(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return !!(obj->access & SNDRV_CONTROL_ACCESS_VOLATILE);
+}
+
+int snd_control_info_is_inactive(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return !!(obj->access & SNDRV_CONTROL_ACCESS_INACTIVE);
+}
+
+int snd_control_info_is_locked(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return !!(obj->access & SNDRV_CONTROL_ACCESS_LOCK);
+}
+
+int snd_control_info_is_indirect(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return !!(obj->access & SNDRV_CONTROL_ACCESS_INDIRECT);
+}
+
+unsigned int snd_control_info_get_count(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return obj->count;
+}
+
+long snd_control_info_get_min(const snd_control_info_t *obj)
+{
+       assert(obj);
+       assert(obj->type == SNDRV_CONTROL_TYPE_INTEGER);
+       return obj->value.integer.min;
+}
+
+long snd_control_info_get_max(const snd_control_info_t *obj)
+{
+       assert(obj);
+       assert(obj->type == SNDRV_CONTROL_TYPE_INTEGER);
+       return obj->value.integer.max;
+}
+
+long snd_control_info_get_step(const snd_control_info_t *obj)
+{
+       assert(obj);
+       assert(obj->type == SNDRV_CONTROL_TYPE_INTEGER);
+       return obj->value.integer.step;
+}
+
+unsigned int snd_control_info_get_items(const snd_control_info_t *obj)
+{
+       assert(obj);
+       assert(obj->type == SNDRV_CONTROL_TYPE_ENUMERATED);
+       return obj->value.enumerated.items;
+}
+
+void snd_control_info_set_item(snd_control_info_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->value.enumerated.item = val;
+}
+
+const char *snd_control_info_get_item_name(const snd_control_info_t *obj)
+{
+       assert(obj);
+       assert(obj->type == SNDRV_CONTROL_TYPE_ENUMERATED);
+       return obj->value.enumerated.name;
+}
+
+void snd_control_info_get_id(const snd_control_info_t *obj, snd_control_id_t *ptr)
+{
+       assert(obj && ptr);
+       *ptr = obj->id;
+}
+
+unsigned int snd_control_info_get_numid(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return obj->id.numid;
+}
+
+snd_control_iface_t snd_control_info_get_interface(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return snd_int_to_enum(obj->id.iface);
+}
+
+unsigned int snd_control_info_get_device(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return obj->id.device;
+}
+
+unsigned int snd_control_info_get_subdevice(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return obj->id.subdevice;
+}
+
+const char *snd_control_info_get_name(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return obj->id.name;
+}
+
+unsigned int snd_control_info_get_index(const snd_control_info_t *obj)
+{
+       assert(obj);
+       return obj->id.index;
+}
+
+void snd_control_info_set_id(snd_control_info_t *obj, const snd_control_id_t *ptr)
+{
+       assert(obj && ptr);
+       obj->id = *ptr;
+}
+
+void snd_control_info_set_numid(snd_control_info_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->id.numid = val;
+}
+
+void snd_control_info_set_interface(snd_control_info_t *obj, snd_control_iface_t val)
+{
+       assert(obj);
+       obj->id.iface = snd_enum_to_int(val);
+}
+
+void snd_control_info_set_device(snd_control_info_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->id.device = val;
+}
+
+void snd_control_info_set_subdevice(snd_control_info_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->id.subdevice = val;
+}
+
+void snd_control_info_set_name(snd_control_info_t *obj, const char *val)
+{
+       assert(obj);
+       strncpy(obj->id.name, val, sizeof(obj->id.name));
+}
+
+void snd_control_info_set_index(snd_control_info_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->id.index = val;
+}
+
+size_t snd_control_sizeof()
+{
+       return sizeof(snd_control_t);
+}
+
+int snd_control_malloc(snd_control_t **ptr)
+{
+       assert(ptr);
+       *ptr = calloc(1, sizeof(snd_control_t));
+       if (!*ptr)
+               return -ENOMEM;
+       return 0;
+}
+
+void snd_control_free(snd_control_t *obj)
+{
+       free(obj);
+}
+
+void snd_control_copy(snd_control_t *dst, const snd_control_t *src)
+{
+       assert(dst && src);
+       *dst = *src;
+}
+
+void snd_control_get_id(const snd_control_t *obj, snd_control_id_t *ptr)
+{
+       assert(obj && ptr);
+       *ptr = obj->id;
+}
+
+unsigned int snd_control_get_numid(const snd_control_t *obj)
+{
+       assert(obj);
+       return obj->id.numid;
+}
+
+snd_control_iface_t snd_control_get_interface(const snd_control_t *obj)
+{
+       assert(obj);
+       return snd_int_to_enum(obj->id.iface);
+}
+
+unsigned int snd_control_get_device(const snd_control_t *obj)
+{
+       assert(obj);
+       return obj->id.device;
+}
+
+unsigned int snd_control_get_subdevice(const snd_control_t *obj)
+{
+       assert(obj);
+       return obj->id.subdevice;
+}
+
+const char *snd_control_get_name(const snd_control_t *obj)
+{
+       assert(obj);
+       return obj->id.name;
+}
+
+unsigned int snd_control_get_index(const snd_control_t *obj)
+{
+       assert(obj);
+       return obj->id.index;
+}
+
+void snd_control_set_id(snd_control_t *obj, const snd_control_id_t *ptr)
+{
+       assert(obj && ptr);
+       obj->id = *ptr;
+}
+
+void snd_control_set_numid(snd_control_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->id.numid = val;
+}
+
+void snd_control_set_interface(snd_control_t *obj, snd_control_iface_t val)
+{
+       assert(obj);
+       obj->id.iface = snd_enum_to_int(val);
+}
+
+void snd_control_set_device(snd_control_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->id.device = val;
+}
+
+void snd_control_set_subdevice(snd_control_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->id.subdevice = val;
+}
+
+void snd_control_set_name(snd_control_t *obj, const char *val)
+{
+       assert(obj);
+       strncpy(obj->id.name, val, sizeof(obj->id.name));
+}
+
+void snd_control_set_index(snd_control_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->id.index = val;
+}
+
+long snd_control_get_boolean(const snd_control_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < sizeof(obj->value.integer.value) / sizeof(obj->value.integer.value[0]));
+       return obj->value.integer.value[idx];
+}
+
+long snd_control_get_integer(const snd_control_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < sizeof(obj->value.integer.value) / sizeof(obj->value.integer.value[0]));
+       return obj->value.integer.value[idx];
+}
+
+unsigned int snd_control_get_enumerated(const snd_control_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < sizeof(obj->value.enumerated.item) / sizeof(obj->value.enumerated.item[0]));
+       return obj->value.enumerated.item[idx];
+}
+
+unsigned char snd_control_get_byte(const snd_control_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < sizeof(obj->value.bytes.data));
+       return obj->value.bytes.data[idx];
+}
+
+void snd_control_set_boolean(snd_control_t *obj, unsigned int idx, long val)
+{
+       assert(obj);
+       obj->value.integer.value[idx] = val;
+}
+
+void snd_control_set_integer(snd_control_t *obj, unsigned int idx, long val)
+{
+       assert(obj);
+       obj->value.integer.value[idx] = val;
+}
+
+void snd_control_set_enumerated(snd_control_t *obj, unsigned int idx, unsigned int val)
+{
+       assert(obj);
+       obj->value.enumerated.item[idx] = val;
+}
+
+void snd_control_set_byte(snd_control_t *obj, unsigned int idx, unsigned char val)
+{
+       assert(obj);
+       obj->value.bytes.data[idx] = val;
+}
+
+const void * snd_control_get_bytes(const snd_control_t *obj)
+{
+       assert(obj);
+       return obj->value.bytes.data;
+}
+
+void snd_control_get_iec958(const snd_control_t *obj, snd_aes_iec958_t *ptr)
+{
+       assert(obj && ptr);
+       *ptr = obj->value.iec958;
+}
+
+void snd_control_set_iec958(snd_control_t *obj, const snd_aes_iec958_t *ptr)
+{
+       assert(obj && ptr);
+       obj->value.iec958 = *ptr;
+}
+
+size_t snd_hcontrol_list_sizeof()
+{
+       return sizeof(snd_hcontrol_list_t);
+}
+
+int snd_hcontrol_list_malloc(snd_hcontrol_list_t **ptr)
+{
+       assert(ptr);
+       *ptr = calloc(1, sizeof(snd_hcontrol_list_t));
+       if (!*ptr)
+               return -ENOMEM;
+       return 0;
+}
+
+void snd_hcontrol_list_free(snd_hcontrol_list_t *obj)
+{
+       free(obj);
+}
+
+void snd_hcontrol_list_copy(snd_hcontrol_list_t *dst, const snd_hcontrol_list_t *src)
+{
+       assert(dst && src);
+       *dst = *src;
+}
+
+void snd_hcontrol_list_set_offset(snd_hcontrol_list_t *obj, unsigned int val)
+{
+       assert(obj);
+       obj->offset = val;
+}
+
+unsigned int snd_hcontrol_list_get_used(const snd_hcontrol_list_t *obj)
+{
+       assert(obj);
+       return obj->used;
+}
+
+unsigned int snd_hcontrol_list_get_count(const snd_hcontrol_list_t *obj)
+{
+       assert(obj);
+       return obj->count;
+}
+
+void snd_hcontrol_list_get_id(const snd_hcontrol_list_t *obj, unsigned int idx, snd_control_id_t *ptr)
+{
+       assert(obj && ptr);
+       assert(idx < obj->used);
+       *ptr = obj->pids[idx];
+}
+
+unsigned int snd_hcontrol_list_get_numid(const snd_hcontrol_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].numid;
+}
+
+snd_control_iface_t snd_hcontrol_list_get_interface(const snd_hcontrol_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return snd_int_to_enum(obj->pids[idx].iface);
+}
+
+unsigned int snd_hcontrol_list_get_device(const snd_hcontrol_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].device;
+}
+
+unsigned int snd_hcontrol_list_get_subdevice(const snd_hcontrol_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].subdevice;
+}
+
+const char *snd_hcontrol_list_get_name(const snd_hcontrol_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].name;
+}
+
+unsigned int snd_hcontrol_list_get_index(const snd_hcontrol_list_t *obj, unsigned int idx)
+{
+       assert(obj);
+       assert(idx < obj->used);
+       return obj->pids[idx].index;
+}
+
+size_t snd_hcontrol_sizeof()
+{
+       return sizeof(snd_hcontrol_t);
+}
+
+int snd_hcontrol_malloc(snd_hcontrol_t **ptr)
+{
+       assert(ptr);
+       *ptr = calloc(1, sizeof(snd_hcontrol_t));
+       if (!*ptr)
+               return -ENOMEM;
+       return 0;
+}
+
+void snd_hcontrol_free(snd_hcontrol_t *obj)
+{
+       free(obj);
+}
+
+void snd_hcontrol_copy(snd_hcontrol_t *dst, const snd_hcontrol_t *src)
+{
+       assert(dst && src);
+       *dst = *src;
+}
+
+void snd_hcontrol_get_id(const snd_hcontrol_t *obj, snd_control_id_t *ptr)
+{
+       assert(obj && ptr);
+       *ptr = obj->id;
+}
+
+unsigned int snd_hcontrol_get_numid(const snd_hcontrol_t *obj)
+{
+       assert(obj);
+       return obj->id.numid;
+}
+
+snd_control_iface_t snd_hcontrol_get_interface(const snd_hcontrol_t *obj)
+{
+       assert(obj);
+       return snd_int_to_enum(obj->id.iface);
+}
+
+unsigned int snd_hcontrol_get_device(const snd_hcontrol_t *obj)
+{
+       assert(obj);
+       return obj->id.device;
+}
+
+unsigned int snd_hcontrol_get_subdevice(const snd_hcontrol_t *obj)
+{
+       assert(obj);
+       return obj->id.subdevice;
+}
+
+const char *snd_hcontrol_get_name(const snd_hcontrol_t *obj)
+{
+       assert(obj);
+       return obj->id.name;
+}
+
+unsigned int snd_hcontrol_get_index(const snd_hcontrol_t *obj)
+{
+       assert(obj);
+       return obj->id.index;
+}
+
+void snd_hcontrol_set_callback_change(snd_hcontrol_t *obj, snd_hcontrol_callback_t val)
+{
+       assert(obj);
+       obj->callback_change = val;
+}
+
+void snd_hcontrol_set_callback_value(snd_hcontrol_t *obj, snd_hcontrol_callback_t val)
+{
+       assert(obj);
+       obj->callback_value = val;
+}
+
+void snd_hcontrol_set_callback_remove(snd_hcontrol_t *obj, snd_hcontrol_callback_t val)
+{
+       assert(obj);
+       obj->callback_remove = val;
+}
+
+void * snd_hcontrol_get_private_data(const snd_hcontrol_t *obj)
+{
+       assert(obj);
+       return obj->private_data;
+}
+
+void snd_hcontrol_set_private_data(snd_hcontrol_t *obj, void * val)
+{
+       assert(obj);
+       obj->private_data = val;
+}
+
+void snd_hcontrol_set_private_free(snd_hcontrol_t *obj, snd_hcontrol_private_free_t val)
+{
+       assert(obj);
+       obj->private_free = val;
+}
+
index d83eedd9b2d7fadcf40e98f0349af1dcd3b17a80..45f04b3f0f51e57167ffb02ce45376f2d3756ab3 100644 (file)
@@ -24,7 +24,6 @@
 #include <stddef.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/shm.h>
 #include <sys/socket.h>
@@ -107,13 +106,13 @@ static int snd_ctl_shm_poll_descriptor(snd_ctl_t *ctl)
        return fd;
 }
 
-static int snd_ctl_shm_hw_info(snd_ctl_t *ctl, snd_ctl_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;
@@ -126,7 +125,7 @@ static int snd_ctl_shm_clist(snd_ctl_t *ctl, snd_control_list_t *list)
        snd_ctl_shm_t *shm = ctl->private;
        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)
@@ -138,6 +137,7 @@ static int snd_ctl_shm_clist(snd_ctl_t *ctl, snd_control_list_t *list)
                return err;
        *list = ctrl->u.clist;
        list->pids = pids;
+       bytes = list->used * sizeof(*list->pids);
        memcpy(pids, (void *)ctrl->data, bytes);
        return err;
 }
@@ -369,7 +369,7 @@ static int make_inet_socket(const char *host, int port)
 }
 #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;
@@ -469,11 +469,11 @@ extern int is_local(struct hostent *hent);
 int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf)
 {
        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;
index 290f8fc8a1971777c9a09e23252dee8a05ee6a1e..15c258227ca4c22126f2d07d1087751a8644bc4f 100644 (file)
 #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;
@@ -49,21 +47,20 @@ int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t *hsort)
        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;
@@ -101,10 +98,10 @@ static void snd_ctl_hfree1(snd_hcontrol_t *hcontrol)
        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--;
@@ -236,7 +233,7 @@ static void snd_ctl_hresort_free(snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED)
        /* 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;
@@ -336,21 +333,21 @@ int snd_ctl_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist)
        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++;
                }
@@ -358,7 +355,7 @@ int snd_ctl_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist)
        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;
@@ -366,7 +363,7 @@ int snd_ctl_hcallback_rebuild(snd_ctl_t *handle, snd_ctl_hcallback_rebuild_t *ca
        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;
@@ -476,14 +473,31 @@ int snd_ctl_hevent(snd_ctl_t *handle)
                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;
+}
index 18edc17066c86f4b72574cb37762bb900a334ff0..328e7969449b31408a6b15a78a955cb63c9be189 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
 #include "local.h"
 
 static int defaults_card(const char *env)
index b1d0998629b311f76273c5bee34007584d19cc9d..97f5fb3c0dc28e418144a5977e293e8241a5f192 100644 (file)
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "local.h"
index 5d8990c46b2063136180cd23158b6718f84156b4..8b5a223ac28d4ffe27a3b578f8f43f97e8fc93ec 100644 (file)
@@ -19,8 +19,6 @@
  *
  */
   
-#include <errno.h>
-#include <assert.h>
 #include "local.h"
 
 size_t snd_hwdep_info_sizeof()
@@ -31,7 +29,7 @@ size_t snd_hwdep_info_sizeof()
 int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr)
 {
        assert(ptr);
-       *ptr = malloc(sizeof(snd_hwdep_info_t));
+       *ptr = calloc(1, sizeof(snd_hwdep_info_t));
        if (!*ptr)
                return -ENOMEM;
        return 0;
@@ -60,13 +58,13 @@ int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj)
        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;
index fc294f7511c6004b343704b75d49c04c67ccce42..5d57bf6d45a27a5fc580e72d8c0de8731f649b7d 100644 (file)
  *
  */
 
-#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 {
index d20be38cb3f7567c14877a3345712d58ebca5b96..a20dba641fde6eced8c94655b39687b64ef563d4 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include "local.h"
index 9aa12d8b2122c673991c5a652ae10e23f8672757..462cadbfd5f6de71e9c010c69d67d03ab3a55dbf 100644 (file)
@@ -22,7 +22,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include "local.h"
index 8474bb44c90725dbf5c24fcac9687732b9ae828f..8b78b93dda09d4ac7ae1c07e66bbfda9f4b743b4 100644 (file)
@@ -22,7 +22,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include "local.h"
index 7843a5a2879073722e4b44c12068a24d1465a7f1..630006b2ae1845ff7a04e40e22314ef060a55ec4 100644 (file)
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "mixer_local.h"
index 719084b5574e443cf3eb162b82e5fc74d9293b39..b2d9543ffff2f3bebed6142a1bd8923a31f3a362 100644 (file)
@@ -19,7 +19,6 @@
  *
  */
 
-#include <assert.h>
 #include "local.h"
 #include "list.h"
 
index 86033edcf95f2fb1093de870f6259b6248fb03d2..46795a9da9997d490fd9227ca5148cfa309f8b75 100644 (file)
@@ -23,9 +23,9 @@
 #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 {
@@ -121,9 +121,9 @@ static void hcontrol_event_remove(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hc
 static void hcontrol_add(snd_mixer_t *handle, void **bag, snd_hcontrol_t *hcontrol)
 {
        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;
 }
 
@@ -489,8 +489,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                                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) {
@@ -507,8 +507,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                        if ((err = get_mixer_info(handle, str, index, &gswitch_info)) < 0)
                                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);
@@ -518,7 +518,7 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
                        if ((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;
@@ -531,8 +531,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                        if ((err = get_mixer_info(handle, str, index, &gvolume_info)) < 0)
                                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)
@@ -547,8 +547,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                        if ((err = get_mixer_info(handle, str, index, &pswitch_info)) < 0)
                                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);
@@ -558,7 +558,7 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
                        if ((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;
@@ -571,8 +571,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                        if ((err = get_mixer_info(handle, str, index, &cswitch_info)) < 0)
                                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);
@@ -582,7 +582,7 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) {
                        if ((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;
@@ -595,8 +595,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                        if ((err = get_mixer_info(handle, str, index, &pvolume_info)) < 0)
                                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)
@@ -611,8 +611,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                        if ((err = get_mixer_info(handle, str, index, &cvolume_info)) < 0)
                                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)
@@ -633,8 +633,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                        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);
@@ -643,8 +643,8 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                                        if ((err = snd_ctl_cinfo(handle->ctl_handle, &csource_info)) < 0)
                                                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);
@@ -661,39 +661,39 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                        if (present & (MIXER_PRESENT_SINGLE_VOLUME|MIXER_PRESENT_GLOBAL_VOLUME|MIXER_PRESENT_PLAYBACK_VOLUME|MIXER_PRESENT_CAPTURE_VOLUME))
                                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;
                        }
                }
@@ -706,17 +706,17 @@ static int build_input(snd_mixer_t *handle, const char *sname)
                        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;
index 3dc44262fc78a4f9e4f0cd0976abe066e10cea4e..477c79ff0cbee0adc9432aed9753ea949d6ac710 100644 (file)
  *
  */
 
-#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 {
index 8be7d3d6052b9da7b75f864e0131c1632689eeec..a0a687dea4ed32fb2c595c736c508c1c878ebb8a 100644 (file)
@@ -24,8 +24,6 @@
 
 #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)
index c84da00eb17a03ba7dc387d5fc737be8e1650d30..018a2eb00a114d63166211db4b4fb9912f3b64f9 100644 (file)
@@ -24,7 +24,5 @@
 
 #include <sys/types.h>
 #include <limits.h>
-#include <errno.h>
-#include <assert.h>
 #include "pcm_local.h"
 
index 37eb4a77caa45d85e03560f43445110700e92652..dec674ea7473a636bf2a293c36bfd240ee8d877d 100644 (file)
@@ -20,7 +20,6 @@
  */
   
 #include <sys/types.h>
-#include <assert.h>
 
 #ifdef SND_MASK_C
 #define MASK_INLINE inline
index 7803d153146efb414a8ad27413a623b728379b0e..78f01c421c30eeae10765ee5c1586fe5097b23ca 100644 (file)
@@ -22,7 +22,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <malloc.h>
-#include <errno.h>
 #include <stdarg.h>
 #include <sys/ioctl.h>
 #include <sys/poll.h>
@@ -248,12 +247,12 @@ int snd_pcm_poll_descriptor(snd_pcm_t *pcm)
 #define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d
 #define 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),
@@ -262,7 +261,7 @@ char *snd_pcm_state_names[] = {
        STATE(PAUSED),
 };
 
-char *snd_pcm_hw_param_names[] = {
+const char *snd_pcm_hw_param_names[] = {
        HW_PARAM(ACCESS),
        HW_PARAM(FORMAT),
        HW_PARAM(SUBFORMAT),
@@ -280,7 +279,7 @@ char *snd_pcm_hw_param_names[] = {
        HW_PARAM(TICK_TIME),
 };
 
-char *snd_pcm_access_names[] = {
+const char *snd_pcm_access_names[] = {
        ACCESS(MMAP_INTERLEAVED), 
        ACCESS(MMAP_NONINTERLEAVED),
        ACCESS(MMAP_COMPLEX),
@@ -288,7 +287,7 @@ char *snd_pcm_access_names[] = {
        ACCESS(RW_NONINTERLEAVED),
 };
 
-char *snd_pcm_format_names[] = {
+const char *snd_pcm_format_names[] = {
        FORMAT(S8),
        FORMAT(U8),
        FORMAT(S16_LE),
@@ -317,7 +316,7 @@ char *snd_pcm_format_names[] = {
        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"),
@@ -346,25 +345,25 @@ char *snd_pcm_format_descriptions[] = {
        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),
 };
@@ -536,15 +535,15 @@ ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, int samples)
        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);
index 0289188718810701f9a92e9c81ed27628151999c..7347ce607f297e654ee71a271b81dc30e01c3e59 100644 (file)
@@ -597,7 +597,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *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;
@@ -618,7 +618,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
                        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);
@@ -652,7 +652,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
        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);
index 7730cb094d1946471887a309c05e3d77c4d26e5d..1f30951f957e134d2f4653b78aa3cca2bbfff859 100644 (file)
@@ -470,7 +470,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *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;
@@ -491,7 +491,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
                        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);
@@ -525,7 +525,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
        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);
index a4b17db65a4766c724dc9b4db69f30e8917d14d4..f0e2b9ea9b2165f64d1d9b289d0e1c8f1bedb029 100644 (file)
@@ -228,7 +228,7 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, char *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_config_foreach(i, conf) {
@@ -259,7 +259,7 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, char *name,
        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);
index 9e461b1ca73e33fdf0950c6082715d89d7373b73..10d66866d2ac027cedc81c3db4d362c63003c94b 100644 (file)
@@ -30,7 +30,7 @@ typedef enum _snd_pcm_file_format {
 typedef struct {
        snd_pcm_t *slave;
        int close_slave;
-       char *fname;
+       const char *fname;
        int fd;
        int format;
        snd_pcm_uframes_t appl_ptr;
@@ -102,7 +102,7 @@ static int snd_pcm_file_close(snd_pcm_t *pcm)
        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);
@@ -403,7 +403,7 @@ snd_pcm_fast_ops_t snd_pcm_file_fast_ops = {
        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;
@@ -464,11 +464,11 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, char *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;
-       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);
@@ -526,7 +526,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, char *name,
        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);
index d53c48be884ae0cdf84d3da8ede30cc92817734c..edcdf9b18a087fa828e4c3ea0703a3e72478c00a 100644 (file)
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <signal.h>
 #include <string.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
@@ -664,7 +663,7 @@ int snd_pcm_hw_open_device(snd_pcm_t **pcmp, int card, int device, snd_pcm_strea
        return snd_pcm_hw_open_subdevice(pcmp, card, device, -1, stream, mode);
 }
 
-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)
@@ -679,7 +678,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
 {
        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);
index cd2e38cc77f1b7c6d6a22666ade0b0b298c82c50..1e9639f294cb6aa88f270dc3f372335760121838 100644 (file)
@@ -368,7 +368,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *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;
@@ -389,7 +389,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
                        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);
@@ -422,7 +422,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
        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);
index 01bb67c763b622e5b938bd98cca6dfbebb5f6c1a..93b4dff312b6865372e49b95a1d48f2b4ae28ba1 100644 (file)
  *
  */
 
-#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
@@ -167,11 +165,11 @@ struct _snd_pcm {
        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);
index 6a88587c7099cfa09cb4836b586235838eeda6e0..116fb3351ae80167b4994bc451b45829c1f49933 100644 (file)
@@ -22,6 +22,7 @@
 #include "pcm_local.h"
 
 
+
 size_t snd_pcm_access_mask_sizeof()
 {
        return sizeof(snd_pcm_access_mask_t);
@@ -30,7 +31,7 @@ size_t snd_pcm_access_mask_sizeof()
 int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr)
 {
        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;
@@ -81,7 +82,7 @@ size_t snd_pcm_format_mask_sizeof()
 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;
@@ -132,7 +133,7 @@ size_t snd_pcm_subformat_mask_sizeof()
 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;
@@ -183,7 +184,7 @@ size_t snd_pcm_hw_params_sizeof()
 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;
@@ -205,9 +206,14 @@ snd_pcm_access_t snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params)
        return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_ACCESS, NULL));
 }
 
-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)
@@ -220,9 +226,9 @@ snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_pa
        return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_ACCESS, NULL));
 }
 
-int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_access_mask_t *mask)
+int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask)
 {
-       return snd_pcm_hw_param_set_mask(pcm, params, mode, SND_PCM_HW_PARAM_ACCESS, (snd_mask_t *) mask);
+       return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_ACCESS, (snd_mask_t *) mask);
 }
 
 
@@ -231,9 +237,14 @@ snd_pcm_format_t snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params)
        return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, NULL));
 }
 
-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)
@@ -246,20 +257,25 @@ snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_pa
        return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_FORMAT, NULL));
 }
 
-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)
@@ -272,9 +288,9 @@ snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm
        return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, NULL));
 }
 
-int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_subformat_mask_t *mask)
+int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask)
 {
-       return snd_pcm_hw_param_set_mask(pcm, params, mode, SND_PCM_HW_PARAM_SUBFORMAT, (snd_mask_t *) mask);
+       return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_SUBFORMAT, (snd_mask_t *) mask);
 }
 
 
@@ -293,24 +309,29 @@ unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *param
        return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, NULL);
 }
 
-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)
@@ -344,24 +365,29 @@ unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, i
        return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_RATE, dir);
 }
 
-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)
@@ -395,24 +421,29 @@ unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *pa
        return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, dir);
 }
 
-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)
@@ -446,32 +477,37 @@ snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_
        return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir);
 }
 
-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;
@@ -492,9 +528,9 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm
        return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir);
 }
 
-int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode)
+int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 {
-       return snd_pcm_hw_param_set_integer(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE);
+       return snd_pcm_hw_param_set_integer(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE);
 }
 
 
@@ -513,24 +549,29 @@ unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params
        return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIODS, dir);
 }
 
-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)
@@ -548,9 +589,9 @@ unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_param
        return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIODS, dir);
 }
 
-int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode)
+int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 {
-       return snd_pcm_hw_param_set_integer(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS);
+       return snd_pcm_hw_param_set_integer(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS);
 }
 
 
@@ -569,24 +610,29 @@ unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *pa
        return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_TIME, dir);
 }
 
-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)
@@ -620,32 +666,37 @@ snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_
        return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL);
 }
 
-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;
@@ -682,24 +733,29 @@ unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *para
        return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_TICK_TIME, dir);
 }
 
-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)
@@ -726,7 +782,7 @@ size_t snd_pcm_sw_params_sizeof()
 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;
@@ -875,6 +931,67 @@ snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *
 }
 
 
+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);
@@ -883,7 +1000,7 @@ size_t snd_pcm_info_sizeof()
 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;
@@ -924,19 +1041,19 @@ int snd_pcm_info_get_card(const snd_pcm_info_t *obj)
        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;
@@ -984,64 +1101,3 @@ void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val)
        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;
-}
-
index d2a51dced62a32b3fca34df48f4dc8b071e7815d..e5bd581b8f8122e12e2ea636907a52401ee359cb 100644 (file)
@@ -34,7 +34,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <byteswap.h>
 #include "pcm_local.h"
 #endif
index fcbffbe0db807ef7edf9df2be06255b7db41f761..81af0438cdd41b683ff9ae70913958302bb96a35 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdio.h>
 #include <malloc.h>
 #include <string.h>
-#include <errno.h>
 #include <sys/poll.h>
 #include <sys/mman.h>
 #include <sys/shm.h>
index 0138e36db432da8c38c26fbc98a2a2c59a8015c4..5e9c2874db62acdef47af72c06881082362e6044 100644 (file)
@@ -485,7 +485,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *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;
@@ -506,7 +506,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
                        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);
@@ -540,7 +540,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
        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);
index caffd93fa07f4ad7463a0066dcd9bb9040eeccfa..551b0ea8e37f83c06ee36d0ac95114b8c346fb2b 100644 (file)
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <math.h>
 #include "pcm_local.h"
 
@@ -664,7 +663,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
        idx = 0;
        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) {
@@ -712,7 +711,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
                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);
index 59997b503def7caf44d355de36bb6655ff08469e..e45c9164f850090d05bf06b9bf89ee50935642c3 100644 (file)
@@ -319,7 +319,7 @@ snd_pcm_fast_ops_t snd_pcm_null_fast_ops = {
        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;
index 14aa88719ec24e58fc90ad2bfa73fb30da39c23a..5de07a18a092397cbfeeddebe216407c584ed1b1 100644 (file)
@@ -902,7 +902,7 @@ void snd_pcm_hw_param_refine_near(snd_pcm_t *pcm,
        min = snd_pcm_hw_param_get_min(src, var, &mindir);
        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 ---- */
@@ -968,14 +968,6 @@ int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params)
        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)
 {
index 398f2717474e61d17c89340a5ea0c2c7afefbd6d..c32260e63b99c159215d3e0b5128070d2c6392db 100644 (file)
@@ -574,8 +574,8 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
        if (!(clt_params.format == slv_params.format &&
              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)
@@ -646,7 +646,7 @@ snd_pcm_ops_t snd_pcm_plug_ops = {
 };
 
 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,
@@ -688,7 +688,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
        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;
@@ -700,12 +700,12 @@ int snd_pcm_plug_open_hw(snd_pcm_t **pcmp, char *name, int card, int device, int
 
 #define MAX_CHANNELS 32
 
-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;
@@ -755,7 +755,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, char *name,
        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);
index 8b47ddd84f23b9289c4e432af4c0b506068a38c8..b72f55258f3433f8f85edf739cf295f8f8d9b8e7 100644 (file)
@@ -622,7 +622,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *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;
@@ -644,7 +644,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
                        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);
@@ -685,7 +685,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
        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);
index 4e7b0623649e819c90cc43a090f805a984978939..49f56f6f04d71ca50125ddf20de8dfb3b241c2ea 100644 (file)
@@ -883,7 +883,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *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;
@@ -908,7 +908,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
                        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);
@@ -963,7 +963,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
        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,
index f247a4dec426ce2a1e5a5791d267da567698eeca..1e806c026e3ec026b7eb8581c22b7d621176da40 100644 (file)
@@ -25,7 +25,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <signal.h>
-#include <errno.h>
 #include <math.h>
 #include <sys/socket.h>
 #include <sys/poll.h>
@@ -1181,7 +1180,7 @@ snd_pcm_fast_ops_t snd_pcm_share_fast_ops = {
        mmap_forward: snd_pcm_share_mmap_forward,
 };
 
-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,
@@ -1363,7 +1362,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
                        snd_pcm_stream_t stream, int mode)
 {
        snd_config_iterator_t i;
-       char *sname = NULL;
+       const char *sname = NULL;
        snd_config_t *binding = NULL;
        int err;
        unsigned int idx;
@@ -1391,7 +1390,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
                        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);
index b1f595b3fb534bd2144e1606e0e8f12b3193a436..5fe9d5a1318dd48e547d44067945963c2976a004 100644 (file)
@@ -25,7 +25,6 @@
 #include <limits.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/shm.h>
@@ -564,7 +563,7 @@ static int make_inet_socket(const char *host, int port)
 }
 #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;
@@ -721,11 +720,11 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
                      snd_pcm_stream_t stream, int mode)
 {
        snd_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;
index 6e3b78ea7e4b79845b2e77e5e5fae10822511f0f..db8caf483e833be2eb9c5002828a5f3c27b000f4 100644 (file)
@@ -24,7 +24,6 @@
 #include <stdarg.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <dlfcn.h>
 #include <asm/page.h>
 #include "rawmidi_local.h"
@@ -162,13 +161,13 @@ int snd_rawmidi_params_default(snd_rawmidi_t *rmidi, snd_rawmidi_stream_t stream
 int snd_rawmidi_open(snd_rawmidi_t **rawmidip, char *name, 
                     int 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;
index 561d5cdc854cf7fd7ae04d7728ba385cd62a202e..467777571edb138b1017fc0deea9a788c6bf6070 100644 (file)
@@ -24,7 +24,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "../control/control_local.h"
@@ -276,7 +275,7 @@ int _snd_rawmidi_hw_open(snd_rawmidi_t **handlep, char *name, snd_config_t *conf
 {
        snd_config_iterator_t i;
        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);
index 8904fadf802539b850df94c8ae79df3c388a5929..2e98745805d92440dad49d3ccbe7ec451d42ff22 100644 (file)
  *
  */
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
-#include <errno.h>
 #include "local.h"
 
 typedef struct {
index 2d484d8751f7cd0d312d31f59bb7bc3e2496a0a0..e88c872180e037c0ce8dd995fd181315c5070d4f 100644 (file)
@@ -29,7 +29,7 @@ size_t snd_rawmidi_params_sizeof()
 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;
@@ -98,7 +98,7 @@ size_t snd_rawmidi_info_sizeof()
 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;
@@ -145,19 +145,19 @@ unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj)
        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;
@@ -201,7 +201,7 @@ size_t snd_rawmidi_status_sizeof()
 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;
index dbae1619ed3ae840c48547edb5f311ba6ed81d17..3e7e24133bf78f26f33174fb6139f48367992858 100644 (file)
 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;
index 02a678828bececb28a79462b958b2a3a0a1605e2..ee515f7ff36bded566f6f2ba792dab21c5b8f527 100644 (file)
 #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 */
index eb4513b195d7ee8f5ce4422b8feedfd4d18027f2..59cd165e96c3bc034ac6c4323f936e9e26433821 100644 (file)
@@ -20,7 +20,6 @@
  */
 
 #include <malloc.h>
-#include <errno.h>
 #include "local.h"
 
 
index 965b8c2e1ff77eb78838d729f26d7f5a120c986f..64e79c5920aae27cfeb8d1802f63092b637677f0 100644 (file)
@@ -24,7 +24,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "seq_local.h"
index 5861b2fe48eb23b1fc169b87e3052a0aee5efc1c..45b701d1af27d7c2b8d9c18081e7f9c409e6ae90 100644 (file)
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include "local.h"
index 24e4d78d5268ec2ec27c2609c5d661f94139c497..506ec802595ac5c841a1232636594e10474b59f2 100644 (file)
@@ -6,7 +6,7 @@ int main(void)
 {
        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;
@@ -23,7 +23,7 @@ int main(void)
                        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;
                }
index 9cdd82bed214106c2bf9b8999275ee2fdc025630..b60e144584916a34c997d221796d18cd81494b9a 100644 (file)
@@ -32,7 +32,7 @@ int main(void)
 {
        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" : "");
@@ -45,7 +45,7 @@ int main(void)
                        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;
                }
index e3744c97d80bb78c9be746d2045b9c9e0591a8e1..140899a21ea108554580bd9bedb13c159ad2e7b8 100644 (file)
@@ -108,7 +108,7 @@ int main(void)
 {
        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" : "");
@@ -122,7 +122,7 @@ int main(void)
                        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;
                }