Back to home page

LXR

 
 

    


0001 /*
0002  *  Main header file for the ALSA sequencer
0003  *  Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
0004  *            (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
0005  *
0006  *
0007  *   This program is free software; you can redistribute it and/or modify
0008  *   it under the terms of the GNU General Public License as published by
0009  *   the Free Software Foundation; either version 2 of the License, or
0010  *   (at your option) any later version.
0011  *
0012  *   This program is distributed in the hope that it will be useful,
0013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015  *   GNU General Public License for more details.
0016  *
0017  *   You should have received a copy of the GNU General Public License
0018  *   along with this program; if not, write to the Free Software
0019  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
0020  *
0021  */
0022 #ifndef _UAPI__SOUND_ASEQUENCER_H
0023 #define _UAPI__SOUND_ASEQUENCER_H
0024 
0025 #include <sound/asound.h>
0026 
0027 /** version of the sequencer */
0028 #define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2)
0029 
0030 /**
0031  * definition of sequencer event types
0032  */
0033 
0034 /** system messages
0035  * event data type = #snd_seq_result
0036  */
0037 #define SNDRV_SEQ_EVENT_SYSTEM      0
0038 #define SNDRV_SEQ_EVENT_RESULT      1
0039 
0040 /** note messages (channel specific)
0041  * event data type = #snd_seq_ev_note
0042  */
0043 #define SNDRV_SEQ_EVENT_NOTE        5
0044 #define SNDRV_SEQ_EVENT_NOTEON      6
0045 #define SNDRV_SEQ_EVENT_NOTEOFF     7
0046 #define SNDRV_SEQ_EVENT_KEYPRESS    8
0047     
0048 /** control messages (channel specific)
0049  * event data type = #snd_seq_ev_ctrl
0050  */
0051 #define SNDRV_SEQ_EVENT_CONTROLLER  10
0052 #define SNDRV_SEQ_EVENT_PGMCHANGE   11
0053 #define SNDRV_SEQ_EVENT_CHANPRESS   12
0054 #define SNDRV_SEQ_EVENT_PITCHBEND   13  /**< from -8192 to 8191 */
0055 #define SNDRV_SEQ_EVENT_CONTROL14   14  /**< 14 bit controller value */
0056 #define SNDRV_SEQ_EVENT_NONREGPARAM 15  /**< 14 bit NRPN address + 14 bit unsigned value */
0057 #define SNDRV_SEQ_EVENT_REGPARAM    16  /**< 14 bit RPN address + 14 bit unsigned value */
0058 
0059 /** synchronisation messages
0060  * event data type = #snd_seq_ev_ctrl
0061  */
0062 #define SNDRV_SEQ_EVENT_SONGPOS     20  /* Song Position Pointer with LSB and MSB values */
0063 #define SNDRV_SEQ_EVENT_SONGSEL     21  /* Song Select with song ID number */
0064 #define SNDRV_SEQ_EVENT_QFRAME      22  /* midi time code quarter frame */
0065 #define SNDRV_SEQ_EVENT_TIMESIGN    23  /* SMF Time Signature event */
0066 #define SNDRV_SEQ_EVENT_KEYSIGN     24  /* SMF Key Signature event */
0067             
0068 /** timer messages
0069  * event data type = snd_seq_ev_queue_control
0070  */
0071 #define SNDRV_SEQ_EVENT_START       30  /* midi Real Time Start message */
0072 #define SNDRV_SEQ_EVENT_CONTINUE    31  /* midi Real Time Continue message */
0073 #define SNDRV_SEQ_EVENT_STOP        32  /* midi Real Time Stop message */   
0074 #define SNDRV_SEQ_EVENT_SETPOS_TICK 33  /* set tick queue position */
0075 #define SNDRV_SEQ_EVENT_SETPOS_TIME 34  /* set realtime queue position */
0076 #define SNDRV_SEQ_EVENT_TEMPO       35  /* (SMF) Tempo event */
0077 #define SNDRV_SEQ_EVENT_CLOCK       36  /* midi Real Time Clock message */
0078 #define SNDRV_SEQ_EVENT_TICK        37  /* midi Real Time Tick message */
0079 #define SNDRV_SEQ_EVENT_QUEUE_SKEW  38  /* skew queue tempo */
0080 
0081 /** others
0082  * event data type = none
0083  */
0084 #define SNDRV_SEQ_EVENT_TUNE_REQUEST    40  /* tune request */
0085 #define SNDRV_SEQ_EVENT_RESET       41  /* reset to power-on state */
0086 #define SNDRV_SEQ_EVENT_SENSING     42  /* "active sensing" event */
0087 
0088 /** echo back, kernel private messages
0089  * event data type = any type
0090  */
0091 #define SNDRV_SEQ_EVENT_ECHO        50  /* echo event */
0092 #define SNDRV_SEQ_EVENT_OSS     51  /* OSS raw event */
0093 
0094 /** system status messages (broadcast for subscribers)
0095  * event data type = snd_seq_addr
0096  */
0097 #define SNDRV_SEQ_EVENT_CLIENT_START    60  /* new client has connected */
0098 #define SNDRV_SEQ_EVENT_CLIENT_EXIT 61  /* client has left the system */
0099 #define SNDRV_SEQ_EVENT_CLIENT_CHANGE   62  /* client status/info has changed */
0100 #define SNDRV_SEQ_EVENT_PORT_START  63  /* new port was created */
0101 #define SNDRV_SEQ_EVENT_PORT_EXIT   64  /* port was deleted from system */
0102 #define SNDRV_SEQ_EVENT_PORT_CHANGE 65  /* port status/info has changed */
0103 
0104 /** port connection changes
0105  * event data type = snd_seq_connect
0106  */
0107 #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66  /* ports connected */
0108 #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67    /* ports disconnected */
0109 
0110 /* 70-89:  synthesizer events - obsoleted */
0111 
0112 /** user-defined events with fixed length
0113  * event data type = any
0114  */
0115 #define SNDRV_SEQ_EVENT_USR0        90
0116 #define SNDRV_SEQ_EVENT_USR1        91
0117 #define SNDRV_SEQ_EVENT_USR2        92
0118 #define SNDRV_SEQ_EVENT_USR3        93
0119 #define SNDRV_SEQ_EVENT_USR4        94
0120 #define SNDRV_SEQ_EVENT_USR5        95
0121 #define SNDRV_SEQ_EVENT_USR6        96
0122 #define SNDRV_SEQ_EVENT_USR7        97
0123 #define SNDRV_SEQ_EVENT_USR8        98
0124 #define SNDRV_SEQ_EVENT_USR9        99
0125 
0126 /* 100-118: instrument layer - obsoleted */
0127 /* 119-129: reserved */
0128 
0129 /* 130-139: variable length events
0130  * event data type = snd_seq_ev_ext
0131  * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
0132  */
0133 #define SNDRV_SEQ_EVENT_SYSEX       130 /* system exclusive data (variable length) */
0134 #define SNDRV_SEQ_EVENT_BOUNCE      131 /* error event */
0135 /* 132-134: reserved */
0136 #define SNDRV_SEQ_EVENT_USR_VAR0    135
0137 #define SNDRV_SEQ_EVENT_USR_VAR1    136
0138 #define SNDRV_SEQ_EVENT_USR_VAR2    137
0139 #define SNDRV_SEQ_EVENT_USR_VAR3    138
0140 #define SNDRV_SEQ_EVENT_USR_VAR4    139
0141 
0142 /* 150-151: kernel events with quote - DO NOT use in user clients */
0143 #define SNDRV_SEQ_EVENT_KERNEL_ERROR    150
0144 #define SNDRV_SEQ_EVENT_KERNEL_QUOTE    151 /* obsolete */
0145 
0146 /* 152-191: reserved */
0147 
0148 /* 192-254: hardware specific events */
0149 
0150 /* 255: special event */
0151 #define SNDRV_SEQ_EVENT_NONE        255
0152 
0153 
0154 typedef unsigned char snd_seq_event_type_t;
0155 
0156 /** event address */
0157 struct snd_seq_addr {
0158     unsigned char client;   /**< Client number:         0..255, 255 = broadcast to all clients */
0159     unsigned char port; /**< Port within client:    0..255, 255 = broadcast to all ports */
0160 };
0161 
0162 /** port connection */
0163 struct snd_seq_connect {
0164     struct snd_seq_addr sender;
0165     struct snd_seq_addr dest;
0166 };
0167 
0168 
0169 #define SNDRV_SEQ_ADDRESS_UNKNOWN   253 /* unknown source */
0170 #define SNDRV_SEQ_ADDRESS_SUBSCRIBERS   254 /* send event to all subscribed ports */
0171 #define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
0172 #define SNDRV_SEQ_QUEUE_DIRECT      253 /* direct dispatch */
0173 
0174     /* event mode flag - NOTE: only 8 bits available! */
0175 #define SNDRV_SEQ_TIME_STAMP_TICK   (0<<0) /* timestamp in clock ticks */
0176 #define SNDRV_SEQ_TIME_STAMP_REAL   (1<<0) /* timestamp in real time */
0177 #define SNDRV_SEQ_TIME_STAMP_MASK   (1<<0)
0178 
0179 #define SNDRV_SEQ_TIME_MODE_ABS     (0<<1)  /* absolute timestamp */
0180 #define SNDRV_SEQ_TIME_MODE_REL     (1<<1)  /* relative to current time */
0181 #define SNDRV_SEQ_TIME_MODE_MASK    (1<<1)
0182 
0183 #define SNDRV_SEQ_EVENT_LENGTH_FIXED    (0<<2)  /* fixed event size */
0184 #define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2)  /* variable event size */
0185 #define SNDRV_SEQ_EVENT_LENGTH_VARUSR   (2<<2)  /* variable event size - user memory space */
0186 #define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
0187 
0188 #define SNDRV_SEQ_PRIORITY_NORMAL   (0<<4)  /* normal priority */
0189 #define SNDRV_SEQ_PRIORITY_HIGH     (1<<4)  /* event should be processed before others */
0190 #define SNDRV_SEQ_PRIORITY_MASK     (1<<4)
0191 
0192 
0193     /* note event */
0194 struct snd_seq_ev_note {
0195     unsigned char channel;
0196     unsigned char note;
0197     unsigned char velocity;
0198     unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
0199     unsigned int duration;      /* only for SNDRV_SEQ_EVENT_NOTE */
0200 };
0201 
0202     /* controller event */
0203 struct snd_seq_ev_ctrl {
0204     unsigned char channel;
0205     unsigned char unused1, unused2, unused3;    /* pad */
0206     unsigned int param;
0207     signed int value;
0208 };
0209 
0210     /* generic set of bytes (12x8 bit) */
0211 struct snd_seq_ev_raw8 {
0212     unsigned char d[12];    /* 8 bit value */
0213 };
0214 
0215     /* generic set of integers (3x32 bit) */
0216 struct snd_seq_ev_raw32 {
0217     unsigned int d[3];  /* 32 bit value */
0218 };
0219 
0220     /* external stored data */
0221 struct snd_seq_ev_ext {
0222     unsigned int len;   /* length of data */
0223     void *ptr;      /* pointer to data (note: maybe 64-bit) */
0224 } __attribute__((packed));
0225 
0226 struct snd_seq_result {
0227     int event;      /* processed event type */
0228     int result;
0229 };
0230 
0231 
0232 struct snd_seq_real_time {
0233     unsigned int tv_sec;    /* seconds */
0234     unsigned int tv_nsec;   /* nanoseconds */
0235 };
0236 
0237 typedef unsigned int snd_seq_tick_time_t;   /* midi ticks */
0238 
0239 union snd_seq_timestamp {
0240     snd_seq_tick_time_t tick;
0241     struct snd_seq_real_time time;
0242 };
0243 
0244 struct snd_seq_queue_skew {
0245     unsigned int value;
0246     unsigned int base;
0247 };
0248 
0249     /* queue timer control */
0250 struct snd_seq_ev_queue_control {
0251     unsigned char queue;            /* affected queue */
0252     unsigned char pad[3];           /* reserved */
0253     union {
0254         signed int value;       /* affected value (e.g. tempo) */
0255         union snd_seq_timestamp time;   /* time */
0256         unsigned int position;      /* sync position */
0257         struct snd_seq_queue_skew skew;
0258         unsigned int d32[2];
0259         unsigned char d8[8];
0260     } param;
0261 };
0262 
0263     /* quoted event - inside the kernel only */
0264 struct snd_seq_ev_quote {
0265     struct snd_seq_addr origin;     /* original sender */
0266     unsigned short value;       /* optional data */
0267     struct snd_seq_event *event;        /* quoted event */
0268 } __attribute__((packed));
0269 
0270 
0271     /* sequencer event */
0272 struct snd_seq_event {
0273     snd_seq_event_type_t type;  /* event type */
0274     unsigned char flags;        /* event flags */
0275     char tag;
0276     
0277     unsigned char queue;        /* schedule queue */
0278     union snd_seq_timestamp time;   /* schedule time */
0279 
0280 
0281     struct snd_seq_addr source; /* source address */
0282     struct snd_seq_addr dest;   /* destination address */
0283 
0284     union {             /* event data... */
0285         struct snd_seq_ev_note note;
0286         struct snd_seq_ev_ctrl control;
0287         struct snd_seq_ev_raw8 raw8;
0288         struct snd_seq_ev_raw32 raw32;
0289         struct snd_seq_ev_ext ext;
0290         struct snd_seq_ev_queue_control queue;
0291         union snd_seq_timestamp time;
0292         struct snd_seq_addr addr;
0293         struct snd_seq_connect connect;
0294         struct snd_seq_result result;
0295         struct snd_seq_ev_quote quote;
0296     } data;
0297 };
0298 
0299 
0300 /*
0301  * bounce event - stored as variable size data
0302  */
0303 struct snd_seq_event_bounce {
0304     int err;
0305     struct snd_seq_event event;
0306     /* external data follows here. */
0307 };
0308 
0309 
0310     /* system information */
0311 struct snd_seq_system_info {
0312     int queues;         /* maximum queues count */
0313     int clients;            /* maximum clients count */
0314     int ports;          /* maximum ports per client */
0315     int channels;           /* maximum channels per port */
0316     int cur_clients;        /* current clients */
0317     int cur_queues;         /* current queues */
0318     char reserved[24];
0319 };
0320 
0321 
0322     /* system running information */
0323 struct snd_seq_running_info {
0324     unsigned char client;       /* client id */
0325     unsigned char big_endian;   /* 1 = big-endian */
0326     unsigned char cpu_mode;     /* 4 = 32bit, 8 = 64bit */
0327     unsigned char pad;      /* reserved */
0328     unsigned char reserved[12];
0329 };
0330 
0331 
0332     /* known client numbers */
0333 #define SNDRV_SEQ_CLIENT_SYSTEM     0
0334     /* internal client numbers */
0335 #define SNDRV_SEQ_CLIENT_DUMMY      14  /* midi through */
0336 #define SNDRV_SEQ_CLIENT_OSS        15  /* oss sequencer emulator */
0337 
0338 
0339     /* client types */
0340 typedef int __bitwise snd_seq_client_type_t;
0341 #define NO_CLIENT   ((__force snd_seq_client_type_t) 0)
0342 #define USER_CLIENT ((__force snd_seq_client_type_t) 1)
0343 #define KERNEL_CLIENT   ((__force snd_seq_client_type_t) 2)
0344                         
0345     /* event filter flags */
0346 #define SNDRV_SEQ_FILTER_BROADCAST  (1<<0)  /* accept broadcast messages */
0347 #define SNDRV_SEQ_FILTER_MULTICAST  (1<<1)  /* accept multicast messages */
0348 #define SNDRV_SEQ_FILTER_BOUNCE     (1<<2)  /* accept bounce event in error */
0349 #define SNDRV_SEQ_FILTER_USE_EVENT  (1<<31) /* use event filter */
0350 
0351 struct snd_seq_client_info {
0352     int client;         /* client number to inquire */
0353     snd_seq_client_type_t type; /* client type */
0354     char name[64];          /* client name */
0355     unsigned int filter;        /* filter flags */
0356     unsigned char multicast_filter[8]; /* multicast filter bitmap */
0357     unsigned char event_filter[32]; /* event filter bitmap */
0358     int num_ports;          /* RO: number of ports */
0359     int event_lost;         /* number of lost events */
0360     int card;           /* RO: card number[kernel] */
0361     int pid;            /* RO: pid[user] */
0362     char reserved[56];      /* for future use */
0363 };
0364 
0365 
0366 /* client pool size */
0367 struct snd_seq_client_pool {
0368     int client;         /* client number to inquire */
0369     int output_pool;        /* outgoing (write) pool size */
0370     int input_pool;         /* incoming (read) pool size */
0371     int output_room;        /* minimum free pool size for select/blocking mode */
0372     int output_free;        /* unused size */
0373     int input_free;         /* unused size */
0374     char reserved[64];
0375 };
0376 
0377 
0378 /* Remove events by specified criteria */
0379 
0380 #define SNDRV_SEQ_REMOVE_INPUT      (1<<0)  /* Flush input queues */
0381 #define SNDRV_SEQ_REMOVE_OUTPUT     (1<<1)  /* Flush output queues */
0382 #define SNDRV_SEQ_REMOVE_DEST       (1<<2)  /* Restrict by destination q:client:port */
0383 #define SNDRV_SEQ_REMOVE_DEST_CHANNEL   (1<<3)  /* Restrict by channel */
0384 #define SNDRV_SEQ_REMOVE_TIME_BEFORE    (1<<4)  /* Restrict to before time */
0385 #define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5)  /* Restrict to time or after */
0386 #define SNDRV_SEQ_REMOVE_TIME_TICK  (1<<6)  /* Time is in ticks */
0387 #define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7)  /* Restrict to event type */
0388 #define SNDRV_SEQ_REMOVE_IGNORE_OFF     (1<<8)  /* Do not flush off events */
0389 #define SNDRV_SEQ_REMOVE_TAG_MATCH  (1<<9)  /* Restrict to events with given tag */
0390 
0391 struct snd_seq_remove_events {
0392     unsigned int  remove_mode;  /* Flags that determine what gets removed */
0393 
0394     union snd_seq_timestamp time;
0395 
0396     unsigned char queue;    /* Queue for REMOVE_DEST */
0397     struct snd_seq_addr dest;   /* Address for REMOVE_DEST */
0398     unsigned char channel;  /* Channel for REMOVE_DEST */
0399 
0400     int  type;  /* For REMOVE_EVENT_TYPE */
0401     char  tag;  /* Tag for REMOVE_TAG */
0402 
0403     int  reserved[10];  /* To allow for future binary compatibility */
0404 
0405 };
0406 
0407 
0408     /* known port numbers */
0409 #define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
0410 #define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE  1
0411 
0412     /* port capabilities (32 bits) */
0413 #define SNDRV_SEQ_PORT_CAP_READ     (1<<0)  /* readable from this port */
0414 #define SNDRV_SEQ_PORT_CAP_WRITE    (1<<1)  /* writable to this port */
0415 
0416 #define SNDRV_SEQ_PORT_CAP_SYNC_READ    (1<<2)
0417 #define SNDRV_SEQ_PORT_CAP_SYNC_WRITE   (1<<3)
0418 
0419 #define SNDRV_SEQ_PORT_CAP_DUPLEX   (1<<4)
0420 
0421 #define SNDRV_SEQ_PORT_CAP_SUBS_READ    (1<<5)  /* allow read subscription */
0422 #define SNDRV_SEQ_PORT_CAP_SUBS_WRITE   (1<<6)  /* allow write subscription */
0423 #define SNDRV_SEQ_PORT_CAP_NO_EXPORT    (1<<7)  /* routing not allowed */
0424 
0425     /* port type */
0426 #define SNDRV_SEQ_PORT_TYPE_SPECIFIC    (1<<0)  /* hardware specific */
0427 #define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
0428 #define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2)  /* General MIDI compatible device */
0429 #define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3)  /* GS compatible device */
0430 #define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4)  /* XG compatible device */
0431 #define SNDRV_SEQ_PORT_TYPE_MIDI_MT32   (1<<5)  /* MT-32 compatible device */
0432 #define SNDRV_SEQ_PORT_TYPE_MIDI_GM2    (1<<6)  /* General MIDI 2 compatible device */
0433 
0434 /* other standards...*/
0435 #define SNDRV_SEQ_PORT_TYPE_SYNTH   (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
0436 #define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)   /* Sampling device (support sample download) */
0437 #define SNDRV_SEQ_PORT_TYPE_SAMPLE  (1<<12) /* Sampling device (sample can be downloaded at any time) */
0438 /*...*/
0439 #define SNDRV_SEQ_PORT_TYPE_HARDWARE    (1<<16) /* driver for a hardware device */
0440 #define SNDRV_SEQ_PORT_TYPE_SOFTWARE    (1<<17) /* implemented in software */
0441 #define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
0442 #define SNDRV_SEQ_PORT_TYPE_PORT    (1<<19) /* connects to other device(s) */
0443 #define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
0444 
0445 /* misc. conditioning flags */
0446 #define SNDRV_SEQ_PORT_FLG_GIVEN_PORT   (1<<0)
0447 #define SNDRV_SEQ_PORT_FLG_TIMESTAMP    (1<<1)
0448 #define SNDRV_SEQ_PORT_FLG_TIME_REAL    (1<<2)
0449 
0450 struct snd_seq_port_info {
0451     struct snd_seq_addr addr;   /* client/port numbers */
0452     char name[64];          /* port name */
0453 
0454     unsigned int capability;    /* port capability bits */
0455     unsigned int type;      /* port type bits */
0456     int midi_channels;      /* channels per MIDI port */
0457     int midi_voices;        /* voices per MIDI port */
0458     int synth_voices;       /* voices per SYNTH port */
0459 
0460     int read_use;           /* R/O: subscribers for output (from this port) */
0461     int write_use;          /* R/O: subscribers for input (to this port) */
0462 
0463     void *kernel;           /* reserved for kernel use (must be NULL) */
0464     unsigned int flags;     /* misc. conditioning */
0465     unsigned char time_queue;   /* queue # for timestamping */
0466     char reserved[59];      /* for future use */
0467 };
0468 
0469 
0470 /* queue flags */
0471 #define SNDRV_SEQ_QUEUE_FLG_SYNC    (1<<0)  /* sync enabled */
0472 
0473 /* queue information */
0474 struct snd_seq_queue_info {
0475     int queue;      /* queue id */
0476 
0477     /*
0478      *  security settings, only owner of this queue can start/stop timer
0479      *  etc. if the queue is locked for other clients
0480      */
0481     int owner;      /* client id for owner of the queue */
0482     unsigned locked:1;  /* timing queue locked for other queues */
0483     char name[64];      /* name of this queue */
0484     unsigned int flags; /* flags */
0485     char reserved[60];  /* for future use */
0486 
0487 };
0488 
0489 /* queue info/status */
0490 struct snd_seq_queue_status {
0491     int queue;          /* queue id */
0492     int events;         /* read-only - queue size */
0493     snd_seq_tick_time_t tick;   /* current tick */
0494     struct snd_seq_real_time time;  /* current time */
0495     int running;            /* running state of queue */
0496     int flags;          /* various flags */
0497     char reserved[64];      /* for the future */
0498 };
0499 
0500 
0501 /* queue tempo */
0502 struct snd_seq_queue_tempo {
0503     int queue;          /* sequencer queue */
0504     unsigned int tempo;     /* current tempo, us/tick */
0505     int ppq;            /* time resolution, ticks/quarter */
0506     unsigned int skew_value;    /* queue skew */
0507     unsigned int skew_base;     /* queue skew base */
0508     char reserved[24];      /* for the future */
0509 };
0510 
0511 
0512 /* sequencer timer sources */
0513 #define SNDRV_SEQ_TIMER_ALSA        0   /* ALSA timer */
0514 #define SNDRV_SEQ_TIMER_MIDI_CLOCK  1   /* Midi Clock (CLOCK event) */
0515 #define SNDRV_SEQ_TIMER_MIDI_TICK   2   /* Midi Timer Tick (TICK event) */
0516 
0517 /* queue timer info */
0518 struct snd_seq_queue_timer {
0519     int queue;          /* sequencer queue */
0520     int type;           /* source timer type */
0521     union {
0522         struct {
0523             struct snd_timer_id id; /* ALSA's timer ID */
0524             unsigned int resolution;    /* resolution in Hz */
0525         } alsa;
0526     } u;
0527     char reserved[64];      /* for the future use */
0528 };
0529 
0530 
0531 struct snd_seq_queue_client {
0532     int queue;      /* sequencer queue */
0533     int client;     /* sequencer client */
0534     int used;       /* queue is used with this client
0535                    (must be set for accepting events) */
0536     /* per client watermarks */
0537     char reserved[64];  /* for future use */
0538 };
0539 
0540 
0541 #define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE   (1<<0)  /* exclusive connection */
0542 #define SNDRV_SEQ_PORT_SUBS_TIMESTAMP   (1<<1)
0543 #define SNDRV_SEQ_PORT_SUBS_TIME_REAL   (1<<2)
0544 
0545 struct snd_seq_port_subscribe {
0546     struct snd_seq_addr sender; /* sender address */
0547     struct snd_seq_addr dest;   /* destination address */
0548     unsigned int voices;        /* number of voices to be allocated (0 = don't care) */
0549     unsigned int flags;     /* modes */
0550     unsigned char queue;        /* input time-stamp queue (optional) */
0551     unsigned char pad[3];       /* reserved */
0552     char reserved[64];
0553 };
0554 
0555 /* type of query subscription */
0556 #define SNDRV_SEQ_QUERY_SUBS_READ   0
0557 #define SNDRV_SEQ_QUERY_SUBS_WRITE  1
0558 
0559 struct snd_seq_query_subs {
0560     struct snd_seq_addr root;   /* client/port id to be searched */
0561     int type;       /* READ or WRITE */
0562     int index;      /* 0..N-1 */
0563     int num_subs;       /* R/O: number of subscriptions on this port */
0564     struct snd_seq_addr addr;   /* R/O: result */
0565     unsigned char queue;    /* R/O: result */
0566     unsigned int flags; /* R/O: result */
0567     char reserved[64];  /* for future use */
0568 };
0569 
0570 
0571 /*
0572  *  IOCTL commands
0573  */
0574 
0575 #define SNDRV_SEQ_IOCTL_PVERSION    _IOR ('S', 0x00, int)
0576 #define SNDRV_SEQ_IOCTL_CLIENT_ID   _IOR ('S', 0x01, int)
0577 #define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
0578 #define SNDRV_SEQ_IOCTL_RUNNING_MODE    _IOWR('S', 0x03, struct snd_seq_running_info)
0579 
0580 #define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
0581 #define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
0582 
0583 #define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
0584 #define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
0585 #define SNDRV_SEQ_IOCTL_GET_PORT_INFO   _IOWR('S', 0x22, struct snd_seq_port_info)
0586 #define SNDRV_SEQ_IOCTL_SET_PORT_INFO   _IOW ('S', 0x23, struct snd_seq_port_info)
0587 
0588 #define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT  _IOW ('S', 0x30, struct snd_seq_port_subscribe)
0589 #define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
0590 
0591 #define SNDRV_SEQ_IOCTL_CREATE_QUEUE    _IOWR('S', 0x32, struct snd_seq_queue_info)
0592 #define SNDRV_SEQ_IOCTL_DELETE_QUEUE    _IOW ('S', 0x33, struct snd_seq_queue_info)
0593 #define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO  _IOWR('S', 0x34, struct snd_seq_queue_info)
0594 #define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO  _IOWR('S', 0x35, struct snd_seq_queue_info)
0595 #define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
0596 #define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
0597 #define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
0598 #define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
0599 #define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
0600 #define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
0601 #define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT    _IOWR('S', 0x49, struct snd_seq_queue_client)
0602 #define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT    _IOW ('S', 0x4a, struct snd_seq_queue_client)
0603 #define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
0604 #define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
0605 #define SNDRV_SEQ_IOCTL_REMOVE_EVENTS   _IOW ('S', 0x4e, struct snd_seq_remove_events)
0606 #define SNDRV_SEQ_IOCTL_QUERY_SUBS  _IOWR('S', 0x4f, struct snd_seq_query_subs)
0607 #define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION    _IOWR('S', 0x50, struct snd_seq_port_subscribe)
0608 #define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT   _IOWR('S', 0x51, struct snd_seq_client_info)
0609 #define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
0610 
0611 #endif /* _UAPI__SOUND_ASEQUENCER_H */