1674e95caSDavid Howells /* 2674e95caSDavid Howells * Main header file for the ALSA sequencer 3674e95caSDavid Howells * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl> 4674e95caSDavid Howells * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz> 5674e95caSDavid Howells * 6674e95caSDavid Howells * 7674e95caSDavid Howells * This program is free software; you can redistribute it and/or modify 8674e95caSDavid Howells * it under the terms of the GNU General Public License as published by 9674e95caSDavid Howells * the Free Software Foundation; either version 2 of the License, or 10674e95caSDavid Howells * (at your option) any later version. 11674e95caSDavid Howells * 12674e95caSDavid Howells * This program is distributed in the hope that it will be useful, 13674e95caSDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 14674e95caSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15674e95caSDavid Howells * GNU General Public License for more details. 16674e95caSDavid Howells * 17674e95caSDavid Howells * You should have received a copy of the GNU General Public License 18674e95caSDavid Howells * along with this program; if not, write to the Free Software 19674e95caSDavid Howells * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20674e95caSDavid Howells * 21674e95caSDavid Howells */ 22674e95caSDavid Howells #ifndef _UAPI__SOUND_ASEQUENCER_H 23674e95caSDavid Howells #define _UAPI__SOUND_ASEQUENCER_H 24674e95caSDavid Howells 25bbf91c1cSMikko Rapeli #include <sound/asound.h> 26674e95caSDavid Howells 27674e95caSDavid Howells /** version of the sequencer */ 28674e95caSDavid Howells #define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1) 29674e95caSDavid Howells 30674e95caSDavid Howells /** 31674e95caSDavid Howells * definition of sequencer event types 32674e95caSDavid Howells */ 33674e95caSDavid Howells 34674e95caSDavid Howells /** system messages 35674e95caSDavid Howells * event data type = #snd_seq_result 36674e95caSDavid Howells */ 37674e95caSDavid Howells #define SNDRV_SEQ_EVENT_SYSTEM 0 38674e95caSDavid Howells #define SNDRV_SEQ_EVENT_RESULT 1 39674e95caSDavid Howells 40674e95caSDavid Howells /** note messages (channel specific) 41674e95caSDavid Howells * event data type = #snd_seq_ev_note 42674e95caSDavid Howells */ 43674e95caSDavid Howells #define SNDRV_SEQ_EVENT_NOTE 5 44674e95caSDavid Howells #define SNDRV_SEQ_EVENT_NOTEON 6 45674e95caSDavid Howells #define SNDRV_SEQ_EVENT_NOTEOFF 7 46674e95caSDavid Howells #define SNDRV_SEQ_EVENT_KEYPRESS 8 47674e95caSDavid Howells 48674e95caSDavid Howells /** control messages (channel specific) 49674e95caSDavid Howells * event data type = #snd_seq_ev_ctrl 50674e95caSDavid Howells */ 51674e95caSDavid Howells #define SNDRV_SEQ_EVENT_CONTROLLER 10 52674e95caSDavid Howells #define SNDRV_SEQ_EVENT_PGMCHANGE 11 53674e95caSDavid Howells #define SNDRV_SEQ_EVENT_CHANPRESS 12 54674e95caSDavid Howells #define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ 55674e95caSDavid Howells #define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ 56674e95caSDavid Howells #define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ 57674e95caSDavid Howells #define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ 58674e95caSDavid Howells 59674e95caSDavid Howells /** synchronisation messages 60674e95caSDavid Howells * event data type = #snd_seq_ev_ctrl 61674e95caSDavid Howells */ 62674e95caSDavid Howells #define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ 63674e95caSDavid Howells #define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ 64674e95caSDavid Howells #define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ 65674e95caSDavid Howells #define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ 66674e95caSDavid Howells #define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ 67674e95caSDavid Howells 68674e95caSDavid Howells /** timer messages 69674e95caSDavid Howells * event data type = snd_seq_ev_queue_control 70674e95caSDavid Howells */ 71674e95caSDavid Howells #define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ 72674e95caSDavid Howells #define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ 73674e95caSDavid Howells #define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ 74674e95caSDavid Howells #define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ 75674e95caSDavid Howells #define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ 76674e95caSDavid Howells #define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ 77674e95caSDavid Howells #define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ 78674e95caSDavid Howells #define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ 79674e95caSDavid Howells #define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ 80674e95caSDavid Howells 81674e95caSDavid Howells /** others 82674e95caSDavid Howells * event data type = none 83674e95caSDavid Howells */ 84674e95caSDavid Howells #define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ 85674e95caSDavid Howells #define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ 86674e95caSDavid Howells #define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ 87674e95caSDavid Howells 88674e95caSDavid Howells /** echo back, kernel private messages 89674e95caSDavid Howells * event data type = any type 90674e95caSDavid Howells */ 91674e95caSDavid Howells #define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ 92674e95caSDavid Howells #define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ 93674e95caSDavid Howells 94674e95caSDavid Howells /** system status messages (broadcast for subscribers) 95674e95caSDavid Howells * event data type = snd_seq_addr 96674e95caSDavid Howells */ 97674e95caSDavid Howells #define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ 98674e95caSDavid Howells #define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ 99674e95caSDavid Howells #define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ 100674e95caSDavid Howells #define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ 101674e95caSDavid Howells #define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ 102674e95caSDavid Howells #define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ 103674e95caSDavid Howells 104674e95caSDavid Howells /** port connection changes 105674e95caSDavid Howells * event data type = snd_seq_connect 106674e95caSDavid Howells */ 107674e95caSDavid Howells #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ 108674e95caSDavid Howells #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ 109674e95caSDavid Howells 110674e95caSDavid Howells /* 70-89: synthesizer events - obsoleted */ 111674e95caSDavid Howells 112674e95caSDavid Howells /** user-defined events with fixed length 113674e95caSDavid Howells * event data type = any 114674e95caSDavid Howells */ 115674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR0 90 116674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR1 91 117674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR2 92 118674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR3 93 119674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR4 94 120674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR5 95 121674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR6 96 122674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR7 97 123674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR8 98 124674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR9 99 125674e95caSDavid Howells 126674e95caSDavid Howells /* 100-118: instrument layer - obsoleted */ 127674e95caSDavid Howells /* 119-129: reserved */ 128674e95caSDavid Howells 129674e95caSDavid Howells /* 130-139: variable length events 130674e95caSDavid Howells * event data type = snd_seq_ev_ext 131674e95caSDavid Howells * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) 132674e95caSDavid Howells */ 133674e95caSDavid Howells #define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ 134674e95caSDavid Howells #define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ 135674e95caSDavid Howells /* 132-134: reserved */ 136674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR_VAR0 135 137674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR_VAR1 136 138674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR_VAR2 137 139674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR_VAR3 138 140674e95caSDavid Howells #define SNDRV_SEQ_EVENT_USR_VAR4 139 141674e95caSDavid Howells 142674e95caSDavid Howells /* 150-151: kernel events with quote - DO NOT use in user clients */ 143674e95caSDavid Howells #define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 144674e95caSDavid Howells #define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ 145674e95caSDavid Howells 146674e95caSDavid Howells /* 152-191: reserved */ 147674e95caSDavid Howells 148674e95caSDavid Howells /* 192-254: hardware specific events */ 149674e95caSDavid Howells 150674e95caSDavid Howells /* 255: special event */ 151674e95caSDavid Howells #define SNDRV_SEQ_EVENT_NONE 255 152674e95caSDavid Howells 153674e95caSDavid Howells 154674e95caSDavid Howells typedef unsigned char snd_seq_event_type_t; 155674e95caSDavid Howells 156674e95caSDavid Howells /** event address */ 157674e95caSDavid Howells struct snd_seq_addr { 158674e95caSDavid Howells unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ 159674e95caSDavid Howells unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ 160674e95caSDavid Howells }; 161674e95caSDavid Howells 162674e95caSDavid Howells /** port connection */ 163674e95caSDavid Howells struct snd_seq_connect { 164674e95caSDavid Howells struct snd_seq_addr sender; 165674e95caSDavid Howells struct snd_seq_addr dest; 166674e95caSDavid Howells }; 167674e95caSDavid Howells 168674e95caSDavid Howells 169674e95caSDavid Howells #define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ 170674e95caSDavid Howells #define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ 171674e95caSDavid Howells #define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ 172674e95caSDavid Howells #define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ 173674e95caSDavid Howells 174674e95caSDavid Howells /* event mode flag - NOTE: only 8 bits available! */ 175674e95caSDavid Howells #define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ 176674e95caSDavid Howells #define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ 177674e95caSDavid Howells #define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) 178674e95caSDavid Howells 179674e95caSDavid Howells #define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ 180674e95caSDavid Howells #define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ 181674e95caSDavid Howells #define SNDRV_SEQ_TIME_MODE_MASK (1<<1) 182674e95caSDavid Howells 183674e95caSDavid Howells #define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ 184674e95caSDavid Howells #define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ 185674e95caSDavid Howells #define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ 186674e95caSDavid Howells #define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) 187674e95caSDavid Howells 188674e95caSDavid Howells #define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ 189674e95caSDavid Howells #define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ 190674e95caSDavid Howells #define SNDRV_SEQ_PRIORITY_MASK (1<<4) 191674e95caSDavid Howells 192674e95caSDavid Howells 193674e95caSDavid Howells /* note event */ 194674e95caSDavid Howells struct snd_seq_ev_note { 195674e95caSDavid Howells unsigned char channel; 196674e95caSDavid Howells unsigned char note; 197674e95caSDavid Howells unsigned char velocity; 198674e95caSDavid Howells unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ 199674e95caSDavid Howells unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ 200674e95caSDavid Howells }; 201674e95caSDavid Howells 202674e95caSDavid Howells /* controller event */ 203674e95caSDavid Howells struct snd_seq_ev_ctrl { 204674e95caSDavid Howells unsigned char channel; 205674e95caSDavid Howells unsigned char unused1, unused2, unused3; /* pad */ 206674e95caSDavid Howells unsigned int param; 207674e95caSDavid Howells signed int value; 208674e95caSDavid Howells }; 209674e95caSDavid Howells 210674e95caSDavid Howells /* generic set of bytes (12x8 bit) */ 211674e95caSDavid Howells struct snd_seq_ev_raw8 { 212674e95caSDavid Howells unsigned char d[12]; /* 8 bit value */ 213674e95caSDavid Howells }; 214674e95caSDavid Howells 215674e95caSDavid Howells /* generic set of integers (3x32 bit) */ 216674e95caSDavid Howells struct snd_seq_ev_raw32 { 217674e95caSDavid Howells unsigned int d[3]; /* 32 bit value */ 218674e95caSDavid Howells }; 219674e95caSDavid Howells 220674e95caSDavid Howells /* external stored data */ 221674e95caSDavid Howells struct snd_seq_ev_ext { 222674e95caSDavid Howells unsigned int len; /* length of data */ 223674e95caSDavid Howells void *ptr; /* pointer to data (note: maybe 64-bit) */ 224674e95caSDavid Howells } __attribute__((packed)); 225674e95caSDavid Howells 226674e95caSDavid Howells struct snd_seq_result { 227674e95caSDavid Howells int event; /* processed event type */ 228674e95caSDavid Howells int result; 229674e95caSDavid Howells }; 230674e95caSDavid Howells 231674e95caSDavid Howells 232674e95caSDavid Howells struct snd_seq_real_time { 233674e95caSDavid Howells unsigned int tv_sec; /* seconds */ 234674e95caSDavid Howells unsigned int tv_nsec; /* nanoseconds */ 235674e95caSDavid Howells }; 236674e95caSDavid Howells 237674e95caSDavid Howells typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ 238674e95caSDavid Howells 239674e95caSDavid Howells union snd_seq_timestamp { 240674e95caSDavid Howells snd_seq_tick_time_t tick; 241674e95caSDavid Howells struct snd_seq_real_time time; 242674e95caSDavid Howells }; 243674e95caSDavid Howells 244674e95caSDavid Howells struct snd_seq_queue_skew { 245674e95caSDavid Howells unsigned int value; 246674e95caSDavid Howells unsigned int base; 247674e95caSDavid Howells }; 248674e95caSDavid Howells 249674e95caSDavid Howells /* queue timer control */ 250674e95caSDavid Howells struct snd_seq_ev_queue_control { 251674e95caSDavid Howells unsigned char queue; /* affected queue */ 252674e95caSDavid Howells unsigned char pad[3]; /* reserved */ 253674e95caSDavid Howells union { 254674e95caSDavid Howells signed int value; /* affected value (e.g. tempo) */ 255674e95caSDavid Howells union snd_seq_timestamp time; /* time */ 256674e95caSDavid Howells unsigned int position; /* sync position */ 257674e95caSDavid Howells struct snd_seq_queue_skew skew; 258674e95caSDavid Howells unsigned int d32[2]; 259674e95caSDavid Howells unsigned char d8[8]; 260674e95caSDavid Howells } param; 261674e95caSDavid Howells }; 262674e95caSDavid Howells 263674e95caSDavid Howells /* quoted event - inside the kernel only */ 264674e95caSDavid Howells struct snd_seq_ev_quote { 265674e95caSDavid Howells struct snd_seq_addr origin; /* original sender */ 266674e95caSDavid Howells unsigned short value; /* optional data */ 267674e95caSDavid Howells struct snd_seq_event *event; /* quoted event */ 268674e95caSDavid Howells } __attribute__((packed)); 269674e95caSDavid Howells 270674e95caSDavid Howells 271674e95caSDavid Howells /* sequencer event */ 272674e95caSDavid Howells struct snd_seq_event { 273674e95caSDavid Howells snd_seq_event_type_t type; /* event type */ 274674e95caSDavid Howells unsigned char flags; /* event flags */ 275674e95caSDavid Howells char tag; 276674e95caSDavid Howells 277674e95caSDavid Howells unsigned char queue; /* schedule queue */ 278674e95caSDavid Howells union snd_seq_timestamp time; /* schedule time */ 279674e95caSDavid Howells 280674e95caSDavid Howells 281674e95caSDavid Howells struct snd_seq_addr source; /* source address */ 282674e95caSDavid Howells struct snd_seq_addr dest; /* destination address */ 283674e95caSDavid Howells 284674e95caSDavid Howells union { /* event data... */ 285674e95caSDavid Howells struct snd_seq_ev_note note; 286674e95caSDavid Howells struct snd_seq_ev_ctrl control; 287674e95caSDavid Howells struct snd_seq_ev_raw8 raw8; 288674e95caSDavid Howells struct snd_seq_ev_raw32 raw32; 289674e95caSDavid Howells struct snd_seq_ev_ext ext; 290674e95caSDavid Howells struct snd_seq_ev_queue_control queue; 291674e95caSDavid Howells union snd_seq_timestamp time; 292674e95caSDavid Howells struct snd_seq_addr addr; 293674e95caSDavid Howells struct snd_seq_connect connect; 294674e95caSDavid Howells struct snd_seq_result result; 295674e95caSDavid Howells struct snd_seq_ev_quote quote; 296674e95caSDavid Howells } data; 297674e95caSDavid Howells }; 298674e95caSDavid Howells 299674e95caSDavid Howells 300674e95caSDavid Howells /* 301674e95caSDavid Howells * bounce event - stored as variable size data 302674e95caSDavid Howells */ 303674e95caSDavid Howells struct snd_seq_event_bounce { 304674e95caSDavid Howells int err; 305674e95caSDavid Howells struct snd_seq_event event; 306674e95caSDavid Howells /* external data follows here. */ 307674e95caSDavid Howells }; 308674e95caSDavid Howells 309674e95caSDavid Howells 310674e95caSDavid Howells /* system information */ 311674e95caSDavid Howells struct snd_seq_system_info { 312674e95caSDavid Howells int queues; /* maximum queues count */ 313674e95caSDavid Howells int clients; /* maximum clients count */ 314674e95caSDavid Howells int ports; /* maximum ports per client */ 315674e95caSDavid Howells int channels; /* maximum channels per port */ 316674e95caSDavid Howells int cur_clients; /* current clients */ 317674e95caSDavid Howells int cur_queues; /* current queues */ 318674e95caSDavid Howells char reserved[24]; 319674e95caSDavid Howells }; 320674e95caSDavid Howells 321674e95caSDavid Howells 322674e95caSDavid Howells /* system running information */ 323674e95caSDavid Howells struct snd_seq_running_info { 324674e95caSDavid Howells unsigned char client; /* client id */ 325674e95caSDavid Howells unsigned char big_endian; /* 1 = big-endian */ 326674e95caSDavid Howells unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ 327674e95caSDavid Howells unsigned char pad; /* reserved */ 328674e95caSDavid Howells unsigned char reserved[12]; 329674e95caSDavid Howells }; 330674e95caSDavid Howells 331674e95caSDavid Howells 332674e95caSDavid Howells /* known client numbers */ 333674e95caSDavid Howells #define SNDRV_SEQ_CLIENT_SYSTEM 0 334674e95caSDavid Howells /* internal client numbers */ 335674e95caSDavid Howells #define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ 336674e95caSDavid Howells #define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ 337674e95caSDavid Howells 338674e95caSDavid Howells 339674e95caSDavid Howells /* client types */ 340674e95caSDavid Howells typedef int __bitwise snd_seq_client_type_t; 341674e95caSDavid Howells #define NO_CLIENT ((__force snd_seq_client_type_t) 0) 342674e95caSDavid Howells #define USER_CLIENT ((__force snd_seq_client_type_t) 1) 343674e95caSDavid Howells #define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2) 344674e95caSDavid Howells 345674e95caSDavid Howells /* event filter flags */ 346674e95caSDavid Howells #define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ 347674e95caSDavid Howells #define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */ 348674e95caSDavid Howells #define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ 349674e95caSDavid Howells #define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ 350674e95caSDavid Howells 351674e95caSDavid Howells struct snd_seq_client_info { 352674e95caSDavid Howells int client; /* client number to inquire */ 353674e95caSDavid Howells snd_seq_client_type_t type; /* client type */ 354674e95caSDavid Howells char name[64]; /* client name */ 355674e95caSDavid Howells unsigned int filter; /* filter flags */ 356674e95caSDavid Howells unsigned char multicast_filter[8]; /* multicast filter bitmap */ 357674e95caSDavid Howells unsigned char event_filter[32]; /* event filter bitmap */ 358674e95caSDavid Howells int num_ports; /* RO: number of ports */ 359674e95caSDavid Howells int event_lost; /* number of lost events */ 360674e95caSDavid Howells char reserved[64]; /* for future use */ 361674e95caSDavid Howells }; 362674e95caSDavid Howells 363674e95caSDavid Howells 364674e95caSDavid Howells /* client pool size */ 365674e95caSDavid Howells struct snd_seq_client_pool { 366674e95caSDavid Howells int client; /* client number to inquire */ 367674e95caSDavid Howells int output_pool; /* outgoing (write) pool size */ 368674e95caSDavid Howells int input_pool; /* incoming (read) pool size */ 369674e95caSDavid Howells int output_room; /* minimum free pool size for select/blocking mode */ 370674e95caSDavid Howells int output_free; /* unused size */ 371674e95caSDavid Howells int input_free; /* unused size */ 372674e95caSDavid Howells char reserved[64]; 373674e95caSDavid Howells }; 374674e95caSDavid Howells 375674e95caSDavid Howells 376674e95caSDavid Howells /* Remove events by specified criteria */ 377674e95caSDavid Howells 378674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */ 379674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */ 380674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */ 381674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */ 382674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */ 383674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */ 384674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */ 385674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */ 386674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ 387674e95caSDavid Howells #define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ 388674e95caSDavid Howells 389674e95caSDavid Howells struct snd_seq_remove_events { 390674e95caSDavid Howells unsigned int remove_mode; /* Flags that determine what gets removed */ 391674e95caSDavid Howells 392674e95caSDavid Howells union snd_seq_timestamp time; 393674e95caSDavid Howells 394674e95caSDavid Howells unsigned char queue; /* Queue for REMOVE_DEST */ 395674e95caSDavid Howells struct snd_seq_addr dest; /* Address for REMOVE_DEST */ 396674e95caSDavid Howells unsigned char channel; /* Channel for REMOVE_DEST */ 397674e95caSDavid Howells 398674e95caSDavid Howells int type; /* For REMOVE_EVENT_TYPE */ 399674e95caSDavid Howells char tag; /* Tag for REMOVE_TAG */ 400674e95caSDavid Howells 401674e95caSDavid Howells int reserved[10]; /* To allow for future binary compatibility */ 402674e95caSDavid Howells 403674e95caSDavid Howells }; 404674e95caSDavid Howells 405674e95caSDavid Howells 406674e95caSDavid Howells /* known port numbers */ 407674e95caSDavid Howells #define SNDRV_SEQ_PORT_SYSTEM_TIMER 0 408674e95caSDavid Howells #define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1 409674e95caSDavid Howells 410674e95caSDavid Howells /* port capabilities (32 bits) */ 411674e95caSDavid Howells #define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */ 412674e95caSDavid Howells #define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */ 413674e95caSDavid Howells 414674e95caSDavid Howells #define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2) 415674e95caSDavid Howells #define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3) 416674e95caSDavid Howells 417674e95caSDavid Howells #define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4) 418674e95caSDavid Howells 419674e95caSDavid Howells #define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ 420674e95caSDavid Howells #define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ 421674e95caSDavid Howells #define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ 422674e95caSDavid Howells 423674e95caSDavid Howells /* port type */ 424674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */ 425674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */ 426674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */ 427674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */ 428674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */ 429674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */ 430674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */ 431674e95caSDavid Howells 432674e95caSDavid Howells /* other standards...*/ 433674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */ 434674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ 435674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ 436674e95caSDavid Howells /*...*/ 437674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */ 438674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */ 439674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */ 440674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */ 441674e95caSDavid Howells #define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ 442674e95caSDavid Howells 443674e95caSDavid Howells /* misc. conditioning flags */ 444674e95caSDavid Howells #define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0) 445674e95caSDavid Howells #define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) 446674e95caSDavid Howells #define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) 447674e95caSDavid Howells 448674e95caSDavid Howells struct snd_seq_port_info { 449674e95caSDavid Howells struct snd_seq_addr addr; /* client/port numbers */ 450674e95caSDavid Howells char name[64]; /* port name */ 451674e95caSDavid Howells 452674e95caSDavid Howells unsigned int capability; /* port capability bits */ 453674e95caSDavid Howells unsigned int type; /* port type bits */ 454674e95caSDavid Howells int midi_channels; /* channels per MIDI port */ 455674e95caSDavid Howells int midi_voices; /* voices per MIDI port */ 456674e95caSDavid Howells int synth_voices; /* voices per SYNTH port */ 457674e95caSDavid Howells 458674e95caSDavid Howells int read_use; /* R/O: subscribers for output (from this port) */ 459674e95caSDavid Howells int write_use; /* R/O: subscribers for input (to this port) */ 460674e95caSDavid Howells 461674e95caSDavid Howells void *kernel; /* reserved for kernel use (must be NULL) */ 462674e95caSDavid Howells unsigned int flags; /* misc. conditioning */ 463674e95caSDavid Howells unsigned char time_queue; /* queue # for timestamping */ 464674e95caSDavid Howells char reserved[59]; /* for future use */ 465674e95caSDavid Howells }; 466674e95caSDavid Howells 467674e95caSDavid Howells 468674e95caSDavid Howells /* queue flags */ 469674e95caSDavid Howells #define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ 470674e95caSDavid Howells 471674e95caSDavid Howells /* queue information */ 472674e95caSDavid Howells struct snd_seq_queue_info { 473674e95caSDavid Howells int queue; /* queue id */ 474674e95caSDavid Howells 475674e95caSDavid Howells /* 476674e95caSDavid Howells * security settings, only owner of this queue can start/stop timer 477674e95caSDavid Howells * etc. if the queue is locked for other clients 478674e95caSDavid Howells */ 479674e95caSDavid Howells int owner; /* client id for owner of the queue */ 480674e95caSDavid Howells unsigned locked:1; /* timing queue locked for other queues */ 481674e95caSDavid Howells char name[64]; /* name of this queue */ 482674e95caSDavid Howells unsigned int flags; /* flags */ 483674e95caSDavid Howells char reserved[60]; /* for future use */ 484674e95caSDavid Howells 485674e95caSDavid Howells }; 486674e95caSDavid Howells 487674e95caSDavid Howells /* queue info/status */ 488674e95caSDavid Howells struct snd_seq_queue_status { 489674e95caSDavid Howells int queue; /* queue id */ 490674e95caSDavid Howells int events; /* read-only - queue size */ 491674e95caSDavid Howells snd_seq_tick_time_t tick; /* current tick */ 492674e95caSDavid Howells struct snd_seq_real_time time; /* current time */ 493674e95caSDavid Howells int running; /* running state of queue */ 494674e95caSDavid Howells int flags; /* various flags */ 495674e95caSDavid Howells char reserved[64]; /* for the future */ 496674e95caSDavid Howells }; 497674e95caSDavid Howells 498674e95caSDavid Howells 499674e95caSDavid Howells /* queue tempo */ 500674e95caSDavid Howells struct snd_seq_queue_tempo { 501674e95caSDavid Howells int queue; /* sequencer queue */ 502674e95caSDavid Howells unsigned int tempo; /* current tempo, us/tick */ 503674e95caSDavid Howells int ppq; /* time resolution, ticks/quarter */ 504674e95caSDavid Howells unsigned int skew_value; /* queue skew */ 505674e95caSDavid Howells unsigned int skew_base; /* queue skew base */ 506674e95caSDavid Howells char reserved[24]; /* for the future */ 507674e95caSDavid Howells }; 508674e95caSDavid Howells 509674e95caSDavid Howells 510674e95caSDavid Howells /* sequencer timer sources */ 511674e95caSDavid Howells #define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */ 512674e95caSDavid Howells #define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */ 513674e95caSDavid Howells #define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ 514674e95caSDavid Howells 515674e95caSDavid Howells /* queue timer info */ 516674e95caSDavid Howells struct snd_seq_queue_timer { 517674e95caSDavid Howells int queue; /* sequencer queue */ 518674e95caSDavid Howells int type; /* source timer type */ 519674e95caSDavid Howells union { 520674e95caSDavid Howells struct { 521674e95caSDavid Howells struct snd_timer_id id; /* ALSA's timer ID */ 522674e95caSDavid Howells unsigned int resolution; /* resolution in Hz */ 523674e95caSDavid Howells } alsa; 524674e95caSDavid Howells } u; 525674e95caSDavid Howells char reserved[64]; /* for the future use */ 526674e95caSDavid Howells }; 527674e95caSDavid Howells 528674e95caSDavid Howells 529674e95caSDavid Howells struct snd_seq_queue_client { 530674e95caSDavid Howells int queue; /* sequencer queue */ 531674e95caSDavid Howells int client; /* sequencer client */ 532674e95caSDavid Howells int used; /* queue is used with this client 533674e95caSDavid Howells (must be set for accepting events) */ 534674e95caSDavid Howells /* per client watermarks */ 535674e95caSDavid Howells char reserved[64]; /* for future use */ 536674e95caSDavid Howells }; 537674e95caSDavid Howells 538674e95caSDavid Howells 539674e95caSDavid Howells #define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */ 540674e95caSDavid Howells #define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) 541674e95caSDavid Howells #define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) 542674e95caSDavid Howells 543674e95caSDavid Howells struct snd_seq_port_subscribe { 544674e95caSDavid Howells struct snd_seq_addr sender; /* sender address */ 545674e95caSDavid Howells struct snd_seq_addr dest; /* destination address */ 546674e95caSDavid Howells unsigned int voices; /* number of voices to be allocated (0 = don't care) */ 547674e95caSDavid Howells unsigned int flags; /* modes */ 548674e95caSDavid Howells unsigned char queue; /* input time-stamp queue (optional) */ 549674e95caSDavid Howells unsigned char pad[3]; /* reserved */ 550674e95caSDavid Howells char reserved[64]; 551674e95caSDavid Howells }; 552674e95caSDavid Howells 553674e95caSDavid Howells /* type of query subscription */ 554674e95caSDavid Howells #define SNDRV_SEQ_QUERY_SUBS_READ 0 555674e95caSDavid Howells #define SNDRV_SEQ_QUERY_SUBS_WRITE 1 556674e95caSDavid Howells 557674e95caSDavid Howells struct snd_seq_query_subs { 558674e95caSDavid Howells struct snd_seq_addr root; /* client/port id to be searched */ 559674e95caSDavid Howells int type; /* READ or WRITE */ 560674e95caSDavid Howells int index; /* 0..N-1 */ 561674e95caSDavid Howells int num_subs; /* R/O: number of subscriptions on this port */ 562674e95caSDavid Howells struct snd_seq_addr addr; /* R/O: result */ 563674e95caSDavid Howells unsigned char queue; /* R/O: result */ 564674e95caSDavid Howells unsigned int flags; /* R/O: result */ 565674e95caSDavid Howells char reserved[64]; /* for future use */ 566674e95caSDavid Howells }; 567674e95caSDavid Howells 568674e95caSDavid Howells 569674e95caSDavid Howells /* 570674e95caSDavid Howells * IOCTL commands 571674e95caSDavid Howells */ 572674e95caSDavid Howells 573674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) 574674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) 575674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) 576674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) 577674e95caSDavid Howells 578674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) 579674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) 580674e95caSDavid Howells 581674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) 582674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) 583674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) 584674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) 585674e95caSDavid Howells 586674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) 587674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) 588674e95caSDavid Howells 589674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) 590674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) 591674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) 592674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) 593674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) 594674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) 595674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) 596674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) 597674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner) 598674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner) 599674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) 600674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) 601674e95caSDavid Howells /* XXX 602674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync) 603674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync) 604674e95caSDavid Howells */ 605674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) 606674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) 607674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) 608674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) 609674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) 610674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) 611674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) 612674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) 613674e95caSDavid Howells #define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) 614674e95caSDavid Howells 615674e95caSDavid Howells #endif /* _UAPI__SOUND_ASEQUENCER_H */ 616