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

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

initial import

File size: 32.7 KB
Line 
1/*
2 * Main header file for the ALSA sequencer
3 * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
4 * (c) 1998-1999 by Jaroslav Kysela <perex@suse.cz>
5 *
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
25#ifdef __KERNEL__
26#include <linux/ioctl.h>
27#include <sound/asound.h>
28#endif
29
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
38 * event data type = #snd_seq_result
39 */
40#define SNDRV_SEQ_EVENT_SYSTEM 0
41#define SNDRV_SEQ_EVENT_RESULT 1
42
43/** note messages (channel specific)
44 * event data type = #snd_seq_ev_note
45 */
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)
52 * event data type = #snd_seq_ev_ctrl
53 */
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
63 * event data type = #snd_seq_ev_ctrl
64 */
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
72 * event data type = snd_seq_ev_queue_control
73 */
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)
98 * event data type = snd_seq_addr
99 */
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
108 * event data type = snd_seq_connect
109 */
110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
112
113/** synthesizer events
114 * event data type = snd_seq_eve_sample_control
115 */
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
165 * event data type = snd_seq_ev_ext
166 * (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
189typedef unsigned char snd_seq_event_type_t;
190
191/** event address */
192struct snd_seq_addr {
193 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 */
198struct snd_seq_connect {
199 struct snd_seq_addr sender;
200 struct snd_seq_addr dest;
201};
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 */
229struct snd_seq_ev_note {
230 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 */
238struct snd_seq_ev_ctrl {
239 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) */
246struct snd_seq_ev_raw8 {
247 unsigned char d[12]; /* 8 bit value */
248};
249
250 /* generic set of integers (3x32 bit) */
251struct snd_seq_ev_raw32 {
252 unsigned int d[3]; /* 32 bit value */
253};
254
255/* external stored data */
256#pragma pack(1)
257struct snd_seq_ev_ext {
258 unsigned int len; /* length of data */
259 void *ptr; /* pointer to data (note: maybe 64-bit) */
260};
261#pragma pack()
262
263/* Instrument cluster type */
264typedef unsigned int snd_seq_instr_cluster_t;
265
266/* Instrument type */
267struct snd_seq_instr {
268 snd_seq_instr_cluster_t cluster;
269 unsigned int std; /* the upper byte means a private instrument (owner - client #) */
270 unsigned short bank;
271 unsigned short prg;
272};
273
274 /* sample number */
275struct snd_seq_ev_sample {
276 unsigned int std;
277 unsigned short bank;
278 unsigned short prg;
279};
280
281 /* sample cluster */
282struct snd_seq_ev_cluster {
283 snd_seq_instr_cluster_t cluster;
284};
285
286 /* sample position */
287typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */
288
289 /* sample stop mode */
290enum {
291 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
292 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
293 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
294};
295
296 /* sample frequency */
297typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */
298
299 /* sample volume control; if any value is set to -1 == do not change */
300struct snd_seq_ev_volume {
301 signed short volume; /* range: 0-16383 */
302 signed short lr; /* left-right balance; range: 0-16383 */
303 signed short fr; /* front-rear balance; range: 0-16383 */
304 signed short du; /* down-up balance; range: 0-16383 */
305};
306
307 /* simple loop redefinition */
308struct snd_seq_ev_loop {
309 unsigned int start; /* loop start (in samples) * 16 */
310 unsigned int end; /* loop end (in samples) * 16 */
311};
312
313struct snd_seq_ev_sample_control {
314 unsigned char channel;
315 unsigned char unused1, unused2, unused3; /* pad */
316 union {
317 struct snd_seq_ev_sample sample;
318 struct snd_seq_ev_cluster cluster;
319 snd_seq_position_t position;
320 int stop_mode;
321 snd_seq_frequency_t frequency;
322 struct snd_seq_ev_volume volume;
323 struct snd_seq_ev_loop loop;
324 unsigned char raw8[8];
325 } param;
326};
327
328
329
330/* INSTR_BEGIN event */
331struct snd_seq_ev_instr_begin {
332 int timeout; /* zero = forever, otherwise timeout in ms */
333};
334
335struct snd_seq_result {
336 int event; /* processed event type */
337 int result;
338};
339
340
341struct snd_seq_real_time {
342 unsigned int tv_sec; /* seconds */
343 unsigned int tv_nsec; /* nanoseconds */
344};
345
346typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
347
348union snd_seq_timestamp {
349 snd_seq_tick_time_t tick;
350 struct snd_seq_real_time time;
351};
352
353struct snd_seq_queue_skew {
354 unsigned int value;
355 unsigned int base;
356};
357
358 /* queue timer control */
359struct snd_seq_ev_queue_control {
360 unsigned char queue; /* affected queue */
361 unsigned char pad[3]; /* reserved */
362 union {
363 signed int value; /* affected value (e.g. tempo) */
364 union snd_seq_timestamp time; /* time */
365 unsigned int position; /* sync position */
366 struct snd_seq_queue_skew skew;
367 unsigned int d32[2];
368 unsigned char d8[8];
369 } param;
370};
371
372/* quoted event - inside the kernel only */
373#pragma pack(1)
374struct snd_seq_ev_quote {
375 struct snd_seq_addr origin; /* original sender */
376 unsigned short value; /* optional data */
377 struct snd_seq_event *event; /* quoted event */
378};
379#pragma pack()
380
381 /* sequencer event */
382struct snd_seq_event {
383 snd_seq_event_type_t type; /* event type */
384 unsigned char flags; /* event flags */
385 char tag;
386
387 unsigned char queue; /* schedule queue */
388 union snd_seq_timestamp time; /* schedule time */
389
390
391 struct snd_seq_addr source; /* source address */
392 struct snd_seq_addr dest; /* destination address */
393
394 union { /* event data... */
395 struct snd_seq_ev_note note;
396 struct snd_seq_ev_ctrl control;
397 struct snd_seq_ev_raw8 raw8;
398 struct snd_seq_ev_raw32 raw32;
399 struct snd_seq_ev_ext ext;
400 struct snd_seq_ev_queue_control queue;
401 union snd_seq_timestamp time;
402 struct snd_seq_addr addr;
403 struct snd_seq_connect connect;
404 struct snd_seq_result result;
405 struct snd_seq_ev_instr_begin instr_begin;
406 struct snd_seq_ev_sample_control sample;
407 struct snd_seq_ev_quote quote;
408 } data;
409};
410
411
412/*
413 * bounce event - stored as variable size data
414 */
415struct snd_seq_event_bounce {
416 int err;
417 struct snd_seq_event event;
418 /* external data follows here. */
419};
420
421#ifdef __KERNEL__
422
423/* helper macro */
424#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
425
426/*
427 * type check macros
428 */
429/* result events: 0-4 */
430#define snd_seq_ev_is_result_type(ev) ((ev)->type < 5)
431/* channel specific events: 5-19 */
432#define snd_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
433/* note events: 5-9 */
434#define snd_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
435/* control events: 10-19 */
436#define snd_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
437/* queue control events: 30-39 */
438#define snd_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
439/* system status messages */
440#define snd_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
441/* sample messages */
442#define snd_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
443/* user-defined messages */
444#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
445/* fixed length events: 0-99 */
446#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
447/* instrument layer events: 100-129 */
448#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
449/* variable length events: 130-139 */
450#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
451/* reserved for kernel */
452#define snd_seq_ev_is_reserved(ev) ((ev)->type >= 150)
453
454/* direct dispatched events */
455#define snd_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 snd_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
462
463/* event length type */
464#define snd_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
465#define snd_seq_ev_is_fixed(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
466#define snd_seq_ev_is_variable(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
467#define snd_seq_ev_is_varusr(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
468
469/* time-stamp type */
470#define snd_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
471#define snd_seq_ev_is_tick(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
472#define snd_seq_ev_is_real(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
473
474/* time-mode type */
475#define snd_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
476#define snd_seq_ev_is_abstime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
477#define snd_seq_ev_is_reltime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
478
479/* queue sync port */
480#define snd_seq_queue_sync_port(q) ((q) + 16)
481
482#endif /* __KERNEL__ */
483
484 /* system information */
485struct snd_seq_system_info {
486 int queues; /* maximum queues count */
487 int clients; /* maximum clients count */
488 int ports; /* maximum ports per client */
489 int channels; /* maximum channels per port */
490 int cur_clients; /* current clients */
491 int cur_queues; /* current queues */
492 char reserved[24];
493};
494
495
496 /* system running information */
497struct snd_seq_running_info {
498 unsigned char client; /* client id */
499 unsigned char big_endian; /* 1 = big-endian */
500 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
501 unsigned char pad; /* reserved */
502 unsigned char reserved[12];
503};
504
505
506 /* known client numbers */
507#define SNDRV_SEQ_CLIENT_SYSTEM 0
508#define SNDRV_SEQ_CLIENT_DUMMY 62 /* dummy ports */
509#define SNDRV_SEQ_CLIENT_OSS 63 /* oss sequencer emulator */
510
511
512 /* client types */
513typedef int __bitwise snd_seq_client_type_t;
514#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
515#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
516#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
517
518 /* event filter flags */
519#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
520#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
521#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
522#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
523
524struct snd_seq_client_info {
525 int client; /* client number to inquire */
526 snd_seq_client_type_t type; /* client type */
527 char name[64]; /* client name */
528 unsigned int filter; /* filter flags */
529 unsigned char multicast_filter[8]; /* multicast filter bitmap */
530 unsigned char event_filter[32]; /* event filter bitmap */
531 int num_ports; /* RO: number of ports */
532 int event_lost; /* number of lost events */
533 char reserved[64]; /* for future use */
534};
535
536
537/* client pool size */
538struct snd_seq_client_pool {
539 int client; /* client number to inquire */
540 int output_pool; /* outgoing (write) pool size */
541 int input_pool; /* incoming (read) pool size */
542 int output_room; /* minimum free pool size for select/blocking mode */
543 int output_free; /* unused size */
544 int input_free; /* unused size */
545 char reserved[64];
546};
547
548
549/* Remove events by specified criteria */
550
551#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
552#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
553#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
554#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
555#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
556#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
557#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
558#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
559#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
560#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
561
562struct snd_seq_remove_events {
563 unsigned int remove_mode; /* Flags that determine what gets removed */
564
565 union snd_seq_timestamp time;
566
567 unsigned char queue; /* Queue for REMOVE_DEST */
568 struct snd_seq_addr dest; /* Address for REMOVE_DEST */
569 unsigned char channel; /* Channel for REMOVE_DEST */
570
571 int type; /* For REMOVE_EVENT_TYPE */
572 char tag; /* Tag for REMOVE_TAG */
573
574 int reserved[10]; /* To allow for future binary compatibility */
575
576};
577
578
579 /* known port numbers */
580#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
581#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
582
583 /* port capabilities (32 bits) */
584#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
585#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
586
587#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
588#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
589
590#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
591
592#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
593#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
594#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
595
596 /* port type */
597#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
598#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
599#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
600#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
601#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
602#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
603#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
604
605/* other standards...*/
606#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
607#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
608#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
609/*...*/
610#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
611
612/* misc. conditioning flags */
613#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
614#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
615#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
616
617struct snd_seq_port_info {
618 struct snd_seq_addr addr; /* client/port numbers */
619 char name[64]; /* port name */
620
621 unsigned int capability; /* port capability bits */
622 unsigned int type; /* port type bits */
623 int midi_channels; /* channels per MIDI port */
624 int midi_voices; /* voices per MIDI port */
625 int synth_voices; /* voices per SYNTH port */
626
627 int read_use; /* R/O: subscribers for output (from this port) */
628 int write_use; /* R/O: subscribers for input (to this port) */
629
630 void *kernel; /* reserved for kernel use (must be NULL) */
631 unsigned int flags; /* misc. conditioning */
632 unsigned char time_queue; /* queue # for timestamping */
633 char reserved[59]; /* for future use */
634};
635
636
637/* queue flags */
638#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
639
640/* queue information */
641struct snd_seq_queue_info {
642 int queue; /* queue id */
643
644 /*
645 * security settings, only owner of this queue can start/stop timer
646 * etc. if the queue is locked for other clients
647 */
648 int owner; /* client id for owner of the queue */
649 unsigned locked:1; /* timing queue locked for other queues */
650 char name[64]; /* name of this queue */
651 unsigned int flags; /* flags */
652 char reserved[60]; /* for future use */
653
654};
655
656/* queue info/status */
657struct snd_seq_queue_status {
658 int queue; /* queue id */
659 int events; /* read-only - queue size */
660 snd_seq_tick_time_t tick; /* current tick */
661 struct snd_seq_real_time time; /* current time */
662 int running; /* running state of queue */
663 int flags; /* various flags */
664 char reserved[64]; /* for the future */
665};
666
667
668/* queue tempo */
669struct snd_seq_queue_tempo {
670 int queue; /* sequencer queue */
671 unsigned int tempo; /* current tempo, us/tick */
672 int ppq; /* time resolution, ticks/quarter */
673 unsigned int skew_value; /* queue skew */
674 unsigned int skew_base; /* queue skew base */
675 char reserved[24]; /* for the future */
676};
677
678
679/* sequencer timer sources */
680#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
681#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
682#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
683
684/* queue timer info */
685struct snd_seq_queue_timer {
686 int queue; /* sequencer queue */
687 int type; /* source timer type */
688 union {
689 struct {
690 struct snd_timer_id id; /* ALSA's timer ID */
691 unsigned int resolution; /* resolution in Hz */
692 } alsa;
693 } u;
694 char reserved[64]; /* for the future use */
695};
696
697
698struct snd_seq_queue_client {
699 int queue; /* sequencer queue */
700 int client; /* sequencer client */
701 int used; /* queue is used with this client
702 (must be set for accepting events) */
703 /* per client watermarks */
704 char reserved[64]; /* for future use */
705};
706
707
708#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
709#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
710#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
711
712struct snd_seq_port_subscribe {
713 struct snd_seq_addr sender; /* sender address */
714 struct snd_seq_addr dest; /* destination address */
715 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
716 unsigned int flags; /* modes */
717 unsigned char queue; /* input time-stamp queue (optional) */
718 unsigned char pad[3]; /* reserved */
719 char reserved[64];
720};
721
722/* type of query subscription */
723#define SNDRV_SEQ_QUERY_SUBS_READ 0
724#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
725
726struct snd_seq_query_subs {
727 struct snd_seq_addr root; /* client/port id to be searched */
728 int type; /* READ or WRITE */
729 int index; /* 0..N-1 */
730 int num_subs; /* R/O: number of subscriptions on this port */
731 struct snd_seq_addr addr; /* R/O: result */
732 unsigned char queue; /* R/O: result */
733 unsigned int flags; /* R/O: result */
734 char reserved[64]; /* for future use */
735};
736
737
738/*
739 * Instrument abstraction layer
740 * - based on events
741 */
742
743/* instrument types */
744#define SNDRV_SEQ_INSTR_ATYPE_DATA 0 /* instrument data */
745#define SNDRV_SEQ_INSTR_ATYPE_ALIAS 1 /* instrument alias */
746
747/* instrument ASCII identifiers */
748#define SNDRV_SEQ_INSTR_ID_DLS1 "DLS1"
749#define SNDRV_SEQ_INSTR_ID_DLS2 "DLS2"
750#define SNDRV_SEQ_INSTR_ID_SIMPLE "Simple Wave"
751#define SNDRV_SEQ_INSTR_ID_SOUNDFONT "SoundFont"
752#define SNDRV_SEQ_INSTR_ID_GUS_PATCH "GUS Patch"
753#define SNDRV_SEQ_INSTR_ID_INTERWAVE "InterWave FFFF"
754#define SNDRV_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM"
755#define SNDRV_SEQ_INSTR_ID_OPL4 "OPL4"
756
757/* instrument types */
758#define SNDRV_SEQ_INSTR_TYPE0_DLS1 (1<<0) /* MIDI DLS v1 */
759#define SNDRV_SEQ_INSTR_TYPE0_DLS2 (1<<1) /* MIDI DLS v2 */
760#define SNDRV_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /* Simple Wave */
761#define SNDRV_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /* EMU SoundFont */
762#define SNDRV_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /* Gravis UltraSound Patch */
763#define SNDRV_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /* InterWave FFFF */
764#define SNDRV_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /* Yamaha OPL2/3 FM */
765#define SNDRV_SEQ_INSTR_TYPE2_OPL4 (1<<1) /* Yamaha OPL4 */
766
767/* put commands */
768#define SNDRV_SEQ_INSTR_PUT_CMD_CREATE 0
769#define SNDRV_SEQ_INSTR_PUT_CMD_REPLACE 1
770#define SNDRV_SEQ_INSTR_PUT_CMD_MODIFY 2
771#define SNDRV_SEQ_INSTR_PUT_CMD_ADD 3
772#define SNDRV_SEQ_INSTR_PUT_CMD_REMOVE 4
773
774/* get commands */
775#define SNDRV_SEQ_INSTR_GET_CMD_FULL 0
776#define SNDRV_SEQ_INSTR_GET_CMD_PARTIAL 1
777
778/* query flags */
779#define SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0)
780
781/* free commands */
782#define SNDRV_SEQ_INSTR_FREE_CMD_ALL 0
783#define SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE 1
784#define SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER 2
785#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
786
787/* size of ROM/RAM */
788typedef unsigned int snd_seq_instr_size_t;
789
790/* INSTR_INFO */
791
792struct snd_seq_instr_info {
793 int result; /* operation result */
794 unsigned int formats[8]; /* bitmap of supported formats */
795 int ram_count; /* count of RAM banks */
796 snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
797 int rom_count; /* count of ROM banks */
798 snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
799 char reserved[128];
800};
801
802/* INSTR_STATUS */
803
804struct snd_seq_instr_status {
805 int result; /* operation result */
806 snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */
807 int instrument_count; /* count of downloaded instruments */
808 char reserved[128];
809};
810
811/* INSTR_FORMAT_INFO */
812
813struct snd_seq_instr_format_info {
814 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
815 unsigned int len; /* max data length (without this structure) */
816};
817
818struct snd_seq_instr_format_info_result {
819 int result; /* operation result */
820 char format[16]; /* format identifier */
821 unsigned int len; /* filled data length (without this structure) */
822};
823
824/* instrument data */
825struct snd_seq_instr_data {
826 char name[32]; /* instrument name */
827 char reserved[16]; /* for the future use */
828 int type; /* instrument type */
829 union {
830 char format[16]; /* format identifier */
831 struct snd_seq_instr alias;
832 } data;
833};
834
835/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
836
837struct snd_seq_instr_header {
838 union {
839 struct snd_seq_instr instr;
840 snd_seq_instr_cluster_t cluster;
841 } id; /* instrument identifier */
842 unsigned int cmd; /* get/put/free command */
843 unsigned int flags; /* query flags (only for get) */
844 unsigned int len; /* real instrument data length (without header) */
845 int result; /* operation result */
846 char reserved[16]; /* for the future */
847 struct snd_seq_instr_data data; /* instrument data (for put/get result) */
848};
849
850/* INSTR_CLUSTER_SET */
851
852struct snd_seq_instr_cluster_set {
853 snd_seq_instr_cluster_t cluster; /* cluster identifier */
854 char name[32]; /* cluster name */
855 int priority; /* cluster priority */
856 char reserved[64]; /* for the future use */
857};
858
859/* INSTR_CLUSTER_GET */
860
861struct snd_seq_instr_cluster_get {
862 snd_seq_instr_cluster_t cluster; /* cluster identifier */
863 char name[32]; /* cluster name */
864 int priority; /* cluster priority */
865 char reserved[64]; /* for the future use */
866};
867
868/*
869 * IOCTL commands
870 */
871
872#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
873#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
874#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
875#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
876
877#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
878#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
879
880#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
881#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
882#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
883#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
884
885#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
886#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
887
888#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
889#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
890#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
891#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
892#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
893#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
894#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
895#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
896#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)
897#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)
898#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
899#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
900/* XXX
901#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
902#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
903*/
904#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
905#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
906#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
907#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
908#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
909#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
910#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
911#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
912#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
913
914#endif /* __SOUND_ASEQUENCER_H */
Note: See TracBrowser for help on using the repository browser.