ALSA project - the C library reference: /builddir/build/BUILD/alsa-lib-1.1.8/include/seqmid.h Source File

ALSA project - the C library reference

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
seqmid.h
Go to the documentation of this file.
1
11 /*
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation; either version 2.1 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 *
26 */
27
28 #ifndef __ALSA_SEQMID_H
29 #define __ALSA_SEQMID_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
48 #define snd_seq_ev_clear(ev) \
49 memset(ev, 0, sizeof(snd_seq_event_t))
50
58 #define snd_seq_ev_set_tag(ev,t) \
59 ((ev)->tag = (t))
60
71 #define snd_seq_ev_set_dest(ev,c,p) \
72 ((ev)->dest.client = (c), (ev)->dest.port = (p))
73
82 #define snd_seq_ev_set_subs(ev) \
83 ((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
84 (ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
85
94 #define snd_seq_ev_set_broadcast(ev) \
95 ((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
96 (ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
97
105 #define snd_seq_ev_set_source(ev,p) \
106 ((ev)->source.port = (p))
107
117 #define snd_seq_ev_set_direct(ev) \
118 ((ev)->queue = SND_SEQ_QUEUE_DIRECT)
119
132 #define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
133 ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
134 (ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
135 (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
136 (ev)->time.tick = (ttick),\
137 (ev)->queue = (q))
138
151 #define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
152 ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
153 (ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
154 (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
155 (ev)->time.time = *(rtime),\
156 (ev)->queue = (q))
157
163 #define snd_seq_ev_set_priority(ev, high_prior) \
164 ((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
165 (ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
166
175 #define snd_seq_ev_set_fixed(ev) \
176 ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
177 (ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
178
189 #define snd_seq_ev_set_variable(ev, datalen, dataptr) \
190 ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
191 (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
192 (ev)->data.ext.len = (datalen),\
193 (ev)->data.ext.ptr = (dataptr))
194
205 #define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
206 ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
207 (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
208 (ev)->data.ext.len = (datalen),\
209 (ev)->data.ext.ptr = (dataptr))
210
218 #define snd_seq_ev_set_queue_control(ev, typ, q, val) \
219 ((ev)->type = (typ),\
220 snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
221 (ev)->data.queue.queue = (q),\
222 (ev)->data.queue.param.value = (val))
223
231 #define snd_seq_ev_set_queue_start(ev, q) \
232 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
233
241 #define snd_seq_ev_set_queue_stop(ev, q) \
242 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
243
251 #define snd_seq_ev_set_queue_continue(ev, q) \
252 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
253
260 #define snd_seq_ev_set_queue_tempo(ev, q, val) \
261 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
262
269 #define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
270 ((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
271 snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
272 (ev)->data.queue.queue = (q),\
273 (ev)->data.queue.param.time.time = *(rtime))
274
281 #define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
282 ((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
283 snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
284 (ev)->data.queue.queue = (q),\
285 (ev)->data.queue.param.time.tick = (ttime))
286
287 /* set and send a queue control event */
288 int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
289
296 #define snd_seq_start_queue(seq, q, ev) \
297 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
298
305 #define snd_seq_stop_queue(seq, q, ev) \
306 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
307
314 #define snd_seq_continue_queue(seq, q, ev) \
315 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
316
324 #define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
325 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
326
327 /* create a port - simple version - return the port number */
328 int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
329 unsigned int caps, unsigned int type);
330 /* delete the port */
331 int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
332
333 /* simple subscription between this port and another port
334 (w/o exclusive & time conversion)
335 */
336 int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
337 int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
338 int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
339 int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
340
341 /*
342 * set client information
343 */
344 int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
345 int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
346 int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
347 int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
348 int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
349 /* sync output queue */
350 int snd_seq_sync_output_queue(snd_seq_t *seq);
351
352 /*
353 * parse the given string and get the sequencer address
354 */
355 int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
356
357 /*
358 * reset client input/output pool
359 */
360 int snd_seq_reset_pool_output(snd_seq_t *seq);
361 int snd_seq_reset_pool_input(snd_seq_t *seq);
362
371 #define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
372 ((ev)->type = SND_SEQ_EVENT_NOTE,\
373 snd_seq_ev_set_fixed(ev),\
374 (ev)->data.note.channel = (ch),\
375 (ev)->data.note.note = (key),\
376 (ev)->data.note.velocity = (vel),\
377 (ev)->data.note.duration = (dur))
378
386 #define snd_seq_ev_set_noteon(ev, ch, key, vel) \
387 ((ev)->type = SND_SEQ_EVENT_NOTEON,\
388 snd_seq_ev_set_fixed(ev),\
389 (ev)->data.note.channel = (ch),\
390 (ev)->data.note.note = (key),\
391 (ev)->data.note.velocity = (vel))
392
400 #define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
401 ((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
402 snd_seq_ev_set_fixed(ev),\
403 (ev)->data.note.channel = (ch),\
404 (ev)->data.note.note = (key),\
405 (ev)->data.note.velocity = (vel))
406
414 #define snd_seq_ev_set_keypress(ev,ch,key,vel) \
415 ((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
416 snd_seq_ev_set_fixed(ev),\
417 (ev)->data.note.channel = (ch),\
418 (ev)->data.note.note = (key),\
419 (ev)->data.note.velocity = (vel))
420
428 #define snd_seq_ev_set_controller(ev,ch,cc,val) \
429 ((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
430 snd_seq_ev_set_fixed(ev),\
431 (ev)->data.control.channel = (ch),\
432 (ev)->data.control.param = (cc),\
433 (ev)->data.control.value = (val))
434
441 #define snd_seq_ev_set_pgmchange(ev,ch,val) \
442 ((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
443 snd_seq_ev_set_fixed(ev),\
444 (ev)->data.control.channel = (ch),\
445 (ev)->data.control.value = (val))
446
453 #define snd_seq_ev_set_pitchbend(ev,ch,val) \
454 ((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
455 snd_seq_ev_set_fixed(ev),\
456 (ev)->data.control.channel = (ch),\
457 (ev)->data.control.value = (val))
458
465 #define snd_seq_ev_set_chanpress(ev,ch,val) \
466 ((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
467 snd_seq_ev_set_fixed(ev),\
468 (ev)->data.control.channel = (ch),\
469 (ev)->data.control.value = (val))
470
479 #define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
480 ((ev)->type = SND_SEQ_EVENT_SYSEX,\
481 snd_seq_ev_set_variable(ev, datalen, dataptr))
482
485 #ifdef __cplusplus
486 }
487 #endif
488
489 #endif /* __ALSA_SEQMID_H */
490
snd_seq_connect_from
int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port)
simple subscription (w/o exclusive &amp; time conversion)
Definition: seqmid.c:121
snd_seq_set_client_name
int snd_seq_set_client_name(snd_seq_t *seq, const char *name)
set client name
Definition: seqmid.c:228
snd_seq_disconnect_from
int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port)
simple disconnection
Definition: seqmid.c:175
snd_seq_set_client_pool_output
int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size)
change the output pool size of the given client
Definition: seqmid.c:266
snd_seq_parse_address
int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str)
parse the given string and get the sequencer address
Definition: seqmid.c:389
snd_seq_disconnect_to
int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port)
simple disconnection
Definition: seqmid.c:202
snd_seq_reset_pool_output
int snd_seq_reset_pool_output(snd_seq_t *seq)
reset client output pool
Definition: seqmid.c:322
snd_seq_set_client_pool_input
int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size)
change the input pool size of the given client
Definition: seqmid.c:304
snd_seq_connect_to
int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port)
simple subscription (w/o exclusive &amp; time conversion)
Definition: seqmid.c:148
snd_seq_addr_t
Definition: seq_event.h:178
snd_seq_delete_simple_port
int snd_seq_delete_simple_port(snd_seq_t *seq, int port)
delete the port
Definition: seqmid.c:103
snd_seq_t
struct _snd_seq snd_seq_t
Definition: seq.h:47
snd_seq_control_queue
int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev)
queue controls - start/stop/continue
Definition: seqmid.c:48
snd_seq_create_simple_port
int snd_seq_create_simple_port(snd_seq_t *seq, const char *name, unsigned int caps, unsigned int type)
create a port - simple version
Definition: seqmid.c:73
snd_seq_reset_pool_input
int snd_seq_reset_pool_input(snd_seq_t *seq)
reset client input pool
Definition: seqmid.c:334
snd_seq_sync_output_queue
int snd_seq_sync_output_queue(snd_seq_t *seq)
wait until all events are processed
Definition: seqmid.c:348
snd_seq_event_t
Definition: seq_event.h:296
snd_seq_set_client_event_filter
int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type)
add client event filter
Definition: seqmid.c:247
snd_seq_set_client_pool_output_room
int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size)
change the output room size of the given client
Definition: seqmid.c:285