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