1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
|
#ifndef __ALSA_SEQMID_H
#define __ALSA_SEQMID_H
#ifdef __cplusplus
extern "C" {
#endif
#define snd_seq_ev_clear(ev) \
memset(ev, 0, sizeof(snd_seq_event_t))
#define snd_seq_ev_set_tag(ev,t) \
((ev)->tag = (t))
#define snd_seq_ev_set_dest(ev,c,p) \
((ev)->dest.client = (c), (ev)->dest.port = (p))
#define snd_seq_ev_set_subs(ev) \
((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
(ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
#define snd_seq_ev_set_broadcast(ev) \
((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
(ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
#define snd_seq_ev_set_source(ev,p) \
((ev)->source.port = (p))
#define snd_seq_ev_set_direct(ev) \
((ev)->queue = SND_SEQ_QUEUE_DIRECT)
#define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
(ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
(ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
(ev)->time.tick = (ttick),\
(ev)->queue = (q))
#define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
(ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
(ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
(ev)->time.time = *(rtime),\
(ev)->queue = (q))
#define snd_seq_ev_set_priority(ev, high_prior) \
((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
(ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
#define snd_seq_ev_set_fixed(ev) \
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
(ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
#define snd_seq_ev_set_variable(ev, datalen, dataptr) \
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
(ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
(ev)->data.ext.len = (datalen),\
(ev)->data.ext.ptr = (dataptr))
#define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
(ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
(ev)->data.ext.len = (datalen),\
(ev)->data.ext.ptr = (dataptr))
#define snd_seq_ev_set_queue_control(ev, typ, q, val) \
((ev)->type = (typ),\
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.value = (val))
#define snd_seq_ev_set_queue_start(ev, q) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
#define snd_seq_ev_set_queue_stop(ev, q) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
#define snd_seq_ev_set_queue_continue(ev, q) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
#define snd_seq_ev_set_queue_tempo(ev, q, val) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
#define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.time.time = *(rtime))
#define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.time.tick = (ttime))
int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
#define snd_seq_start_queue(seq, q, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
#define snd_seq_stop_queue(seq, q, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
#define snd_seq_continue_queue(seq, q, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
#define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
unsigned int caps, unsigned int type);
int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
int snd_seq_sync_output_queue(snd_seq_t *seq);
int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
int snd_seq_reset_pool_output(snd_seq_t *seq);
int snd_seq_reset_pool_input(snd_seq_t *seq);
#define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
((ev)->type = SND_SEQ_EVENT_NOTE,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel),\
(ev)->data.note.duration = (dur))
#define snd_seq_ev_set_noteon(ev, ch, key, vel) \
((ev)->type = SND_SEQ_EVENT_NOTEON,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel))
#define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel))
#define snd_seq_ev_set_keypress(ev,ch,key,vel) \
((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel))
#define snd_seq_ev_set_controller(ev,ch,cc,val) \
((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.param = (cc),\
(ev)->data.control.value = (val))
#define snd_seq_ev_set_pgmchange(ev,ch,val) \
((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.value = (val))
#define snd_seq_ev_set_pitchbend(ev,ch,val) \
((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.value = (val))
#define snd_seq_ev_set_chanpress(ev,ch,val) \
((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.value = (val))
#define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
((ev)->type = SND_SEQ_EVENT_SYSEX,\
snd_seq_ev_set_variable(ev, datalen, dataptr))
#ifdef __cplusplus
}
#endif
#endif
|