Back to home page

OSCL-LXR

 
 

    


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