OSDN Git Service

topology: Parse and build private data of physical links
[android-x86/external-alsa-lib.git] / include / seq.h
index 1a56e76..d05940e 100644 (file)
@@ -1,11 +1,12 @@
 /**
- * \file <alsa/seq.h>
+ * \file include/seq.h
  * \brief Application interface library for the ALSA driver
- * \author Jaroslav Kysela <perex@suse.cz>
+ * \author Jaroslav Kysela <perex@perex.cz>
  * \author Abramo Bagnara <abramo@alsa-project.org>
  * \author Takashi Iwai <tiwai@suse.de>
  * \date 1998-2001
- *
+ */
+/*
  * Application interface library for the ALSA driver
  *
  *
@@ -34,7 +35,8 @@ extern "C" {
 
 /**
  *  \defgroup Sequencer MIDI Sequencer
- *  MIDI Sequencer Interface
+ *  MIDI Sequencer Interface.
+ *  See \ref seq page for more details.
  *  \{
  */
 
@@ -44,14 +46,6 @@ extern "C" {
 /** Sequencer handle */
 typedef struct _snd_seq snd_seq_t;
 
-/** \internal */
-#define SND_ALLOCA(type,ptr) \
-do {\
-       assert(ptr);\
-       *ptr = (type##_t *)alloca(type##_sizeof());\
-       memset(*ptr, 0, type##_sizeof());\
-} while (0)
-
 /**
  * sequencer opening stream types
  */
@@ -78,8 +72,6 @@ typedef enum _snd_seq_type {
 
 /** known client numbers */
 #define SND_SEQ_CLIENT_SYSTEM          0       /**< system client */
-#define SND_SEQ_CLIENT_DUMMY           62      /**< dummy ports */
-#define SND_SEQ_CLIENT_OSS             63      /**< oss sequencer emulator */
 
 /*
  */
@@ -105,7 +97,7 @@ typedef struct _snd_seq_system_info snd_seq_system_info_t;
 size_t snd_seq_system_info_sizeof(void);
 /** allocate a #snd_seq_system_info_t container on stack */
 #define snd_seq_system_info_alloca(ptr) \
-       SND_ALLOCA(snd_seq_system_info, ptr)
+       __snd_alloca(ptr, snd_seq_system_info)
 int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);
 void snd_seq_system_info_free(snd_seq_system_info_t *ptr);
 void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);
@@ -141,7 +133,7 @@ typedef enum snd_seq_client_type {
 size_t snd_seq_client_info_sizeof(void);
 /** allocate a #snd_seq_client_info_t container on stack */
 #define snd_seq_client_info_alloca(ptr) \
-       SND_ALLOCA(snd_seq_client_info, ptr)
+       __snd_alloca(ptr, snd_seq_client_info)
 int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);
 void snd_seq_client_info_free(snd_seq_client_info_t *ptr);
 void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);
@@ -151,6 +143,8 @@ snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *
 const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info);
 int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info);
 int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_card(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_pid(const snd_seq_client_info_t *info);
 const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info);
 int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);
 int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);
@@ -161,6 +155,11 @@ void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int v
 void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);
 void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);
 
+void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info);
+void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type);
+void snd_seq_client_info_event_filter_del(snd_seq_client_info_t *info, int event_type);
+int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int event_type);
+
 int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
 int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);
 int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
@@ -175,7 +174,7 @@ typedef struct _snd_seq_client_pool snd_seq_client_pool_t;
 size_t snd_seq_client_pool_sizeof(void);
 /** allocate a #snd_seq_client_pool_t container on stack */
 #define snd_seq_client_pool_alloca(ptr) \
-       SND_ALLOCA(snd_seq_client_pool, ptr)
+       __snd_alloca(ptr, snd_seq_client_pool)
 int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);
 void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);
 void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);
@@ -209,7 +208,7 @@ typedef struct _snd_seq_port_info snd_seq_port_info_t;
 
 /** known port numbers */
 #define SND_SEQ_PORT_SYSTEM_TIMER      0       /**< system timer port */
-#define SND_SEQ_PORT_SYSTEM_ANNOUNCE   1       /**< sysem announce port */
+#define SND_SEQ_PORT_SYSTEM_ANNOUNCE   1       /**< system announce port */
 
 /** port capabilities (32 bits) */
 #define SND_SEQ_PORT_CAP_READ          (1<<0)  /**< readable from this port */
@@ -224,23 +223,47 @@ typedef struct _snd_seq_port_info snd_seq_port_info_t;
 #define SND_SEQ_PORT_CAP_SUBS_WRITE    (1<<6)  /**< allow write subscription */
 #define SND_SEQ_PORT_CAP_NO_EXPORT     (1<<7)  /**< routing not allowed */
 
-/** port type */
-#define SND_SEQ_PORT_TYPE_SPECIFIC     (1<<0)  /**< hardware specific */
-#define SND_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)  /**< generic MIDI device */
-#define SND_SEQ_PORT_TYPE_MIDI_GM      (1<<2)  /**< General MIDI compatible device */
-#define SND_SEQ_PORT_TYPE_MIDI_GS      (1<<3)  /**< GS compatible device */
-#define SND_SEQ_PORT_TYPE_MIDI_XG      (1<<4)  /**< XG compatible device */
-#define SND_SEQ_PORT_TYPE_MIDI_MT32    (1<<5)  /**< MT-32 compatible device */
-#define SND_SEQ_PORT_TYPE_SYNTH                (1<<10) /**< Synth device */
-#define SND_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)        /**< Sampling device (support sample download) */
-#define SND_SEQ_PORT_TYPE_SAMPLE       (1<<12) /**< Sampling device (sample can be downloaded at any time) */
-#define SND_SEQ_PORT_TYPE_APPLICATION  (1<<20) /**< application (sequencer/editor) */
+/* port type */
+/** Messages sent from/to this port have device-specific semantics. */
+#define SND_SEQ_PORT_TYPE_SPECIFIC     (1<<0)
+/** This port understands MIDI messages. */
+#define SND_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)
+/** This port is compatible with the General MIDI specification. */
+#define SND_SEQ_PORT_TYPE_MIDI_GM      (1<<2)
+/** This port is compatible with the Roland GS standard. */
+#define SND_SEQ_PORT_TYPE_MIDI_GS      (1<<3)
+/** This port is compatible with the Yamaha XG specification. */
+#define SND_SEQ_PORT_TYPE_MIDI_XG      (1<<4)
+/** This port is compatible with the Roland MT-32. */
+#define SND_SEQ_PORT_TYPE_MIDI_MT32    (1<<5)
+/** This port is compatible with the General MIDI 2 specification. */
+#define SND_SEQ_PORT_TYPE_MIDI_GM2     (1<<6)
+/** This port understands SND_SEQ_EVENT_SAMPLE_xxx messages
+    (these are not MIDI messages). */
+#define SND_SEQ_PORT_TYPE_SYNTH                (1<<10)
+/** Instruments can be downloaded to this port
+    (with SND_SEQ_EVENT_INSTR_xxx messages sent directly). */
+#define SND_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)
+/** Instruments can be downloaded to this port
+    (with SND_SEQ_EVENT_INSTR_xxx messages sent directly or through a queue). */
+#define SND_SEQ_PORT_TYPE_SAMPLE       (1<<12)
+/** This port is implemented in hardware. */
+#define SND_SEQ_PORT_TYPE_HARDWARE     (1<<16)
+/** This port is implemented in software. */
+#define SND_SEQ_PORT_TYPE_SOFTWARE     (1<<17)
+/** Messages sent to this port will generate sounds. */
+#define SND_SEQ_PORT_TYPE_SYNTHESIZER  (1<<18)
+/** This port may connect to other devices
+    (whose characteristics are not known). */
+#define SND_SEQ_PORT_TYPE_PORT         (1<<19)
+/** This port belongs to an application, such as a sequencer or editor. */
+#define SND_SEQ_PORT_TYPE_APPLICATION  (1<<20)
 
 
 size_t snd_seq_port_info_sizeof(void);
 /** allocate a #snd_seq_port_info_t container on stack */
 #define snd_seq_port_info_alloca(ptr) \
-       SND_ALLOCA(snd_seq_port_info, ptr)
+       __snd_alloca(ptr, snd_seq_port_info)
 int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr);
 void snd_seq_port_info_free(snd_seq_port_info_t *ptr);
 void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src);
@@ -257,6 +280,9 @@ int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info);
 int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info);
 int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info);
 int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info);
 
 void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);
 void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);
@@ -268,6 +294,9 @@ void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels
 void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices);
 void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices);
 void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);
+void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable);
+void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int realtime);
+void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue);
 
 int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
 int snd_seq_delete_port(snd_seq_t *handle, int port);
@@ -292,7 +321,7 @@ typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t;
 size_t snd_seq_port_subscribe_sizeof(void);
 /** allocate a #snd_seq_port_subscribe_t container on stack */
 #define snd_seq_port_subscribe_alloca(ptr) \
-       SND_ALLOCA(snd_seq_port_subscribe, ptr)
+       __snd_alloca(ptr, snd_seq_port_subscribe)
 int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr);
 void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr);
 void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src);
@@ -330,7 +359,7 @@ typedef enum {
 size_t snd_seq_query_subscribe_sizeof(void);
 /** allocate a #snd_seq_query_subscribe_t container on stack */
 #define snd_seq_query_subscribe_alloca(ptr) \
-       SND_ALLOCA(snd_seq_query_subscribe, ptr)
+       __snd_alloca(ptr, snd_seq_query_subscribe)
 int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr);
 void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr);
 void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src);
@@ -351,7 +380,7 @@ void snd_seq_query_subscribe_set_client(snd_seq_query_subscribe_t *info, int cli
 void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port);
 void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr);
 void snd_seq_query_subscribe_set_type(snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type);
-void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int index);
+void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int _index);
 
 int snd_seq_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);
 
@@ -380,7 +409,7 @@ typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t;
 size_t snd_seq_queue_info_sizeof(void);
 /** allocate a #snd_seq_queue_info_t container on stack */
 #define snd_seq_queue_info_alloca(ptr) \
-       SND_ALLOCA(snd_seq_queue_info, ptr)
+       __snd_alloca(ptr, snd_seq_queue_info)
 int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr);
 void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr);
 void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src);
@@ -412,7 +441,7 @@ int snd_seq_set_queue_usage(snd_seq_t *handle, int q, int used);
 size_t snd_seq_queue_status_sizeof(void);
 /** allocate a #snd_seq_queue_status_t container on stack */
 #define snd_seq_queue_status_alloca(ptr) \
-       SND_ALLOCA(snd_seq_queue_status, ptr)
+       __snd_alloca(ptr, snd_seq_queue_status)
 int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr);
 void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr);
 void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src);
@@ -430,7 +459,7 @@ int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *s
 size_t snd_seq_queue_tempo_sizeof(void);
 /** allocate a #snd_seq_queue_tempo_t container on stack */
 #define snd_seq_queue_tempo_alloca(ptr) \
-       SND_ALLOCA(snd_seq_queue_tempo, ptr)
+       __snd_alloca(ptr, snd_seq_queue_tempo)
 int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr);
 void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr);
 void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src);
@@ -461,7 +490,7 @@ typedef enum {
 size_t snd_seq_queue_timer_sizeof(void);
 /** allocate a #snd_seq_queue_timer_t container on stack */
 #define snd_seq_queue_timer_alloca(ptr) \
-       SND_ALLOCA(snd_seq_queue_timer, ptr)
+       __snd_alloca(ptr, snd_seq_queue_timer)
 int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr);
 void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr);
 void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src);
@@ -487,7 +516,6 @@ int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *tim
  *  \{
  */
 
-snd_seq_event_t *snd_seq_create_event(void);
 int snd_seq_free_event(snd_seq_event_t *ev);
 ssize_t snd_seq_event_length(snd_seq_event_t *ev);
 int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
@@ -521,7 +549,7 @@ typedef struct _snd_seq_remove_events snd_seq_remove_events_t;
 size_t snd_seq_remove_events_sizeof(void);
 /** allocate a #snd_seq_remove_events_t container on stack */
 #define snd_seq_remove_events_alloca(ptr) \
-       SND_ALLOCA(snd_seq_remove_events, ptr)
+       __snd_alloca(ptr, snd_seq_remove_events)
 int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr);
 void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr);
 void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src);
@@ -548,12 +576,13 @@ int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);
 
 /**
  *  \defgroup SeqMisc Sequencer Miscellaneous
- *  Sequencer Mescellaneous
+ *  Sequencer Miscellaneous
  *  \ingroup Sequencer
  *  \{
  */
 
 void snd_seq_set_bit(int nr, void *array);
+void snd_seq_unset_bit(int nr, void *array);
 int snd_seq_change_bit(int nr, void *array);
 int snd_seq_get_bit(int nr, void *array);
 
@@ -584,8 +613,7 @@ enum {
        SND_SEQ_EVFLG_RAW,
        SND_SEQ_EVFLG_FIXED,
        SND_SEQ_EVFLG_VARIABLE,
-       SND_SEQ_EVFLG_VARUSR,
-       SND_SEQ_EVFLG_IPC
+       SND_SEQ_EVFLG_VARUSR
 };
 
 enum {
@@ -653,9 +681,6 @@ extern const unsigned int snd_seq_event_types[];
 /** event type check: user pointer events */
 #define snd_seq_ev_is_varusr_type(ev) \
        snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)
-/** event type check: ipc events */
-#define snd_seq_ev_is_varipc_type(ev) \
-       snd_seq_type_check(ev, SND_SEQ_EVFLG_IPC)
 /** event type check: reserved for kernel */
 #define snd_seq_ev_is_reserved(ev) \
        (! snd_seq_event_types[(ev)->type])
@@ -679,9 +704,6 @@ extern const unsigned int snd_seq_event_types[];
 /** variable length on user-space */
 #define snd_seq_ev_is_varusr(ev) \
        (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)
-/** variable length on IPC shm */
-#define snd_seq_ev_is_varipc(ev) \
-       (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIPC)
 
 /** time-stamp type */
 #define snd_seq_ev_timestamp_type(ev) \