blob: 64daccbe8b29196f7969631bf0d44e69200f2ca3 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Main header file for the ALSA sequencer
3 * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
Jaroslav Kyselac1017a42007-10-15 09:50:19 +02004 * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef __SOUND_ASEQUENCER_H
23#define __SOUND_ASEQUENCER_H
24
Takashi Iwai6560c342005-11-17 10:29:33 +010025#ifdef __KERNEL__
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <linux/ioctl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <sound/asound.h>
Takashi Iwai6560c342005-11-17 10:29:33 +010028#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
30/** version of the sequencer */
31#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
32
33/**
34 * definition of sequencer event types
35 */
36
37/** system messages
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010038 * event data type = #snd_seq_result
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 */
40#define SNDRV_SEQ_EVENT_SYSTEM 0
41#define SNDRV_SEQ_EVENT_RESULT 1
42
43/** note messages (channel specific)
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010044 * event data type = #snd_seq_ev_note
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 */
46#define SNDRV_SEQ_EVENT_NOTE 5
47#define SNDRV_SEQ_EVENT_NOTEON 6
48#define SNDRV_SEQ_EVENT_NOTEOFF 7
49#define SNDRV_SEQ_EVENT_KEYPRESS 8
50
51/** control messages (channel specific)
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010052 * event data type = #snd_seq_ev_ctrl
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 */
54#define SNDRV_SEQ_EVENT_CONTROLLER 10
55#define SNDRV_SEQ_EVENT_PGMCHANGE 11
56#define SNDRV_SEQ_EVENT_CHANPRESS 12
57#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
58#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
59#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */
60#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
61
62/** synchronisation messages
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010063 * event data type = #snd_seq_ev_ctrl
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 */
65#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
66#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
67#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
68#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
69#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
70
71/** timer messages
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010072 * event data type = snd_seq_ev_queue_control
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 */
74#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
75#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
76#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
77#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
78#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
79#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
80#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
81#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
82#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
83
84/** others
85 * event data type = none
86 */
87#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
88#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
89#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
90
91/** echo back, kernel private messages
92 * event data type = any type
93 */
94#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
95#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
96
97/** system status messages (broadcast for subscribers)
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010098 * event data type = snd_seq_addr
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 */
100#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
101#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
102#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
103#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
104#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
105#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
106
107/** port connection changes
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100108 * event data type = snd_seq_connect
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 */
110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
112
113/** synthesizer events
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100114 * event data type = snd_seq_eve_sample_control
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 */
116#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
117#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
118#define SNDRV_SEQ_EVENT_SAMPLE_START 72 /* voice start */
119#define SNDRV_SEQ_EVENT_SAMPLE_STOP 73 /* voice stop */
120#define SNDRV_SEQ_EVENT_SAMPLE_FREQ 74 /* playback frequency */
121#define SNDRV_SEQ_EVENT_SAMPLE_VOLUME 75 /* volume and balance */
122#define SNDRV_SEQ_EVENT_SAMPLE_LOOP 76 /* sample loop */
123#define SNDRV_SEQ_EVENT_SAMPLE_POSITION 77 /* sample position */
124#define SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1 78 /* private (hardware dependent) event */
125
126/** user-defined events with fixed length
127 * event data type = any
128 */
129#define SNDRV_SEQ_EVENT_USR0 90
130#define SNDRV_SEQ_EVENT_USR1 91
131#define SNDRV_SEQ_EVENT_USR2 92
132#define SNDRV_SEQ_EVENT_USR3 93
133#define SNDRV_SEQ_EVENT_USR4 94
134#define SNDRV_SEQ_EVENT_USR5 95
135#define SNDRV_SEQ_EVENT_USR6 96
136#define SNDRV_SEQ_EVENT_USR7 97
137#define SNDRV_SEQ_EVENT_USR8 98
138#define SNDRV_SEQ_EVENT_USR9 99
139
140/** instrument layer
141 * variable length data can be passed directly to the driver
142 */
143#define SNDRV_SEQ_EVENT_INSTR_BEGIN 100 /* begin of instrument management */
144#define SNDRV_SEQ_EVENT_INSTR_END 101 /* end of instrument management */
145#define SNDRV_SEQ_EVENT_INSTR_INFO 102 /* instrument interface info */
146#define SNDRV_SEQ_EVENT_INSTR_INFO_RESULT 103 /* result */
147#define SNDRV_SEQ_EVENT_INSTR_FINFO 104 /* get format info */
148#define SNDRV_SEQ_EVENT_INSTR_FINFO_RESULT 105 /* get format info */
149#define SNDRV_SEQ_EVENT_INSTR_RESET 106 /* reset instrument memory */
150#define SNDRV_SEQ_EVENT_INSTR_STATUS 107 /* instrument interface status */
151#define SNDRV_SEQ_EVENT_INSTR_STATUS_RESULT 108 /* result */
152#define SNDRV_SEQ_EVENT_INSTR_PUT 109 /* put instrument to port */
153#define SNDRV_SEQ_EVENT_INSTR_GET 110 /* get instrument from port */
154#define SNDRV_SEQ_EVENT_INSTR_GET_RESULT 111 /* result */
155#define SNDRV_SEQ_EVENT_INSTR_FREE 112 /* free instrument(s) */
156#define SNDRV_SEQ_EVENT_INSTR_LIST 113 /* instrument list */
157#define SNDRV_SEQ_EVENT_INSTR_LIST_RESULT 114 /* result */
158#define SNDRV_SEQ_EVENT_INSTR_CLUSTER 115 /* cluster parameters */
159#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_GET 116 /* get cluster parameters */
160#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_RESULT 117 /* result */
161#define SNDRV_SEQ_EVENT_INSTR_CHANGE 118 /* instrument change */
162/* 119-129: reserved */
163
164/* 130-139: variable length events
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100165 * event data type = snd_seq_ev_ext
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
167 */
168#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
169#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
170/* 132-134: reserved */
171#define SNDRV_SEQ_EVENT_USR_VAR0 135
172#define SNDRV_SEQ_EVENT_USR_VAR1 136
173#define SNDRV_SEQ_EVENT_USR_VAR2 137
174#define SNDRV_SEQ_EVENT_USR_VAR3 138
175#define SNDRV_SEQ_EVENT_USR_VAR4 139
176
177/* 150-151: kernel events with quote - DO NOT use in user clients */
178#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
179#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */
180
181/* 152-191: reserved */
182
183/* 192-254: hardware specific events */
184
185/* 255: special event */
186#define SNDRV_SEQ_EVENT_NONE 255
187
188
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100189typedef unsigned char snd_seq_event_type_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190
191/** event address */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100192struct snd_seq_addr {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
194 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
195};
196
197/** port connection */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100198struct snd_seq_connect {
199 struct snd_seq_addr sender;
200 struct snd_seq_addr dest;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201};
202
203
204#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
205#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
206#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
207#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
208
209 /* event mode flag - NOTE: only 8 bits available! */
210#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
211#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
212#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
213
214#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
215#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
216#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
217
218#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
219#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
220#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
221#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
222
223#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
224#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
225#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
226
227
228 /* note event */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100229struct snd_seq_ev_note {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 unsigned char channel;
231 unsigned char note;
232 unsigned char velocity;
233 unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
234 unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
235};
236
237 /* controller event */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100238struct snd_seq_ev_ctrl {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 unsigned char channel;
240 unsigned char unused1, unused2, unused3; /* pad */
241 unsigned int param;
242 signed int value;
243};
244
245 /* generic set of bytes (12x8 bit) */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100246struct snd_seq_ev_raw8 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 unsigned char d[12]; /* 8 bit value */
248};
249
250 /* generic set of integers (3x32 bit) */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100251struct snd_seq_ev_raw32 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 unsigned int d[3]; /* 32 bit value */
253};
254
255 /* external stored data */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100256struct snd_seq_ev_ext {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 unsigned int len; /* length of data */
258 void *ptr; /* pointer to data (note: maybe 64-bit) */
259} __attribute__((packed));
260
261/* Instrument cluster type */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100262typedef unsigned int snd_seq_instr_cluster_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263
264/* Instrument type */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100265struct snd_seq_instr {
266 snd_seq_instr_cluster_t cluster;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267 unsigned int std; /* the upper byte means a private instrument (owner - client #) */
268 unsigned short bank;
269 unsigned short prg;
270};
271
272 /* sample number */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100273struct snd_seq_ev_sample {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 unsigned int std;
275 unsigned short bank;
276 unsigned short prg;
277};
278
279 /* sample cluster */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100280struct snd_seq_ev_cluster {
281 snd_seq_instr_cluster_t cluster;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282};
283
284 /* sample position */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100285typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286
287 /* sample stop mode */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100288enum {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
290 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
291 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
292};
293
294 /* sample frequency */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100295typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296
297 /* sample volume control; if any value is set to -1 == do not change */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100298struct snd_seq_ev_volume {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 signed short volume; /* range: 0-16383 */
300 signed short lr; /* left-right balance; range: 0-16383 */
301 signed short fr; /* front-rear balance; range: 0-16383 */
302 signed short du; /* down-up balance; range: 0-16383 */
303};
304
305 /* simple loop redefinition */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100306struct snd_seq_ev_loop {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 unsigned int start; /* loop start (in samples) * 16 */
308 unsigned int end; /* loop end (in samples) * 16 */
309};
310
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100311struct snd_seq_ev_sample_control {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 unsigned char channel;
313 unsigned char unused1, unused2, unused3; /* pad */
314 union {
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100315 struct snd_seq_ev_sample sample;
316 struct snd_seq_ev_cluster cluster;
317 snd_seq_position_t position;
318 int stop_mode;
319 snd_seq_frequency_t frequency;
320 struct snd_seq_ev_volume volume;
321 struct snd_seq_ev_loop loop;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 unsigned char raw8[8];
323 } param;
324};
325
326
327
328/* INSTR_BEGIN event */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100329struct snd_seq_ev_instr_begin {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 int timeout; /* zero = forever, otherwise timeout in ms */
331};
332
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100333struct snd_seq_result {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334 int event; /* processed event type */
335 int result;
336};
337
338
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100339struct snd_seq_real_time {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340 unsigned int tv_sec; /* seconds */
341 unsigned int tv_nsec; /* nanoseconds */
342};
343
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100344typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100346union snd_seq_timestamp {
347 snd_seq_tick_time_t tick;
348 struct snd_seq_real_time time;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349};
350
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100351struct snd_seq_queue_skew {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352 unsigned int value;
353 unsigned int base;
354};
355
356 /* queue timer control */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100357struct snd_seq_ev_queue_control {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 unsigned char queue; /* affected queue */
359 unsigned char pad[3]; /* reserved */
360 union {
361 signed int value; /* affected value (e.g. tempo) */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100362 union snd_seq_timestamp time; /* time */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363 unsigned int position; /* sync position */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100364 struct snd_seq_queue_skew skew;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 unsigned int d32[2];
366 unsigned char d8[8];
367 } param;
368};
369
370 /* quoted event - inside the kernel only */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100371struct snd_seq_ev_quote {
372 struct snd_seq_addr origin; /* original sender */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 unsigned short value; /* optional data */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100374 struct snd_seq_event *event; /* quoted event */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375} __attribute__((packed));
376
377
378 /* sequencer event */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100379struct snd_seq_event {
380 snd_seq_event_type_t type; /* event type */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381 unsigned char flags; /* event flags */
382 char tag;
383
384 unsigned char queue; /* schedule queue */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100385 union snd_seq_timestamp time; /* schedule time */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386
387
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100388 struct snd_seq_addr source; /* source address */
389 struct snd_seq_addr dest; /* destination address */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390
391 union { /* event data... */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100392 struct snd_seq_ev_note note;
393 struct snd_seq_ev_ctrl control;
394 struct snd_seq_ev_raw8 raw8;
395 struct snd_seq_ev_raw32 raw32;
396 struct snd_seq_ev_ext ext;
397 struct snd_seq_ev_queue_control queue;
398 union snd_seq_timestamp time;
399 struct snd_seq_addr addr;
400 struct snd_seq_connect connect;
401 struct snd_seq_result result;
402 struct snd_seq_ev_instr_begin instr_begin;
403 struct snd_seq_ev_sample_control sample;
404 struct snd_seq_ev_quote quote;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 } data;
406};
407
408
409/*
410 * bounce event - stored as variable size data
411 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100412struct snd_seq_event_bounce {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 int err;
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100414 struct snd_seq_event event;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 /* external data follows here. */
416};
417
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100418#ifdef __KERNEL__
419
420/* helper macro */
421#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422
423/*
424 * type check macros
425 */
426/* result events: 0-4 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100427#define snd_seq_ev_is_result_type(ev) ((ev)->type < 5)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428/* channel specific events: 5-19 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100429#define snd_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430/* note events: 5-9 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100431#define snd_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432/* control events: 10-19 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100433#define snd_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434/* queue control events: 30-39 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100435#define snd_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436/* system status messages */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100437#define snd_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438/* sample messages */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100439#define snd_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440/* user-defined messages */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100441#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442/* fixed length events: 0-99 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100443#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444/* instrument layer events: 100-129 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100445#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446/* variable length events: 130-139 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100447#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448/* reserved for kernel */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100449#define snd_seq_ev_is_reserved(ev) ((ev)->type >= 150)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450
451/* direct dispatched events */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100452#define snd_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453
454/*
455 * macros to check event flags
456 */
457/* prior events */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100458#define snd_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459
460/* event length type */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100461#define snd_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
462#define snd_seq_ev_is_fixed(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
463#define snd_seq_ev_is_variable(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
464#define snd_seq_ev_is_varusr(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465
466/* time-stamp type */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100467#define snd_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
468#define snd_seq_ev_is_tick(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
469#define snd_seq_ev_is_real(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470
471/* time-mode type */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100472#define snd_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
473#define snd_seq_ev_is_abstime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
474#define snd_seq_ev_is_reltime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475
476/* queue sync port */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100477#define snd_seq_queue_sync_port(q) ((q) + 16)
478
479#endif /* __KERNEL__ */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480
481 /* system information */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100482struct snd_seq_system_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 int queues; /* maximum queues count */
484 int clients; /* maximum clients count */
485 int ports; /* maximum ports per client */
486 int channels; /* maximum channels per port */
487 int cur_clients; /* current clients */
488 int cur_queues; /* current queues */
489 char reserved[24];
490};
491
492
493 /* system running information */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100494struct snd_seq_running_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495 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
Clemens Ladischaa1e77e2005-12-12 09:36:01 +0100505 /* internal client numbers */
506#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
507#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508
509
510 /* client types */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100511typedef int __bitwise snd_seq_client_type_t;
512#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
513#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
514#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515
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
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100522struct snd_seq_client_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523 int client; /* client number to inquire */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100524 snd_seq_client_type_t type; /* client type */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700525 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 */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100536struct snd_seq_client_pool {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537 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
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100560struct snd_seq_remove_events {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 unsigned int remove_mode; /* Flags that determine what gets removed */
562
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100563 union snd_seq_timestamp time;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564
565 unsigned char queue; /* Queue for REMOVE_DEST */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100566 struct snd_seq_addr dest; /* Address for REMOVE_DEST */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 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#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
602
603/* other standards...*/
604#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
605#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
606#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
607/*...*/
Clemens Ladisch450047a2006-05-02 16:08:41 +0200608#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
609#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
610#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
611#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
613
614/* misc. conditioning flags */
615#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
616#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
617#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
618
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100619struct snd_seq_port_info {
620 struct snd_seq_addr addr; /* client/port numbers */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 char name[64]; /* port name */
622
623 unsigned int capability; /* port capability bits */
624 unsigned int type; /* port type bits */
625 int midi_channels; /* channels per MIDI port */
626 int midi_voices; /* voices per MIDI port */
627 int synth_voices; /* voices per SYNTH port */
628
629 int read_use; /* R/O: subscribers for output (from this port) */
630 int write_use; /* R/O: subscribers for input (to this port) */
631
632 void *kernel; /* reserved for kernel use (must be NULL) */
633 unsigned int flags; /* misc. conditioning */
634 unsigned char time_queue; /* queue # for timestamping */
635 char reserved[59]; /* for future use */
636};
637
638
639/* queue flags */
640#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
641
642/* queue information */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100643struct snd_seq_queue_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644 int queue; /* queue id */
645
646 /*
647 * security settings, only owner of this queue can start/stop timer
648 * etc. if the queue is locked for other clients
649 */
650 int owner; /* client id for owner of the queue */
651 unsigned locked:1; /* timing queue locked for other queues */
652 char name[64]; /* name of this queue */
653 unsigned int flags; /* flags */
654 char reserved[60]; /* for future use */
655
656};
657
658/* queue info/status */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100659struct snd_seq_queue_status {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 int queue; /* queue id */
661 int events; /* read-only - queue size */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100662 snd_seq_tick_time_t tick; /* current tick */
663 struct snd_seq_real_time time; /* current time */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 int running; /* running state of queue */
665 int flags; /* various flags */
666 char reserved[64]; /* for the future */
667};
668
669
670/* queue tempo */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100671struct snd_seq_queue_tempo {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672 int queue; /* sequencer queue */
673 unsigned int tempo; /* current tempo, us/tick */
674 int ppq; /* time resolution, ticks/quarter */
675 unsigned int skew_value; /* queue skew */
676 unsigned int skew_base; /* queue skew base */
677 char reserved[24]; /* for the future */
678};
679
680
681/* sequencer timer sources */
682#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
683#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
684#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
685
686/* queue timer info */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100687struct snd_seq_queue_timer {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688 int queue; /* sequencer queue */
689 int type; /* source timer type */
690 union {
691 struct {
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100692 struct snd_timer_id id; /* ALSA's timer ID */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 unsigned int resolution; /* resolution in Hz */
694 } alsa;
695 } u;
696 char reserved[64]; /* for the future use */
697};
698
699
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100700struct snd_seq_queue_client {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701 int queue; /* sequencer queue */
702 int client; /* sequencer client */
703 int used; /* queue is used with this client
704 (must be set for accepting events) */
705 /* per client watermarks */
706 char reserved[64]; /* for future use */
707};
708
709
710#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
711#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
712#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
713
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100714struct snd_seq_port_subscribe {
715 struct snd_seq_addr sender; /* sender address */
716 struct snd_seq_addr dest; /* destination address */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700717 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
718 unsigned int flags; /* modes */
719 unsigned char queue; /* input time-stamp queue (optional) */
720 unsigned char pad[3]; /* reserved */
721 char reserved[64];
722};
723
724/* type of query subscription */
725#define SNDRV_SEQ_QUERY_SUBS_READ 0
726#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
727
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100728struct snd_seq_query_subs {
729 struct snd_seq_addr root; /* client/port id to be searched */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700730 int type; /* READ or WRITE */
731 int index; /* 0..N-1 */
732 int num_subs; /* R/O: number of subscriptions on this port */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100733 struct snd_seq_addr addr; /* R/O: result */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734 unsigned char queue; /* R/O: result */
735 unsigned int flags; /* R/O: result */
736 char reserved[64]; /* for future use */
737};
738
739
740/*
741 * Instrument abstraction layer
742 * - based on events
743 */
744
745/* instrument types */
746#define SNDRV_SEQ_INSTR_ATYPE_DATA 0 /* instrument data */
747#define SNDRV_SEQ_INSTR_ATYPE_ALIAS 1 /* instrument alias */
748
749/* instrument ASCII identifiers */
750#define SNDRV_SEQ_INSTR_ID_DLS1 "DLS1"
751#define SNDRV_SEQ_INSTR_ID_DLS2 "DLS2"
752#define SNDRV_SEQ_INSTR_ID_SIMPLE "Simple Wave"
753#define SNDRV_SEQ_INSTR_ID_SOUNDFONT "SoundFont"
754#define SNDRV_SEQ_INSTR_ID_GUS_PATCH "GUS Patch"
755#define SNDRV_SEQ_INSTR_ID_INTERWAVE "InterWave FFFF"
756#define SNDRV_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM"
757#define SNDRV_SEQ_INSTR_ID_OPL4 "OPL4"
758
759/* instrument types */
760#define SNDRV_SEQ_INSTR_TYPE0_DLS1 (1<<0) /* MIDI DLS v1 */
761#define SNDRV_SEQ_INSTR_TYPE0_DLS2 (1<<1) /* MIDI DLS v2 */
762#define SNDRV_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /* Simple Wave */
763#define SNDRV_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /* EMU SoundFont */
764#define SNDRV_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /* Gravis UltraSound Patch */
765#define SNDRV_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /* InterWave FFFF */
766#define SNDRV_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /* Yamaha OPL2/3 FM */
767#define SNDRV_SEQ_INSTR_TYPE2_OPL4 (1<<1) /* Yamaha OPL4 */
768
769/* put commands */
770#define SNDRV_SEQ_INSTR_PUT_CMD_CREATE 0
771#define SNDRV_SEQ_INSTR_PUT_CMD_REPLACE 1
772#define SNDRV_SEQ_INSTR_PUT_CMD_MODIFY 2
773#define SNDRV_SEQ_INSTR_PUT_CMD_ADD 3
774#define SNDRV_SEQ_INSTR_PUT_CMD_REMOVE 4
775
776/* get commands */
777#define SNDRV_SEQ_INSTR_GET_CMD_FULL 0
778#define SNDRV_SEQ_INSTR_GET_CMD_PARTIAL 1
779
780/* query flags */
781#define SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0)
782
783/* free commands */
784#define SNDRV_SEQ_INSTR_FREE_CMD_ALL 0
785#define SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE 1
786#define SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER 2
787#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
788
789/* size of ROM/RAM */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100790typedef unsigned int snd_seq_instr_size_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791
792/* INSTR_INFO */
793
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100794struct snd_seq_instr_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795 int result; /* operation result */
796 unsigned int formats[8]; /* bitmap of supported formats */
797 int ram_count; /* count of RAM banks */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100798 snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799 int rom_count; /* count of ROM banks */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100800 snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700801 char reserved[128];
802};
803
804/* INSTR_STATUS */
805
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100806struct snd_seq_instr_status {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 int result; /* operation result */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100808 snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809 int instrument_count; /* count of downloaded instruments */
810 char reserved[128];
811};
812
813/* INSTR_FORMAT_INFO */
814
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100815struct snd_seq_instr_format_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
817 unsigned int len; /* max data length (without this structure) */
818};
819
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100820struct snd_seq_instr_format_info_result {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821 int result; /* operation result */
822 char format[16]; /* format identifier */
823 unsigned int len; /* filled data length (without this structure) */
824};
825
826/* instrument data */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100827struct snd_seq_instr_data {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700828 char name[32]; /* instrument name */
829 char reserved[16]; /* for the future use */
830 int type; /* instrument type */
831 union {
832 char format[16]; /* format identifier */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100833 struct snd_seq_instr alias;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834 } data;
835};
836
837/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
838
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100839struct snd_seq_instr_header {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840 union {
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100841 struct snd_seq_instr instr;
842 snd_seq_instr_cluster_t cluster;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700843 } id; /* instrument identifier */
844 unsigned int cmd; /* get/put/free command */
845 unsigned int flags; /* query flags (only for get) */
846 unsigned int len; /* real instrument data length (without header) */
847 int result; /* operation result */
848 char reserved[16]; /* for the future */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100849 struct snd_seq_instr_data data; /* instrument data (for put/get result) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850};
851
852/* INSTR_CLUSTER_SET */
853
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100854struct snd_seq_instr_cluster_set {
855 snd_seq_instr_cluster_t cluster; /* cluster identifier */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856 char name[32]; /* cluster name */
857 int priority; /* cluster priority */
858 char reserved[64]; /* for the future use */
859};
860
861/* INSTR_CLUSTER_GET */
862
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100863struct snd_seq_instr_cluster_get {
864 snd_seq_instr_cluster_t cluster; /* cluster identifier */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865 char name[32]; /* cluster name */
866 int priority; /* cluster priority */
867 char reserved[64]; /* for the future use */
868};
869
870/*
871 * IOCTL commands
872 */
873
874#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
875#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100876#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
877#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100879#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
880#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700881
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100882#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
883#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
884#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
885#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700886
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100887#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
888#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700889
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100890#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
891#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
892#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
893#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
894#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
895#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
896#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
897#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
898#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)
899#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)
900#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
901#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700902/* XXX
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100903#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
904#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700905*/
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +0100906#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
907#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
908#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
909#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
910#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
911#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
912#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
913#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
914#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700915
916#endif /* __SOUND_ASEQUENCER_H */