1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef _UAPI__SOUND_ASEQUENCER_H
24#define _UAPI__SOUND_ASEQUENCER_H
25
26#include <sound/asound.h>
27
28
29#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2)
30
31
32
33
34
35
36
37
38#define SNDRV_SEQ_EVENT_SYSTEM 0
39#define SNDRV_SEQ_EVENT_RESULT 1
40
41
42
43
44#define SNDRV_SEQ_EVENT_NOTE 5
45#define SNDRV_SEQ_EVENT_NOTEON 6
46#define SNDRV_SEQ_EVENT_NOTEOFF 7
47#define SNDRV_SEQ_EVENT_KEYPRESS 8
48
49
50
51
52#define SNDRV_SEQ_EVENT_CONTROLLER 10
53#define SNDRV_SEQ_EVENT_PGMCHANGE 11
54#define SNDRV_SEQ_EVENT_CHANPRESS 12
55#define SNDRV_SEQ_EVENT_PITCHBEND 13
56#define SNDRV_SEQ_EVENT_CONTROL14 14
57#define SNDRV_SEQ_EVENT_NONREGPARAM 15
58#define SNDRV_SEQ_EVENT_REGPARAM 16
59
60
61
62
63#define SNDRV_SEQ_EVENT_SONGPOS 20
64#define SNDRV_SEQ_EVENT_SONGSEL 21
65#define SNDRV_SEQ_EVENT_QFRAME 22
66#define SNDRV_SEQ_EVENT_TIMESIGN 23
67#define SNDRV_SEQ_EVENT_KEYSIGN 24
68
69
70
71
72#define SNDRV_SEQ_EVENT_START 30
73#define SNDRV_SEQ_EVENT_CONTINUE 31
74#define SNDRV_SEQ_EVENT_STOP 32
75#define SNDRV_SEQ_EVENT_SETPOS_TICK 33
76#define SNDRV_SEQ_EVENT_SETPOS_TIME 34
77#define SNDRV_SEQ_EVENT_TEMPO 35
78#define SNDRV_SEQ_EVENT_CLOCK 36
79#define SNDRV_SEQ_EVENT_TICK 37
80#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38
81
82
83
84
85#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40
86#define SNDRV_SEQ_EVENT_RESET 41
87#define SNDRV_SEQ_EVENT_SENSING 42
88
89
90
91
92#define SNDRV_SEQ_EVENT_ECHO 50
93#define SNDRV_SEQ_EVENT_OSS 51
94
95
96
97
98#define SNDRV_SEQ_EVENT_CLIENT_START 60
99#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61
100#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62
101#define SNDRV_SEQ_EVENT_PORT_START 63
102#define SNDRV_SEQ_EVENT_PORT_EXIT 64
103#define SNDRV_SEQ_EVENT_PORT_CHANGE 65
104
105
106
107
108#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66
109#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67
110
111
112
113
114
115
116#define SNDRV_SEQ_EVENT_USR0 90
117#define SNDRV_SEQ_EVENT_USR1 91
118#define SNDRV_SEQ_EVENT_USR2 92
119#define SNDRV_SEQ_EVENT_USR3 93
120#define SNDRV_SEQ_EVENT_USR4 94
121#define SNDRV_SEQ_EVENT_USR5 95
122#define SNDRV_SEQ_EVENT_USR6 96
123#define SNDRV_SEQ_EVENT_USR7 97
124#define SNDRV_SEQ_EVENT_USR8 98
125#define SNDRV_SEQ_EVENT_USR9 99
126
127
128
129
130
131
132
133
134#define SNDRV_SEQ_EVENT_SYSEX 130
135#define SNDRV_SEQ_EVENT_BOUNCE 131
136
137#define SNDRV_SEQ_EVENT_USR_VAR0 135
138#define SNDRV_SEQ_EVENT_USR_VAR1 136
139#define SNDRV_SEQ_EVENT_USR_VAR2 137
140#define SNDRV_SEQ_EVENT_USR_VAR3 138
141#define SNDRV_SEQ_EVENT_USR_VAR4 139
142
143
144#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
145#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151
146
147
148
149
150
151
152#define SNDRV_SEQ_EVENT_NONE 255
153
154
155typedef unsigned char snd_seq_event_type_t;
156
157
158struct snd_seq_addr {
159 unsigned char client;
160 unsigned char port;
161};
162
163
164struct snd_seq_connect {
165 struct snd_seq_addr sender;
166 struct snd_seq_addr dest;
167};
168
169
170#define SNDRV_SEQ_ADDRESS_UNKNOWN 253
171#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254
172#define SNDRV_SEQ_ADDRESS_BROADCAST 255
173#define SNDRV_SEQ_QUEUE_DIRECT 253
174
175
176#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0)
177#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0)
178#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
179
180#define SNDRV_SEQ_TIME_MODE_ABS (0<<1)
181#define SNDRV_SEQ_TIME_MODE_REL (1<<1)
182#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
183
184#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2)
185#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2)
186#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2)
187#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
188
189#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4)
190#define SNDRV_SEQ_PRIORITY_HIGH (1<<4)
191#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
192
193
194
195struct snd_seq_ev_note {
196 unsigned char channel;
197 unsigned char note;
198 unsigned char velocity;
199 unsigned char off_velocity;
200 unsigned int duration;
201};
202
203
204struct snd_seq_ev_ctrl {
205 unsigned char channel;
206 unsigned char unused1, unused2, unused3;
207 unsigned int param;
208 signed int value;
209};
210
211
212struct snd_seq_ev_raw8 {
213 unsigned char d[12];
214};
215
216
217struct snd_seq_ev_raw32 {
218 unsigned int d[3];
219};
220
221
222struct snd_seq_ev_ext {
223 unsigned int len;
224 void *ptr;
225} __attribute__((packed));
226
227struct snd_seq_result {
228 int event;
229 int result;
230};
231
232
233struct snd_seq_real_time {
234 unsigned int tv_sec;
235 unsigned int tv_nsec;
236};
237
238typedef unsigned int snd_seq_tick_time_t;
239
240union snd_seq_timestamp {
241 snd_seq_tick_time_t tick;
242 struct snd_seq_real_time time;
243};
244
245struct snd_seq_queue_skew {
246 unsigned int value;
247 unsigned int base;
248};
249
250
251struct snd_seq_ev_queue_control {
252 unsigned char queue;
253 unsigned char pad[3];
254 union {
255 signed int value;
256 union snd_seq_timestamp time;
257 unsigned int position;
258 struct snd_seq_queue_skew skew;
259 unsigned int d32[2];
260 unsigned char d8[8];
261 } param;
262};
263
264
265struct snd_seq_ev_quote {
266 struct snd_seq_addr origin;
267 unsigned short value;
268 struct snd_seq_event *event;
269} __attribute__((packed));
270
271
272
273struct snd_seq_event {
274 snd_seq_event_type_t type;
275 unsigned char flags;
276 char tag;
277
278 unsigned char queue;
279 union snd_seq_timestamp time;
280
281
282 struct snd_seq_addr source;
283 struct snd_seq_addr dest;
284
285 union {
286 struct snd_seq_ev_note note;
287 struct snd_seq_ev_ctrl control;
288 struct snd_seq_ev_raw8 raw8;
289 struct snd_seq_ev_raw32 raw32;
290 struct snd_seq_ev_ext ext;
291 struct snd_seq_ev_queue_control queue;
292 union snd_seq_timestamp time;
293 struct snd_seq_addr addr;
294 struct snd_seq_connect connect;
295 struct snd_seq_result result;
296 struct snd_seq_ev_quote quote;
297 } data;
298};
299
300
301
302
303
304struct snd_seq_event_bounce {
305 int err;
306 struct snd_seq_event event;
307
308};
309
310
311
312struct snd_seq_system_info {
313 int queues;
314 int clients;
315 int ports;
316 int channels;
317 int cur_clients;
318 int cur_queues;
319 char reserved[24];
320};
321
322
323
324struct snd_seq_running_info {
325 unsigned char client;
326 unsigned char big_endian;
327 unsigned char cpu_mode;
328 unsigned char pad;
329 unsigned char reserved[12];
330};
331
332
333
334#define SNDRV_SEQ_CLIENT_SYSTEM 0
335
336#define SNDRV_SEQ_CLIENT_DUMMY 14
337#define SNDRV_SEQ_CLIENT_OSS 15
338
339
340
341typedef int __bitwise snd_seq_client_type_t;
342#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
343#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
344#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
345
346
347#define SNDRV_SEQ_FILTER_BROADCAST (1<<0)
348#define SNDRV_SEQ_FILTER_MULTICAST (1<<1)
349#define SNDRV_SEQ_FILTER_BOUNCE (1<<2)
350#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31)
351
352struct snd_seq_client_info {
353 int client;
354 snd_seq_client_type_t type;
355 char name[64];
356 unsigned int filter;
357 unsigned char multicast_filter[8];
358 unsigned char event_filter[32];
359 int num_ports;
360 int event_lost;
361 int card;
362 int pid;
363 char reserved[56];
364};
365
366
367
368struct snd_seq_client_pool {
369 int client;
370 int output_pool;
371 int input_pool;
372 int output_room;
373 int output_free;
374 int input_free;
375 char reserved[64];
376};
377
378
379
380
381#define SNDRV_SEQ_REMOVE_INPUT (1<<0)
382#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1)
383#define SNDRV_SEQ_REMOVE_DEST (1<<2)
384#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3)
385#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4)
386#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5)
387#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6)
388#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7)
389#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8)
390#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9)
391
392struct snd_seq_remove_events {
393 unsigned int remove_mode;
394
395 union snd_seq_timestamp time;
396
397 unsigned char queue;
398 struct snd_seq_addr dest;
399 unsigned char channel;
400
401 int type;
402 char tag;
403
404 int reserved[10];
405
406};
407
408
409
410#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
411#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
412
413
414#define SNDRV_SEQ_PORT_CAP_READ (1<<0)
415#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1)
416
417#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
418#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
419
420#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
421
422#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5)
423#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6)
424#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7)
425
426
427#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0)
428#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)
429#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2)
430#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3)
431#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4)
432#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5)
433#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6)
434
435
436#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10)
437#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)
438#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12)
439
440#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16)
441#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17)
442#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18)
443#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19)
444#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20)
445
446
447#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
448#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
449#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
450
451struct snd_seq_port_info {
452 struct snd_seq_addr addr;
453 char name[64];
454
455 unsigned int capability;
456 unsigned int type;
457 int midi_channels;
458 int midi_voices;
459 int synth_voices;
460
461 int read_use;
462 int write_use;
463
464 void *kernel;
465 unsigned int flags;
466 unsigned char time_queue;
467 char reserved[59];
468};
469
470
471
472#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0)
473
474
475struct snd_seq_queue_info {
476 int queue;
477
478
479
480
481
482 int owner;
483 unsigned locked:1;
484 char name[64];
485 unsigned int flags;
486 char reserved[60];
487
488};
489
490
491struct snd_seq_queue_status {
492 int queue;
493 int events;
494 snd_seq_tick_time_t tick;
495 struct snd_seq_real_time time;
496 int running;
497 int flags;
498 char reserved[64];
499};
500
501
502
503struct snd_seq_queue_tempo {
504 int queue;
505 unsigned int tempo;
506 int ppq;
507 unsigned int skew_value;
508 unsigned int skew_base;
509 char reserved[24];
510};
511
512
513
514#define SNDRV_SEQ_TIMER_ALSA 0
515#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1
516#define SNDRV_SEQ_TIMER_MIDI_TICK 2
517
518
519struct snd_seq_queue_timer {
520 int queue;
521 int type;
522 union {
523 struct {
524 struct snd_timer_id id;
525 unsigned int resolution;
526 } alsa;
527 } u;
528 char reserved[64];
529};
530
531
532struct snd_seq_queue_client {
533 int queue;
534 int client;
535 int used;
536
537
538 char reserved[64];
539};
540
541
542#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0)
543#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
544#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
545
546struct snd_seq_port_subscribe {
547 struct snd_seq_addr sender;
548 struct snd_seq_addr dest;
549 unsigned int voices;
550 unsigned int flags;
551 unsigned char queue;
552 unsigned char pad[3];
553 char reserved[64];
554};
555
556
557#define SNDRV_SEQ_QUERY_SUBS_READ 0
558#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
559
560struct snd_seq_query_subs {
561 struct snd_seq_addr root;
562 int type;
563 int index;
564 int num_subs;
565 struct snd_seq_addr addr;
566 unsigned char queue;
567 unsigned int flags;
568 char reserved[64];
569};
570
571
572
573
574
575
576#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
577#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
578#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
579#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
580
581#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
582#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
583
584#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
585#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
586#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
587#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
588
589#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
590#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
591
592#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
593#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
594#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
595#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
596#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
597#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
598#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
599#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
600#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
601#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
602#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
603#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
604#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
605#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
606#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
607#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
608#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
609#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
610#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
611
612#endif
613