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