6 * \defgroup SeqGlobal Sequencer System
7 * Global System Interface
12 /** Sequencer handle */
13 typedef struct _snd_seq snd_seq_t;
16 #define SND_ALLOCA(type,ptr) \
19 *ptr = (type##_t *)alloca(type##_sizeof());\
20 memset(*ptr, 0, type##_sizeof());\
24 * sequencer opening stream types
26 #define SND_SEQ_OPEN_OUTPUT 1 /**< open for output (write) */
27 #define SND_SEQ_OPEN_INPUT 2 /**< open for input (read) */
28 #define SND_SEQ_OPEN_DUPLEX (SND_SEQ_OPEN_OUTPUT|SND_SEQ_OPEN_INPUT) /**< open for both input and output (read/write) */
31 * sequencer opening mode
33 #define SND_SEQ_NONBLOCK 1 /**< non-blocking mode */
35 /** sequencer handle type */
36 typedef enum _snd_seq_type {
37 SND_SEQ_TYPE_HW, /**< hardware */
38 SND_SEQ_TYPE_SHM, /**< shared memory (NYI) */
39 SND_SEQ_TYPE_INET, /**< network (NYI) */
42 /** special client (port) ids */
43 #define SND_SEQ_ADDRESS_UNKNOWN 253 /**< unknown source */
44 #define SND_SEQ_ADDRESS_SUBSCRIBERS 254 /**< send event to all subscribed ports */
45 #define SND_SEQ_ADDRESS_BROADCAST 255 /**< send event to all queues/clients/ports/channels */
47 /** known client numbers */
48 #define SND_SEQ_CLIENT_SYSTEM 0 /**< system client */
49 #define SND_SEQ_CLIENT_DUMMY 62 /**< dummy ports */
50 #define SND_SEQ_CLIENT_OSS 63 /**< oss sequencer emulator */
54 int snd_seq_open(snd_seq_t **handle, const char *name, int streams, int mode);
55 const char *snd_seq_name(snd_seq_t *seq);
56 snd_seq_type_t snd_seq_type(snd_seq_t *seq);
57 int snd_seq_close(snd_seq_t *handle);
58 int snd_seq_poll_descriptors_count(snd_seq_t *handle, short events);
59 int snd_seq_poll_descriptors(snd_seq_t *handle, struct pollfd *pfds, unsigned int space, short events);
60 int snd_seq_nonblock(snd_seq_t *handle, int nonblock);
61 int snd_seq_client_id(snd_seq_t *handle);
63 size_t snd_seq_get_output_buffer_size(snd_seq_t *handle);
64 size_t snd_seq_get_input_buffer_size(snd_seq_t *handle);
65 int snd_seq_set_output_buffer_size(snd_seq_t *handle, size_t size);
66 int snd_seq_set_input_buffer_size(snd_seq_t *handle, size_t size);
68 /** system information container */
69 typedef struct _snd_seq_system_info snd_seq_system_info_t;
71 size_t snd_seq_system_info_sizeof(void);
72 /** allocate a #snd_seq_system_info_t container on stack */
73 #define snd_seq_system_info_alloca(ptr) \
74 SND_ALLOCA(snd_seq_system_info, ptr)
75 int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);
76 void snd_seq_system_info_free(snd_seq_system_info_t *ptr);
77 void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);
79 int snd_seq_system_info_get_queues(const snd_seq_system_info_t *info);
80 int snd_seq_system_info_get_clients(const snd_seq_system_info_t *info);
81 int snd_seq_system_info_get_ports(const snd_seq_system_info_t *info);
82 int snd_seq_system_info_get_channels(const snd_seq_system_info_t *info);
84 int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t *info);
90 * \defgroup SeqClient Sequencer Client Interface
91 * Sequencer Client Interface
96 /** client information container */
97 typedef struct _snd_seq_client_info snd_seq_client_info_t;
100 typedef enum snd_seq_client_type {
101 SND_SEQ_USER_CLIENT = 1, /**< user client */
102 SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */
103 } snd_seq_client_type_t;
105 size_t snd_seq_client_info_sizeof(void);
106 /** allocate a #snd_seq_client_info_t container on stack */
107 #define snd_seq_client_info_alloca(ptr) \
108 SND_ALLOCA(snd_seq_client_info, ptr)
109 int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);
110 void snd_seq_client_info_free(snd_seq_client_info_t *ptr);
111 void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);
113 int snd_seq_client_info_get_client(const snd_seq_client_info_t *info);
114 snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *info);
115 const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info);
116 int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info);
117 int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info);
118 const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info);
119 int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);
120 int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);
122 void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);
123 void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);
124 void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val);
125 void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);
126 void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);
128 int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
129 int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);
130 int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
131 int snd_seq_query_next_client(snd_seq_t *handle, snd_seq_client_info_t *info);
136 /** client pool information container */
137 typedef struct _snd_seq_client_pool snd_seq_client_pool_t;
139 size_t snd_seq_client_pool_sizeof(void);
140 /** allocate a #snd_seq_client_pool_t container on stack */
141 #define snd_seq_client_pool_alloca(ptr) \
142 SND_ALLOCA(snd_seq_client_pool, ptr)
143 int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);
144 void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);
145 void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);
147 int snd_seq_client_pool_get_client(const snd_seq_client_pool_t *info);
148 size_t snd_seq_client_pool_get_output_pool(const snd_seq_client_pool_t *info);
149 size_t snd_seq_client_pool_get_input_pool(const snd_seq_client_pool_t *info);
150 size_t snd_seq_client_pool_get_output_room(const snd_seq_client_pool_t *info);
151 size_t snd_seq_client_pool_get_output_free(const snd_seq_client_pool_t *info);
152 size_t snd_seq_client_pool_get_input_free(const snd_seq_client_pool_t *info);
153 void snd_seq_client_pool_set_output_pool(snd_seq_client_pool_t *info, size_t size);
154 void snd_seq_client_pool_set_input_pool(snd_seq_client_pool_t *info, size_t size);
155 void snd_seq_client_pool_set_output_room(snd_seq_client_pool_t *info, size_t size);
157 int snd_seq_get_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
158 int snd_seq_set_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
165 * \defgroup SeqPort Sequencer Port Interface
166 * Sequencer Port Interface
171 /** port information container */
172 typedef struct _snd_seq_port_info snd_seq_port_info_t;
174 /** known port numbers */
175 #define SND_SEQ_PORT_SYSTEM_TIMER 0 /**< system timer port */
176 #define SND_SEQ_PORT_SYSTEM_ANNOUNCE 1 /**< sysem announce port */
178 /** port capabilities (32 bits) */
179 #define SND_SEQ_PORT_CAP_READ (1<<0) /**< readable from this port */
180 #define SND_SEQ_PORT_CAP_WRITE (1<<1) /**< writable to this port */
182 #define SND_SEQ_PORT_CAP_SYNC_READ (1<<2) /**< allow read subscriptions */
183 #define SND_SEQ_PORT_CAP_SYNC_WRITE (1<<3) /**< allow write subscriptions */
185 #define SND_SEQ_PORT_CAP_DUPLEX (1<<4) /**< allow read/write duplex */
187 #define SND_SEQ_PORT_CAP_SUBS_READ (1<<5) /**< allow read subscription */
188 #define SND_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /**< allow write subscription */
189 #define SND_SEQ_PORT_CAP_NO_EXPORT (1<<7) /**< routing not allowed */
192 #define SND_SEQ_PORT_TYPE_SPECIFIC (1<<0) /**< hardware specific */
193 #define SND_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /**< generic MIDI device */
194 #define SND_SEQ_PORT_TYPE_MIDI_GM (1<<2) /**< General MIDI compatible device */
195 #define SND_SEQ_PORT_TYPE_MIDI_GS (1<<3) /**< GS compatible device */
196 #define SND_SEQ_PORT_TYPE_MIDI_XG (1<<4) /**< XG compatible device */
197 #define SND_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /**< MT-32 compatible device */
198 #define SND_SEQ_PORT_TYPE_SYNTH (1<<10) /**< Synth device */
199 #define SND_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /**< Sampling device (support sample download) */
200 #define SND_SEQ_PORT_TYPE_SAMPLE (1<<12) /**< Sampling device (sample can be downloaded at any time) */
201 #define SND_SEQ_PORT_TYPE_APPLICATION (1<<20) /**< application (sequencer/editor) */
204 size_t snd_seq_port_info_sizeof(void);
205 /** allocate a #snd_seq_port_info_t container on stack */
206 #define snd_seq_port_info_alloca(ptr) \
207 SND_ALLOCA(snd_seq_port_info, ptr)
208 int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr);
209 void snd_seq_port_info_free(snd_seq_port_info_t *ptr);
210 void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src);
212 int snd_seq_port_info_get_client(const snd_seq_port_info_t *info);
213 int snd_seq_port_info_get_port(const snd_seq_port_info_t *info);
214 const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info);
215 const char *snd_seq_port_info_get_name(const snd_seq_port_info_t *info);
216 unsigned int snd_seq_port_info_get_capability(const snd_seq_port_info_t *info);
217 unsigned int snd_seq_port_info_get_type(const snd_seq_port_info_t *info);
218 int snd_seq_port_info_get_midi_channels(const snd_seq_port_info_t *info);
219 int snd_seq_port_info_get_midi_voices(const snd_seq_port_info_t *info);
220 int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info);
221 int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info);
222 int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info);
223 int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);
225 void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);
226 void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);
227 void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr);
228 void snd_seq_port_info_set_name(snd_seq_port_info_t *info, const char *name);
229 void snd_seq_port_info_set_capability(snd_seq_port_info_t *info, unsigned int capability);
230 void snd_seq_port_info_set_type(snd_seq_port_info_t *info, unsigned int type);
231 void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels);
232 void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices);
233 void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices);
234 void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);
236 int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
237 int snd_seq_delete_port(snd_seq_t *handle, int port);
238 int snd_seq_get_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
239 int snd_seq_get_any_port_info(snd_seq_t *handle, int client, int port, snd_seq_port_info_t *info);
240 int snd_seq_set_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
241 int snd_seq_query_next_port(snd_seq_t *handle, snd_seq_port_info_t *info);
247 * \defgroup SeqSubscribe Sequencer Port Subscription
248 * Sequencer Port Subscription
253 /** port subscription container */
254 typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t;
256 size_t snd_seq_port_subscribe_sizeof(void);
257 /** allocate a #snd_seq_port_subscribe_t container on stack */
258 #define snd_seq_port_subscribe_alloca(ptr) \
259 SND_ALLOCA(snd_seq_port_subscribe, ptr)
260 int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr);
261 void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr);
262 void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src);
264 const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info);
265 const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info);
266 int snd_seq_port_subscribe_get_queue(const snd_seq_port_subscribe_t *info);
267 int snd_seq_port_subscribe_get_exclusive(const snd_seq_port_subscribe_t *info);
268 int snd_seq_port_subscribe_get_time_update(const snd_seq_port_subscribe_t *info);
269 int snd_seq_port_subscribe_get_time_real(const snd_seq_port_subscribe_t *info);
271 void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
272 void snd_seq_port_subscribe_set_dest(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
273 void snd_seq_port_subscribe_set_queue(snd_seq_port_subscribe_t *info, int q);
274 void snd_seq_port_subscribe_set_exclusive(snd_seq_port_subscribe_t *info, int val);
275 void snd_seq_port_subscribe_set_time_update(snd_seq_port_subscribe_t *info, int val);
276 void snd_seq_port_subscribe_set_time_real(snd_seq_port_subscribe_t *info, int val);
278 int snd_seq_get_port_subscription(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
279 int snd_seq_subscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
280 int snd_seq_unsubscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
285 /** subscription query container */
286 typedef struct _snd_seq_query_subscribe snd_seq_query_subscribe_t;
288 /** type of query subscription */
290 SND_SEQ_QUERY_SUBS_READ, /**< query read subscriptions */
291 SND_SEQ_QUERY_SUBS_WRITE /**< query write subscriptions */
292 } snd_seq_query_subs_type_t;
294 size_t snd_seq_query_subscribe_sizeof(void);
295 /** allocate a #snd_seq_query_subscribe_t container on stack */
296 #define snd_seq_query_subscribe_alloca(ptr) \
297 SND_ALLOCA(snd_seq_query_subscribe, ptr)
298 int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr);
299 void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr);
300 void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src);
302 int snd_seq_query_subscribe_get_client(const snd_seq_query_subscribe_t *info);
303 int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info);
304 const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info);
305 snd_seq_query_subs_type_t snd_seq_query_subscribe_get_type(const snd_seq_query_subscribe_t *info);
306 int snd_seq_query_subscribe_get_index(const snd_seq_query_subscribe_t *info);
307 int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info);
308 const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info);
309 int snd_seq_query_subscribe_get_queue(const snd_seq_query_subscribe_t *info);
310 int snd_seq_query_subscribe_get_exclusive(const snd_seq_query_subscribe_t *info);
311 int snd_seq_query_subscribe_get_time_update(const snd_seq_query_subscribe_t *info);
312 int snd_seq_query_subscribe_get_time_real(const snd_seq_query_subscribe_t *info);
314 void snd_seq_query_subscribe_set_client(snd_seq_query_subscribe_t *info, int client);
315 void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port);
316 void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr);
317 void snd_seq_query_subscribe_set_type(snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type);
318 void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int index);
320 int snd_seq_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);
326 * \defgroup SeqQueue Sequencer Queue Interface
327 * Sequencer Queue Interface
332 /** queue information container */
333 typedef struct _snd_seq_queue_info snd_seq_queue_info_t;
334 /** queue status container */
335 typedef struct _snd_seq_queue_status snd_seq_queue_status_t;
336 /** queue tempo container */
337 typedef struct _snd_seq_queue_tempo snd_seq_queue_tempo_t;
338 /** queue timer information container */
339 typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t;
341 /** special queue ids */
342 #define SND_SEQ_QUEUE_DIRECT 253 /**< direct dispatch */
344 size_t snd_seq_queue_info_sizeof(void);
345 /** allocate a #snd_seq_queue_info_t container on stack */
346 #define snd_seq_queue_info_alloca(ptr) \
347 SND_ALLOCA(snd_seq_queue_info, ptr)
348 int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr);
349 void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr);
350 void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src);
352 int snd_seq_queue_info_get_queue(const snd_seq_queue_info_t *info);
353 const char *snd_seq_queue_info_get_name(const snd_seq_queue_info_t *info);
354 int snd_seq_queue_info_get_owner(const snd_seq_queue_info_t *info);
355 int snd_seq_queue_info_get_locked(const snd_seq_queue_info_t *info);
356 unsigned int snd_seq_queue_info_get_flags(const snd_seq_queue_info_t *info);
358 void snd_seq_queue_info_set_name(snd_seq_queue_info_t *info, const char *name);
359 void snd_seq_queue_info_set_owner(snd_seq_queue_info_t *info, int owner);
360 void snd_seq_queue_info_set_locked(snd_seq_queue_info_t *info, int locked);
361 void snd_seq_queue_info_set_flags(snd_seq_queue_info_t *info, unsigned int flags);
363 int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info);
364 int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name);
365 int snd_seq_alloc_queue(snd_seq_t *handle);
366 int snd_seq_free_queue(snd_seq_t *handle, int q);
367 int snd_seq_get_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
368 int snd_seq_set_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
369 int snd_seq_query_named_queue(snd_seq_t *seq, const char *name);
371 int snd_seq_get_queue_usage(snd_seq_t *handle, int q);
372 int snd_seq_set_queue_usage(snd_seq_t *handle, int q, int used);
376 size_t snd_seq_queue_status_sizeof(void);
377 /** allocate a #snd_seq_queue_status_t container on stack */
378 #define snd_seq_queue_status_alloca(ptr) \
379 SND_ALLOCA(snd_seq_queue_status, ptr)
380 int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr);
381 void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr);
382 void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src);
384 int snd_seq_queue_status_get_queue(const snd_seq_queue_status_t *info);
385 int snd_seq_queue_status_get_events(const snd_seq_queue_status_t *info);
386 snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t *info);
387 const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info);
388 unsigned int snd_seq_queue_status_get_status(const snd_seq_queue_status_t *info);
390 int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *status);
394 size_t snd_seq_queue_tempo_sizeof(void);
395 /** allocate a #snd_seq_queue_tempo_t container on stack */
396 #define snd_seq_queue_tempo_alloca(ptr) \
397 SND_ALLOCA(snd_seq_queue_tempo, ptr)
398 int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr);
399 void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr);
400 void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src);
402 int snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t *info);
403 unsigned int snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t *info);
404 int snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t *info);
405 void snd_seq_queue_tempo_set_tempo(snd_seq_queue_tempo_t *info, unsigned int tempo);
406 void snd_seq_queue_tempo_set_ppq(snd_seq_queue_tempo_t *info, int ppq);
408 int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
409 int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
413 size_t snd_seq_queue_timer_sizeof(void);
414 /** allocate a #snd_seq_queue_timer_t container on stack */
415 #define snd_seq_queue_timer_alloca(ptr) \
416 SND_ALLOCA(snd_seq_queue_timer, ptr)
417 int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr);
418 void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr);
419 void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src);
421 int snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t *info);
422 int snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t *info);
423 const snd_timer_id_t *snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t *info);
424 unsigned int snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t *info);
426 void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, int type);
427 void snd_seq_queue_timer_set_id(snd_seq_queue_timer_t *info, const snd_timer_id_t *id);
428 void snd_seq_queue_timer_set_resolution(snd_seq_queue_timer_t *info, unsigned int resolution);
430 int snd_seq_get_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
431 int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
436 * \defgroup SeqEvent Sequencer Event API
437 * Sequencer Event API
442 snd_seq_event_t *snd_seq_create_event(void);
443 int snd_seq_free_event(snd_seq_event_t *ev);
444 ssize_t snd_seq_event_length(snd_seq_event_t *ev);
445 int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
446 int snd_seq_event_output_buffer(snd_seq_t *handle, snd_seq_event_t *ev);
447 int snd_seq_event_output_direct(snd_seq_t *handle, snd_seq_event_t *ev);
448 int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);
449 int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer);
450 int snd_seq_drain_output(snd_seq_t *handle);
451 int snd_seq_event_output_pending(snd_seq_t *seq);
452 int snd_seq_extract_output(snd_seq_t *handle, snd_seq_event_t **ev);
453 int snd_seq_drop_output(snd_seq_t *handle);
454 int snd_seq_drop_output_buffer(snd_seq_t *handle);
455 int snd_seq_drop_input(snd_seq_t *handle);
456 int snd_seq_drop_input_buffer(snd_seq_t *handle);
458 /** event removal conditionals */
459 typedef struct _snd_seq_remove_events snd_seq_remove_events_t;
461 /** Remove conditional flags */
462 #define SND_SEQ_REMOVE_INPUT (1<<0) /**< Flush input queues */
463 #define SND_SEQ_REMOVE_OUTPUT (1<<1) /**< Flush output queues */
464 #define SND_SEQ_REMOVE_DEST (1<<2) /**< Restrict by destination q:client:port */
465 #define SND_SEQ_REMOVE_DEST_CHANNEL (1<<3) /**< Restrict by channel */
466 #define SND_SEQ_REMOVE_TIME_BEFORE (1<<4) /**< Restrict to before time */
467 #define SND_SEQ_REMOVE_TIME_AFTER (1<<5) /**< Restrict to time or after */
468 #define SND_SEQ_REMOVE_TIME_TICK (1<<6) /**< Time is in ticks */
469 #define SND_SEQ_REMOVE_EVENT_TYPE (1<<7) /**< Restrict to event type */
470 #define SND_SEQ_REMOVE_IGNORE_OFF (1<<8) /**< Do not flush off events */
471 #define SND_SEQ_REMOVE_TAG_MATCH (1<<9) /**< Restrict to events with given tag */
473 size_t snd_seq_remove_events_sizeof(void);
474 /** allocate a #snd_seq_remove_events_t container on stack */
475 #define snd_seq_remove_events_alloca(ptr) \
476 SND_ALLOCA(snd_seq_remove_events, ptr)
477 int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr);
478 void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr);
479 void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src);
481 unsigned int snd_seq_remove_events_get_condition(const snd_seq_remove_events_t *info);
482 int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info);
483 const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info);
484 const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info);
485 int snd_seq_remove_events_get_channel(const snd_seq_remove_events_t *info);
486 int snd_seq_remove_events_get_event_type(const snd_seq_remove_events_t *info);
487 int snd_seq_remove_events_get_tag(const snd_seq_remove_events_t *info);
489 void snd_seq_remove_events_set_condition(snd_seq_remove_events_t *info, unsigned int flags);
490 void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue);
491 void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time);
492 void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr);
493 void snd_seq_remove_events_set_channel(snd_seq_remove_events_t *info, int channel);
494 void snd_seq_remove_events_set_event_type(snd_seq_remove_events_t *info, int type);
495 void snd_seq_remove_events_set_tag(snd_seq_remove_events_t *info, int tag);
497 int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);
502 * \defgroup SeqMisc Sequencer Miscellaneous
503 * Sequencer Mescellaneous
508 void snd_seq_set_bit(int nr, void *array);
509 int snd_seq_change_bit(int nr, void *array);
510 int snd_seq_get_bit(int nr, void *array);
516 * \defgroup SeqEvType Sequencer Event Type Checks
517 * Sequencer Event Type Checks
522 /* event type macros */
524 SND_SEQ_EVFLG_RESULT,
526 SND_SEQ_EVFLG_CONTROL,
528 SND_SEQ_EVFLG_SYSTEM,
529 SND_SEQ_EVFLG_MESSAGE,
530 SND_SEQ_EVFLG_CONNECTION,
531 SND_SEQ_EVFLG_SAMPLE,
538 SND_SEQ_EVFLG_VARIABLE,
539 SND_SEQ_EVFLG_VARUSR,
544 SND_SEQ_EVFLG_NOTE_ONEARG,
545 SND_SEQ_EVFLG_NOTE_TWOARG
549 SND_SEQ_EVFLG_QUEUE_NOARG,
550 SND_SEQ_EVFLG_QUEUE_TICK,
551 SND_SEQ_EVFLG_QUEUE_TIME,
552 SND_SEQ_EVFLG_QUEUE_VALUE
556 * Exported event type table
558 * This table is referred by snd_seq_ev_is_xxx.
560 extern const unsigned int snd_seq_event_types[];
562 #define _SND_SEQ_TYPE(x) (1<<(x)) /**< master type - 24bit */
563 #define _SND_SEQ_TYPE_OPT(x) ((x)<<24) /**< optional type - 8bit */
565 /** check the event type */
566 #define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x))
568 /** event type check: result events */
569 #define snd_seq_ev_is_result_type(ev) \
570 snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT)
571 /** event type check: note events */
572 #define snd_seq_ev_is_note_type(ev) \
573 snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE)
574 /** event type check: control events */
575 #define snd_seq_ev_is_control_type(ev) \
576 snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL)
577 /** event type check: channel specific events */
578 #define snd_seq_ev_is_channel_type(ev) \
579 (snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL)))
581 /** event type check: queue control events */
582 #define snd_seq_ev_is_queue_type(ev) \
583 snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE)
584 /** event type check: system status messages */
585 #define snd_seq_ev_is_message_type(ev) \
586 snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE)
587 /** event type check: system status messages */
588 #define snd_seq_ev_is_subscribe_type(ev) \
589 snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION)
590 /** event type check: sample messages */
591 #define snd_seq_ev_is_sample_type(ev) \
592 snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE)
593 /** event type check: user-defined messages */
594 #define snd_seq_ev_is_user_type(ev) \
595 snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS)
596 /** event type check: instrument layer events */
597 #define snd_seq_ev_is_instr_type(ev) \
598 snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR)
599 /** event type check: fixed length events */
600 #define snd_seq_ev_is_fixed_type(ev) \
601 snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED)
602 /** event type check: variable length events */
603 #define snd_seq_ev_is_variable_type(ev) \
604 snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE)
605 /** event type check: user pointer events */
606 #define snd_seq_ev_is_varusr_type(ev) \
607 snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)
608 /** event type check: ipc events */
609 #define snd_seq_ev_is_varipc_type(ev) \
610 snd_seq_type_check(ev, SND_SEQ_EVFLG_IPC)
611 /** event type check: reserved for kernel */
612 #define snd_seq_ev_is_reserved(ev) \
613 (! snd_seq_event_types[(ev)->type])
616 * macros to check event flags
619 #define snd_seq_ev_is_prior(ev) \
620 (((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH)
622 /** get the data length type */
623 #define snd_seq_ev_length_type(ev) \
624 ((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK)
625 /** fixed length events */
626 #define snd_seq_ev_is_fixed(ev) \
627 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED)
628 /** variable length events */
629 #define snd_seq_ev_is_variable(ev) \
630 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE)
631 /** variable length on user-space */
632 #define snd_seq_ev_is_varusr(ev) \
633 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)
634 /** variable length on IPC shm */
635 #define snd_seq_ev_is_varipc(ev) \
636 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIPC)
638 /** time-stamp type */
639 #define snd_seq_ev_timestamp_type(ev) \
640 ((ev)->flags & SND_SEQ_TIME_STAMP_MASK)
641 /** event is in tick time */
642 #define snd_seq_ev_is_tick(ev) \
643 (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK)
644 /** event is in real-time */
645 #define snd_seq_ev_is_real(ev) \
646 (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL)
648 /** time-mode type */
649 #define snd_seq_ev_timemode_type(ev) \
650 ((ev)->flags & SND_SEQ_TIME_MODE_MASK)
651 /** scheduled in absolute time */
652 #define snd_seq_ev_is_abstime(ev) \
653 (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS)
654 /** scheduled in relative time */
655 #define snd_seq_ev_is_reltime(ev) \
656 (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL)
658 /** direct dispatched events */
659 #define snd_seq_ev_is_direct(ev) \
660 ((ev)->queue == SND_SEQ_QUEUE_DIRECT)