source: GPL/alsa-kernel/include/sound/asequencer.old@ 18

Last change on this file since 18 was 18, checked in by vladest, 20 years ago

initial import

File size: 32.8 KB
Line 
1#ifndef __ASEQUENCER_H
2#define __ASEQUENCER_H
3
4/*
5 * Main header file for the ALSA sequencer
6 * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@home.nl>
7 * (c) 1998-1999 by Jaroslav Kysela <perex@suse.cz>
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 */
25
26#ifndef __KERNEL__
27#include <linux/ioctl.h>
28#endif
29
30#include <sound/asound.h>
31
32
33/** version of the sequencer */
34#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
35
36/**
37 * definition of sequencer event types
38 */
39
40/** system messages
41 * event data type = #sndrv_seq_result_t
42 */
43#define SNDRV_SEQ_EVENT_SYSTEM 0
44#define SNDRV_SEQ_EVENT_RESULT 1
45
46/** note messages (channel specific)
47 * event data type = #sndrv_seq_ev_note
48 */
49#define SNDRV_SEQ_EVENT_NOTE 5
50#define SNDRV_SEQ_EVENT_NOTEON 6
51#define SNDRV_SEQ_EVENT_NOTEOFF 7
52#define SNDRV_SEQ_EVENT_KEYPRESS 8
53
54/** control messages (channel specific)
55 * event data type = #sndrv_seq_ev_ctrl
56 */
57#define SNDRV_SEQ_EVENT_CONTROLLER 10
58#define SNDRV_SEQ_EVENT_PGMCHANGE 11
59#define SNDRV_SEQ_EVENT_CHANPRESS 12
60#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
61#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
62#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */
63#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
64
65/** synchronisation messages
66 * event data type = #sndrv_seq_ev_ctrl
67 */
68#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
69#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
70#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
71#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
72#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
73
74/** timer messages
75 * event data type = sndrv_seq_ev_queue_control_t
76 */
77#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
78#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
79#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
80#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
81#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
82#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
83#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
84#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
85#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
86
87/** others
88 * event data type = none
89 */
90#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
91#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
92#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
93
94/** echo back, kernel private messages
95 * event data type = any type
96 */
97#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
98#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
99
100/** system status messages (broadcast for subscribers)
101 * event data type = sndrv_seq_addr_t
102 */
103#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
104#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
105#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
106#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
107#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
108#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
109
110/** port connection changes
111 * event data type = sndrv_seq_connect_t
112 */
113#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
114#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
115
116/** synthesizer events
117 * event data type = sndrv_seq_eve_sample_control_t
118 */
119#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
120#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
121#define SNDRV_SEQ_EVENT_SAMPLE_START 72 /* voice start */
122#define SNDRV_SEQ_EVENT_SAMPLE_STOP 73 /* voice stop */
123#define SNDRV_SEQ_EVENT_SAMPLE_FREQ 74 /* playback frequency */
124#define SNDRV_SEQ_EVENT_SAMPLE_VOLUME 75 /* volume and balance */
125#define SNDRV_SEQ_EVENT_SAMPLE_LOOP 76 /* sample loop */
126#define SNDRV_SEQ_EVENT_SAMPLE_POSITION 77 /* sample position */
127#define SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1 78 /* private (hardware dependent) event */
128
129/** user-defined events with fixed length
130 * event data type = any
131 */
132#define SNDRV_SEQ_EVENT_USR0 90
133#define SNDRV_SEQ_EVENT_USR1 91
134#define SNDRV_SEQ_EVENT_USR2 92
135#define SNDRV_SEQ_EVENT_USR3 93
136#define SNDRV_SEQ_EVENT_USR4 94
137#define SNDRV_SEQ_EVENT_USR5 95
138#define SNDRV_SEQ_EVENT_USR6 96
139#define SNDRV_SEQ_EVENT_USR7 97
140#define SNDRV_SEQ_EVENT_USR8 98
141#define SNDRV_SEQ_EVENT_USR9 99
142
143/** instrument layer
144 * variable length data can be passed directly to the driver
145 */
146#define SNDRV_SEQ_EVENT_INSTR_BEGIN 100 /* begin of instrument management */
147#define SNDRV_SEQ_EVENT_INSTR_END 101 /* end of instrument management */
148#define SNDRV_SEQ_EVENT_INSTR_INFO 102 /* instrument interface info */
149#define SNDRV_SEQ_EVENT_INSTR_INFO_RESULT 103 /* result */
150#define SNDRV_SEQ_EVENT_INSTR_FINFO 104 /* get format info */
151#define SNDRV_SEQ_EVENT_INSTR_FINFO_RESULT 105 /* get format info */
152#define SNDRV_SEQ_EVENT_INSTR_RESET 106 /* reset instrument memory */
153#define SNDRV_SEQ_EVENT_INSTR_STATUS 107 /* instrument interface status */
154#define SNDRV_SEQ_EVENT_INSTR_STATUS_RESULT 108 /* result */
155#define SNDRV_SEQ_EVENT_INSTR_PUT 109 /* put instrument to port */
156#define SNDRV_SEQ_EVENT_INSTR_GET 110 /* get instrument from port */
157#define SNDRV_SEQ_EVENT_INSTR_GET_RESULT 111 /* result */
158#define SNDRV_SEQ_EVENT_INSTR_FREE 112 /* free instrument(s) */
159#define SNDRV_SEQ_EVENT_INSTR_LIST 113 /* instrument list */
160#define SNDRV_SEQ_EVENT_INSTR_LIST_RESULT 114 /* result */
161#define SNDRV_SEQ_EVENT_INSTR_CLUSTER 115 /* cluster parameters */
162#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_GET 116 /* get cluster parameters */
163#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_RESULT 117 /* result */
164#define SNDRV_SEQ_EVENT_INSTR_CHANGE 118 /* instrument change */
165/* 119-129: reserved */
166
167/* 130-139: variable length events
168 * event data type = sndrv_seq_ev_ext
169 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
170 */
171#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
172#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
173/* 132-134: reserved */
174#define SNDRV_SEQ_EVENT_USR_VAR0 135
175#define SNDRV_SEQ_EVENT_USR_VAR1 136
176#define SNDRV_SEQ_EVENT_USR_VAR2 137
177#define SNDRV_SEQ_EVENT_USR_VAR3 138
178#define SNDRV_SEQ_EVENT_USR_VAR4 139
179
180/* 150-151: kernel events with quote - DO NOT use in user clients */
181#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
182#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151
183
184/* 152-191: reserved */
185
186/* 192-254: hardware specific events */
187
188/* 255: special event */
189#define SNDRV_SEQ_EVENT_NONE 255
190
191
192typedef unsigned char sndrv_seq_event_type_t;
193
194/** event address */
195struct sndrv_seq_addr {
196 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
197 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
198};
199
200/** port connection */
201struct sndrv_seq_connect {
202 struct sndrv_seq_addr sender;
203 struct sndrv_seq_addr dest;
204};
205
206
207#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
208#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
209#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
210#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
211
212 /* event mode flag - NOTE: only 8 bits available! */
213#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
214#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
215#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
216
217#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
218#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
219#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
220
221#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
222#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
223#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
224#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
225
226#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
227#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
228#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
229
230
231 /* note event */
232struct sndrv_seq_ev_note {
233 unsigned char channel;
234 unsigned char note;
235 unsigned char velocity;
236 unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
237 unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
238};
239
240 /* controller event */
241struct sndrv_seq_ev_ctrl {
242 unsigned char channel;
243 unsigned char unused1, unused2, unused3; /* pad */
244 unsigned int param;
245 signed int value;
246};
247
248 /* generic set of bytes (12x8 bit) */
249struct sndrv_seq_ev_raw8 {
250 unsigned char d[12]; /* 8 bit value */
251};
252
253 /* generic set of integers (3x32 bit) */
254struct sndrv_seq_ev_raw32 {
255 unsigned int d[3]; /* 32 bit value */
256};
257#pragma pack(1)
258 /* external stored data */
259struct sndrv_seq_ev_ext {
260 unsigned int len; /* length of data */
261 void *ptr; /* pointer to data (note: maybe 64-bit) */
262};
263#pragma pack()
264
265/* Instrument cluster type */
266typedef unsigned int sndrv_seq_instr_cluster_t;
267
268/* Instrument type */
269struct sndrv_seq_instr {
270 sndrv_seq_instr_cluster_t cluster;
271 unsigned int std; /* the upper byte means a private instrument (owner - client #) */
272 unsigned short bank;
273 unsigned short prg;
274};
275
276 /* sample number */
277struct sndrv_seq_ev_sample {
278 unsigned int std;
279 unsigned short bank;
280 unsigned short prg;
281};
282
283 /* sample cluster */
284struct sndrv_seq_ev_cluster {
285 sndrv_seq_instr_cluster_t cluster;
286};
287
288 /* sample position */
289typedef unsigned int sndrv_seq_position_t; /* playback position (in samples) * 16 */
290
291 /* sample stop mode */
292enum sndrv_seq_stop_mode {
293 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
294 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
295 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
296};
297
298 /* sample frequency */
299typedef int sndrv_seq_frequency_t; /* playback frequency in HZ * 16 */
300
301 /* sample volume control; if any value is set to -1 == do not change */
302struct sndrv_seq_ev_volume {
303 signed short volume; /* range: 0-16383 */
304 signed short lr; /* left-right balance; range: 0-16383 */
305 signed short fr; /* front-rear balance; range: 0-16383 */
306 signed short du; /* down-up balance; range: 0-16383 */
307};
308
309 /* simple loop redefinition */
310struct sndrv_seq_ev_loop {
311 unsigned int start; /* loop start (in samples) * 16 */
312 unsigned int end; /* loop end (in samples) * 16 */
313};
314
315struct sndrv_seq_ev_sample_control {
316 unsigned char channel;
317 unsigned char unused1, unused2, unused3; /* pad */
318 union {
319 struct sndrv_seq_ev_sample sample;
320 struct sndrv_seq_ev_cluster cluster;
321 sndrv_seq_position_t position;
322 enum sndrv_seq_stop_mode stop_mode;
323 sndrv_seq_frequency_t frequency;
324 struct sndrv_seq_ev_volume volume;
325 struct sndrv_seq_ev_loop loop;
326 unsigned char raw8[8];
327 } param;
328};
329
330
331
332/* INSTR_BEGIN event */
333struct sndrv_seq_ev_instr_begin {
334 int timeout; /* zero = forever, otherwise timeout in ms */
335};
336
337struct sndrv_seq_result {
338 int event; /* processed event type */
339 int result;
340};
341
342
343struct sndrv_seq_real_time {
344 unsigned int tv_sec; /* seconds */
345 unsigned int tv_nsec; /* nanoseconds */
346};
347
348typedef unsigned int sndrv_seq_tick_time_t; /* midi ticks */
349
350union sndrv_seq_timestamp {
351 sndrv_seq_tick_time_t tick;
352 struct sndrv_seq_real_time time;
353};
354
355struct sndrv_seq_queue_skew {
356 unsigned int value;
357 unsigned int base;
358};
359
360 /* queue timer control */
361struct sndrv_seq_ev_queue_control {
362 unsigned char queue; /* affected queue */
363 unsigned char pad[3]; /* reserved */
364 union {
365 signed int value; /* affected value (e.g. tempo) */
366 union sndrv_seq_timestamp time; /* time */
367 unsigned int position; /* sync position */
368 struct sndrv_seq_queue_skew skew;
369 unsigned int d32[2];
370 unsigned char d8[8];
371 } param;
372};
373
374/* quoted event - inside the kernel only */
375#pragma pack(1)
376struct sndrv_seq_ev_quote {
377 struct sndrv_seq_addr origin; /* original sender */
378 unsigned short value; /* optional data */
379 struct sndrv_seq_event *event; /* quoted event */
380} ;
381#pragma pack()
382
383
384 /* sequencer event */
385struct sndrv_seq_event {
386 sndrv_seq_event_type_t type; /* event type */
387 unsigned char flags; /* event flags */
388 char tag;
389
390 unsigned char queue; /* schedule queue */
391 union sndrv_seq_timestamp time; /* schedule time */
392
393
394 struct sndrv_seq_addr source; /* source address */
395 struct sndrv_seq_addr dest; /* destination address */
396
397 union { /* event data... */
398 struct sndrv_seq_ev_note note;
399 struct sndrv_seq_ev_ctrl control;
400 struct sndrv_seq_ev_raw8 raw8;
401 struct sndrv_seq_ev_raw32 raw32;
402 struct sndrv_seq_ev_ext ext;
403 struct sndrv_seq_ev_queue_control queue;
404 union sndrv_seq_timestamp time;
405 struct sndrv_seq_addr addr;
406 struct sndrv_seq_connect connect;
407 struct sndrv_seq_result result;
408 struct sndrv_seq_ev_instr_begin instr_begin;
409 struct sndrv_seq_ev_sample_control sample;
410 struct sndrv_seq_ev_quote quote;
411 } data;
412};
413
414
415/*
416 * bounce event - stored as variable size data
417 */
418struct sndrv_seq_event_bounce {
419 int err;
420 struct sndrv_seq_event event;
421 /* external data follows here. */
422};
423
424#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t)))
425
426/*
427 * type check macros
428 */
429/* result events: 0-4 */
430#define sndrv_seq_ev_is_result_type(ev) ((ev)->type < 5)
431/* channel specific events: 5-19 */
432#define sndrv_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
433/* note events: 5-9 */
434#define sndrv_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
435/* control events: 10-19 */
436#define sndrv_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
437/* queue control events: 30-39 */
438#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
439/* system status messages */
440#define sndrv_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
441/* sample messages */
442#define sndrv_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
443/* user-defined messages */
444#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
445/* fixed length events: 0-99 */
446#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
447/* instrument layer events: 100-129 */
448#define sndrv_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
449/* variable length events: 130-139 */
450#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
451/* reserved for kernel */
452#define sndrv_seq_ev_is_reserved(ev) ((ev)->type >= 150)
453
454/* direct dispatched events */
455#define sndrv_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
456
457/*
458 * macros to check event flags
459 */
460/* prior events */
461#define sndrv_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
462
463/* event length type */
464#define sndrv_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
465#define sndrv_seq_ev_is_fixed(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
466#define sndrv_seq_ev_is_variable(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
467#define sndrv_seq_ev_is_varusr(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
468
469/* time-stamp type */
470#define sndrv_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
471#define sndrv_seq_ev_is_tick(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
472#define sndrv_seq_ev_is_real(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
473
474/* time-mode type */
475#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
476#define sndrv_seq_ev_is_abstime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
477#define sndrv_seq_ev_is_reltime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
478
479/* queue sync port */
480#define sndrv_seq_queue_sync_port(q) ((q) + 16)
481
482 /* system information */
483struct sndrv_seq_system_info {
484 int queues; /* maximum queues count */
485 int clients; /* maximum clients count */
486 int ports; /* maximum ports per client */
487 int channels; /* maximum channels per port */
488 int cur_clients; /* current clients */
489 int cur_queues; /* current queues */
490 char reserved[24];
491};
492
493 /* system running information */
494struct sndrv_seq_running_info {
495 unsigned char client; /* client id */
496 unsigned char big_endian; /* 1 = big-endian */
497 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
498 unsigned char pad; /* reserved */
499 unsigned char reserved[12];
500};
501
502
503 /* known client numbers */
504#define SNDRV_SEQ_CLIENT_SYSTEM 0
505#define SNDRV_SEQ_CLIENT_DUMMY 62 /* dummy ports */
506#define SNDRV_SEQ_CLIENT_OSS 63 /* oss sequencer emulator */
507
508
509 /* client types */
510enum sndrv_seq_client_type {
511 NO_CLIENT = 0,
512 USER_CLIENT = 1,
513 KERNEL_CLIENT = 2
514};
515
516 /* event filter flags */
517#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
518#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
519#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
520#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
521
522struct sndrv_seq_client_info {
523 int client; /* client number to inquire */
524 enum sndrv_seq_client_type type; /* client type */
525 char name[64]; /* client name */
526 unsigned int filter; /* filter flags */
527 unsigned char multicast_filter[8]; /* multicast filter bitmap */
528 unsigned char event_filter[32]; /* event filter bitmap */
529 int num_ports; /* RO: number of ports */
530 int event_lost; /* number of lost events */
531 char reserved[64]; /* for future use */
532};
533
534
535/* client pool size */
536struct sndrv_seq_client_pool {
537 int client; /* client number to inquire */
538 int output_pool; /* outgoing (write) pool size */
539 int input_pool; /* incoming (read) pool size */
540 int output_room; /* minimum free pool size for select/blocking mode */
541 int output_free; /* unused size */
542 int input_free; /* unused size */
543 char reserved[64];
544};
545
546
547/* Remove events by specified criteria */
548
549#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
550#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
551#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
552#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
553#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
554#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
555#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
556#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
557#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
558#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
559
560struct sndrv_seq_remove_events {
561 unsigned int remove_mode; /* Flags that determine what gets removed */
562
563 union sndrv_seq_timestamp time;
564
565 unsigned char queue; /* Queue for REMOVE_DEST */
566 struct sndrv_seq_addr dest; /* Address for REMOVE_DEST */
567 unsigned char channel; /* Channel for REMOVE_DEST */
568
569 int type; /* For REMOVE_EVENT_TYPE */
570 char tag; /* Tag for REMOVE_TAG */
571
572 int reserved[10]; /* To allow for future binary compatibility */
573
574};
575
576
577 /* known port numbers */
578#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
579#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
580
581 /* port capabilities (32 bits) */
582#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
583#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
584
585#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
586#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
587
588#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
589
590#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
591#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
592#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
593
594 /* port type */
595#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
596#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
597#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
598#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
599#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
600#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
601
602/* other standards...*/
603#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
604#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
605#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
606/*...*/
607#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
608
609/* misc. conditioning flags */
610#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
611#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
612#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<1)
613
614struct sndrv_seq_port_info {
615 struct sndrv_seq_addr addr; /* client/port numbers */
616 char name[64]; /* port name */
617
618 unsigned int capability; /* port capability bits */
619 unsigned int type; /* port type bits */
620 int midi_channels; /* channels per MIDI port */
621 int midi_voices; /* voices per MIDI port */
622 int synth_voices; /* voices per SYNTH port */
623
624 int read_use; /* R/O: subscribers for output (from this port) */
625 int write_use; /* R/O: subscribers for input (to this port) */
626
627 void *kernel; /* reserved for kernel use (must be NULL) */
628 unsigned int flags; /* misc. conditioning */
629 unsigned char time_queue; /* queue # for timestamping */
630 char reserved[59]; /* for future use */
631};
632
633
634/* queue flags */
635#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
636
637/* queue information */
638struct sndrv_seq_queue_info {
639 int queue; /* queue id */
640
641 /*
642 * security settings, only owner of this queue can start/stop timer
643 * etc. if the queue is locked for other clients
644 */
645 int owner; /* client id for owner of the queue */
646 int locked:1; /* timing queue locked for other queues */
647 char name[64]; /* name of this queue */
648 unsigned int flags; /* flags */
649 char reserved[60]; /* for future use */
650
651};
652
653/* queue info/status */
654struct sndrv_seq_queue_status {
655 int queue; /* queue id */
656 int events; /* read-only - queue size */
657 sndrv_seq_tick_time_t tick; /* current tick */
658 struct sndrv_seq_real_time time; /* current time */
659 int running; /* running state of queue */
660 int flags; /* various flags */
661 char reserved[64]; /* for the future */
662};
663
664
665/* queue tempo */
666struct sndrv_seq_queue_tempo {
667 int queue; /* sequencer queue */
668 unsigned int tempo; /* current tempo, us/tick */
669 int ppq; /* time resolution, ticks/quarter */
670 unsigned int skew_value; /* queue skew */
671 unsigned int skew_base; /* queue skew base */
672 char reserved[24]; /* for the future */
673};
674
675
676/* sequencer timer sources */
677#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
678#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
679#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
680
681/* queue timer info */
682struct sndrv_seq_queue_timer {
683 int queue; /* sequencer queue */
684 int type; /* source timer type */
685 union {
686 struct {
687 struct sndrv_timer_id id; /* ALSA's timer ID */
688 unsigned int resolution; /* resolution in Hz */
689 } alsa;
690 } u;
691 char reserved[64]; /* for the future use */
692};
693
694
695struct sndrv_seq_queue_client {
696 int queue; /* sequencer queue */
697 int client; /* sequencer client */
698 int used; /* queue is used with this client
699 (must be set for accepting events) */
700 /* per client watermarks */
701 char reserved[64]; /* for future use */
702};
703
704
705#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
706#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
707#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
708
709struct sndrv_seq_port_subscribe {
710 struct sndrv_seq_addr sender; /* sender address */
711 struct sndrv_seq_addr dest; /* destination address */
712 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
713 unsigned int flags; /* modes */
714 unsigned char queue; /* input time-stamp queue (optional) */
715 unsigned char pad[3]; /* reserved */
716 char reserved[64];
717};
718
719/* type of query subscription */
720#define SNDRV_SEQ_QUERY_SUBS_READ 0
721#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
722
723struct sndrv_seq_query_subs {
724 struct sndrv_seq_addr root; /* client/port id to be searched */
725 int type; /* READ or WRITE */
726 int index; /* 0..N-1 */
727 int num_subs; /* R/O: number of subscriptions on this port */
728 struct sndrv_seq_addr addr; /* R/O: result */
729 unsigned char queue; /* R/O: result */
730 unsigned int flags; /* R/O: result */
731 char reserved[64]; /* for future use */
732};
733
734
735/*
736 * Instrument abstraction layer
737 * - based on events
738 */
739
740/* instrument types */
741#define SNDRV_SEQ_INSTR_ATYPE_DATA 0 /* instrument data */
742#define SNDRV_SEQ_INSTR_ATYPE_ALIAS 1 /* instrument alias */
743
744/* instrument ASCII identifiers */
745#define SNDRV_SEQ_INSTR_ID_DLS1 "DLS1"
746#define SNDRV_SEQ_INSTR_ID_DLS2 "DLS2"
747#define SNDRV_SEQ_INSTR_ID_SIMPLE "Simple Wave"
748#define SNDRV_SEQ_INSTR_ID_SOUNDFONT "SoundFont"
749#define SNDRV_SEQ_INSTR_ID_GUS_PATCH "GUS Patch"
750#define SNDRV_SEQ_INSTR_ID_INTERWAVE "InterWave FFFF"
751#define SNDRV_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM"
752#define SNDRV_SEQ_INSTR_ID_OPL4 "OPL4"
753
754/* instrument types */
755#define SNDRV_SEQ_INSTR_TYPE0_DLS1 (1<<0) /* MIDI DLS v1 */
756#define SNDRV_SEQ_INSTR_TYPE0_DLS2 (1<<1) /* MIDI DLS v2 */
757#define SNDRV_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /* Simple Wave */
758#define SNDRV_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /* EMU SoundFont */
759#define SNDRV_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /* Gravis UltraSound Patch */
760#define SNDRV_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /* InterWave FFFF */
761#define SNDRV_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /* Yamaha OPL2/3 FM */
762#define SNDRV_SEQ_INSTR_TYPE2_OPL4 (1<<1) /* Yamaha OPL4 */
763
764/* put commands */
765#define SNDRV_SEQ_INSTR_PUT_CMD_CREATE 0
766#define SNDRV_SEQ_INSTR_PUT_CMD_REPLACE 1
767#define SNDRV_SEQ_INSTR_PUT_CMD_MODIFY 2
768#define SNDRV_SEQ_INSTR_PUT_CMD_ADD 3
769#define SNDRV_SEQ_INSTR_PUT_CMD_REMOVE 4
770
771/* get commands */
772#define SNDRV_SEQ_INSTR_GET_CMD_FULL 0
773#define SNDRV_SEQ_INSTR_GET_CMD_PARTIAL 1
774
775/* query flags */
776#define SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0)
777
778/* free commands */
779#define SNDRV_SEQ_INSTR_FREE_CMD_ALL 0
780#define SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE 1
781#define SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER 2
782#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
783
784
785/* size of ROM/RAM */
786typedef unsigned int sndrv_seq_instr_size_t;
787
788/* INSTR_INFO */
789
790struct sndrv_seq_instr_info {
791 int result; /* operation result */
792 unsigned int formats[8]; /* bitmap of supported formats */
793 int ram_count; /* count of RAM banks */
794 sndrv_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
795 int rom_count; /* count of ROM banks */
796 sndrv_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
797 char reserved[128];
798};
799
800/* INSTR_STATUS */
801
802struct sndrv_seq_instr_status {
803 int result; /* operation result */
804 sndrv_seq_instr_size_t free_ram[16]; /* free RAM in banks */
805 int instrument_count; /* count of downloaded instruments */
806 char reserved[128];
807};
808
809/* INSTR_FORMAT_INFO */
810
811struct sndrv_seq_instr_format_info {
812 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
813 unsigned int len; /* max data length (without this structure) */
814};
815
816struct sndrv_seq_instr_format_info_result {
817 int result; /* operation result */
818 char format[16]; /* format identifier */
819 unsigned int len; /* filled data length (without this structure) */
820};
821
822/* instrument data */
823struct sndrv_seq_instr_data {
824 char name[32]; /* instrument name */
825 char reserved[16]; /* for the future use */
826 int type; /* instrument type */
827 union {
828 char format[16]; /* format identifier */
829 struct sndrv_seq_instr alias;
830 } data;
831};
832
833/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
834
835struct sndrv_seq_instr_header {
836 union {
837 struct sndrv_seq_instr instr;
838 sndrv_seq_instr_cluster_t cluster;
839 } id; /* instrument identifier */
840 unsigned int cmd; /* get/put/free command */
841 unsigned int flags; /* query flags (only for get) */
842 unsigned int len; /* real instrument data length (without header) */
843 int result; /* operation result */
844 char reserved[16]; /* for the future */
845 struct sndrv_seq_instr_data data; /* instrument data (for put/get result) */
846};
847
848/* INSTR_CLUSTER_SET */
849
850struct sndrv_seq_instr_cluster_set {
851 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */
852 char name[32]; /* cluster name */
853 int priority; /* cluster priority */
854 char reserved[64]; /* for the future use */
855};
856
857/* INSTR_CLUSTER_GET */
858
859struct sndrv_seq_instr_cluster_get {
860 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */
861 char name[32]; /* cluster name */
862 int priority; /* cluster priority */
863 char reserved[64]; /* for the future use */
864};
865
866/*
867 * IOCTL commands
868 */
869
870#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
871#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
872#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info)
873#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info)
874
875#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info)
876#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info)
877
878#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct sndrv_seq_port_info)
879#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct sndrv_seq_port_info)
880#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct sndrv_seq_port_info)
881#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct sndrv_seq_port_info)
882
883#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe)
884#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe)
885
886#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct sndrv_seq_queue_info)
887#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct sndrv_seq_queue_info)
888#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info)
889#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info)
890#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct sndrv_seq_queue_info)
891#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status)
892#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct sndrv_seq_queue_tempo)
893#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct sndrv_seq_queue_tempo)
894#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct sndrv_seq_queue_owner)
895#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct sndrv_seq_queue_owner)
896#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct sndrv_seq_queue_timer)
897#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct sndrv_seq_queue_timer)
898/* XXX
899#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync)
900#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync)
901*/
902#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct sndrv_seq_queue_client)
903#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct sndrv_seq_queue_client)
904#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct sndrv_seq_client_pool)
905#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct sndrv_seq_client_pool)
906#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct sndrv_seq_remove_events)
907#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct sndrv_seq_query_subs)
908#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct sndrv_seq_port_subscribe)
909#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct sndrv_seq_client_info)
910#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct sndrv_seq_port_info)
911
912#endif /* __ASEQUENCER_H */
Note: See TracBrowser for help on using the repository browser.