1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Main header file for the ALSA sequencer 4*4882a593Smuzhiyun * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl> 5*4882a593Smuzhiyun * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz> 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or modify 9*4882a593Smuzhiyun * it under the terms of the GNU General Public License as published by 10*4882a593Smuzhiyun * the Free Software Foundation; either version 2 of the License, or 11*4882a593Smuzhiyun * (at your option) any later version. 12*4882a593Smuzhiyun * 13*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful, 14*4882a593Smuzhiyun * but WITHOUT ANY WARRANTY; without even the implied warranty of 15*4882a593Smuzhiyun * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*4882a593Smuzhiyun * GNU General Public License for more details. 17*4882a593Smuzhiyun * 18*4882a593Smuzhiyun * You should have received a copy of the GNU General Public License 19*4882a593Smuzhiyun * along with this program; if not, write to the Free Software 20*4882a593Smuzhiyun * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21*4882a593Smuzhiyun * 22*4882a593Smuzhiyun */ 23*4882a593Smuzhiyun #ifndef _UAPI__SOUND_ASEQUENCER_H 24*4882a593Smuzhiyun #define _UAPI__SOUND_ASEQUENCER_H 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun #include <sound/asound.h> 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun /** version of the sequencer */ 29*4882a593Smuzhiyun #define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2) 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun /** 32*4882a593Smuzhiyun * definition of sequencer event types 33*4882a593Smuzhiyun */ 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun /** system messages 36*4882a593Smuzhiyun * event data type = #snd_seq_result 37*4882a593Smuzhiyun */ 38*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_SYSTEM 0 39*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_RESULT 1 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun /** note messages (channel specific) 42*4882a593Smuzhiyun * event data type = #snd_seq_ev_note 43*4882a593Smuzhiyun */ 44*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_NOTE 5 45*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_NOTEON 6 46*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_NOTEOFF 7 47*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_KEYPRESS 8 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun /** control messages (channel specific) 50*4882a593Smuzhiyun * event data type = #snd_seq_ev_ctrl 51*4882a593Smuzhiyun */ 52*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_CONTROLLER 10 53*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_PGMCHANGE 11 54*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_CHANPRESS 12 55*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ 56*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ 57*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ 58*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun /** synchronisation messages 61*4882a593Smuzhiyun * event data type = #snd_seq_ev_ctrl 62*4882a593Smuzhiyun */ 63*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ 64*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ 65*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ 66*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ 67*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun /** timer messages 70*4882a593Smuzhiyun * event data type = snd_seq_ev_queue_control 71*4882a593Smuzhiyun */ 72*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ 73*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ 74*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ 75*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ 76*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ 77*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ 78*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ 79*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ 80*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun /** others 83*4882a593Smuzhiyun * event data type = none 84*4882a593Smuzhiyun */ 85*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ 86*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ 87*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun /** echo back, kernel private messages 90*4882a593Smuzhiyun * event data type = any type 91*4882a593Smuzhiyun */ 92*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ 93*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun /** system status messages (broadcast for subscribers) 96*4882a593Smuzhiyun * event data type = snd_seq_addr 97*4882a593Smuzhiyun */ 98*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ 99*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ 100*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ 101*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ 102*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ 103*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun /** port connection changes 106*4882a593Smuzhiyun * event data type = snd_seq_connect 107*4882a593Smuzhiyun */ 108*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ 109*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun /* 70-89: synthesizer events - obsoleted */ 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun /** user-defined events with fixed length 114*4882a593Smuzhiyun * event data type = any 115*4882a593Smuzhiyun */ 116*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR0 90 117*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR1 91 118*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR2 92 119*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR3 93 120*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR4 94 121*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR5 95 122*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR6 96 123*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR7 97 124*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR8 98 125*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR9 99 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun /* 100-118: instrument layer - obsoleted */ 128*4882a593Smuzhiyun /* 119-129: reserved */ 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun /* 130-139: variable length events 131*4882a593Smuzhiyun * event data type = snd_seq_ev_ext 132*4882a593Smuzhiyun * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) 133*4882a593Smuzhiyun */ 134*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ 135*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ 136*4882a593Smuzhiyun /* 132-134: reserved */ 137*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR_VAR0 135 138*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR_VAR1 136 139*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR_VAR2 137 140*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR_VAR3 138 141*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_USR_VAR4 139 142*4882a593Smuzhiyun 143*4882a593Smuzhiyun /* 150-151: kernel events with quote - DO NOT use in user clients */ 144*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 145*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun /* 152-191: reserved */ 148*4882a593Smuzhiyun 149*4882a593Smuzhiyun /* 192-254: hardware specific events */ 150*4882a593Smuzhiyun 151*4882a593Smuzhiyun /* 255: special event */ 152*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_NONE 255 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun 155*4882a593Smuzhiyun typedef unsigned char snd_seq_event_type_t; 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun /** event address */ 158*4882a593Smuzhiyun struct snd_seq_addr { 159*4882a593Smuzhiyun unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ 160*4882a593Smuzhiyun unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ 161*4882a593Smuzhiyun }; 162*4882a593Smuzhiyun 163*4882a593Smuzhiyun /** port connection */ 164*4882a593Smuzhiyun struct snd_seq_connect { 165*4882a593Smuzhiyun struct snd_seq_addr sender; 166*4882a593Smuzhiyun struct snd_seq_addr dest; 167*4882a593Smuzhiyun }; 168*4882a593Smuzhiyun 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun #define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ 171*4882a593Smuzhiyun #define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ 172*4882a593Smuzhiyun #define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ 173*4882a593Smuzhiyun #define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ 174*4882a593Smuzhiyun 175*4882a593Smuzhiyun /* event mode flag - NOTE: only 8 bits available! */ 176*4882a593Smuzhiyun #define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ 177*4882a593Smuzhiyun #define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ 178*4882a593Smuzhiyun #define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) 179*4882a593Smuzhiyun 180*4882a593Smuzhiyun #define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ 181*4882a593Smuzhiyun #define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ 182*4882a593Smuzhiyun #define SNDRV_SEQ_TIME_MODE_MASK (1<<1) 183*4882a593Smuzhiyun 184*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ 185*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ 186*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ 187*4882a593Smuzhiyun #define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) 188*4882a593Smuzhiyun 189*4882a593Smuzhiyun #define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ 190*4882a593Smuzhiyun #define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ 191*4882a593Smuzhiyun #define SNDRV_SEQ_PRIORITY_MASK (1<<4) 192*4882a593Smuzhiyun 193*4882a593Smuzhiyun 194*4882a593Smuzhiyun /* note event */ 195*4882a593Smuzhiyun struct snd_seq_ev_note { 196*4882a593Smuzhiyun unsigned char channel; 197*4882a593Smuzhiyun unsigned char note; 198*4882a593Smuzhiyun unsigned char velocity; 199*4882a593Smuzhiyun unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ 200*4882a593Smuzhiyun unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ 201*4882a593Smuzhiyun }; 202*4882a593Smuzhiyun 203*4882a593Smuzhiyun /* controller event */ 204*4882a593Smuzhiyun struct snd_seq_ev_ctrl { 205*4882a593Smuzhiyun unsigned char channel; 206*4882a593Smuzhiyun unsigned char unused1, unused2, unused3; /* pad */ 207*4882a593Smuzhiyun unsigned int param; 208*4882a593Smuzhiyun signed int value; 209*4882a593Smuzhiyun }; 210*4882a593Smuzhiyun 211*4882a593Smuzhiyun /* generic set of bytes (12x8 bit) */ 212*4882a593Smuzhiyun struct snd_seq_ev_raw8 { 213*4882a593Smuzhiyun unsigned char d[12]; /* 8 bit value */ 214*4882a593Smuzhiyun }; 215*4882a593Smuzhiyun 216*4882a593Smuzhiyun /* generic set of integers (3x32 bit) */ 217*4882a593Smuzhiyun struct snd_seq_ev_raw32 { 218*4882a593Smuzhiyun unsigned int d[3]; /* 32 bit value */ 219*4882a593Smuzhiyun }; 220*4882a593Smuzhiyun 221*4882a593Smuzhiyun /* external stored data */ 222*4882a593Smuzhiyun struct snd_seq_ev_ext { 223*4882a593Smuzhiyun unsigned int len; /* length of data */ 224*4882a593Smuzhiyun void *ptr; /* pointer to data (note: maybe 64-bit) */ 225*4882a593Smuzhiyun } __attribute__((packed)); 226*4882a593Smuzhiyun 227*4882a593Smuzhiyun struct snd_seq_result { 228*4882a593Smuzhiyun int event; /* processed event type */ 229*4882a593Smuzhiyun int result; 230*4882a593Smuzhiyun }; 231*4882a593Smuzhiyun 232*4882a593Smuzhiyun 233*4882a593Smuzhiyun struct snd_seq_real_time { 234*4882a593Smuzhiyun unsigned int tv_sec; /* seconds */ 235*4882a593Smuzhiyun unsigned int tv_nsec; /* nanoseconds */ 236*4882a593Smuzhiyun }; 237*4882a593Smuzhiyun 238*4882a593Smuzhiyun typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ 239*4882a593Smuzhiyun 240*4882a593Smuzhiyun union snd_seq_timestamp { 241*4882a593Smuzhiyun snd_seq_tick_time_t tick; 242*4882a593Smuzhiyun struct snd_seq_real_time time; 243*4882a593Smuzhiyun }; 244*4882a593Smuzhiyun 245*4882a593Smuzhiyun struct snd_seq_queue_skew { 246*4882a593Smuzhiyun unsigned int value; 247*4882a593Smuzhiyun unsigned int base; 248*4882a593Smuzhiyun }; 249*4882a593Smuzhiyun 250*4882a593Smuzhiyun /* queue timer control */ 251*4882a593Smuzhiyun struct snd_seq_ev_queue_control { 252*4882a593Smuzhiyun unsigned char queue; /* affected queue */ 253*4882a593Smuzhiyun unsigned char pad[3]; /* reserved */ 254*4882a593Smuzhiyun union { 255*4882a593Smuzhiyun signed int value; /* affected value (e.g. tempo) */ 256*4882a593Smuzhiyun union snd_seq_timestamp time; /* time */ 257*4882a593Smuzhiyun unsigned int position; /* sync position */ 258*4882a593Smuzhiyun struct snd_seq_queue_skew skew; 259*4882a593Smuzhiyun unsigned int d32[2]; 260*4882a593Smuzhiyun unsigned char d8[8]; 261*4882a593Smuzhiyun } param; 262*4882a593Smuzhiyun }; 263*4882a593Smuzhiyun 264*4882a593Smuzhiyun /* quoted event - inside the kernel only */ 265*4882a593Smuzhiyun struct snd_seq_ev_quote { 266*4882a593Smuzhiyun struct snd_seq_addr origin; /* original sender */ 267*4882a593Smuzhiyun unsigned short value; /* optional data */ 268*4882a593Smuzhiyun struct snd_seq_event *event; /* quoted event */ 269*4882a593Smuzhiyun } __attribute__((packed)); 270*4882a593Smuzhiyun 271*4882a593Smuzhiyun 272*4882a593Smuzhiyun /* sequencer event */ 273*4882a593Smuzhiyun struct snd_seq_event { 274*4882a593Smuzhiyun snd_seq_event_type_t type; /* event type */ 275*4882a593Smuzhiyun unsigned char flags; /* event flags */ 276*4882a593Smuzhiyun char tag; 277*4882a593Smuzhiyun 278*4882a593Smuzhiyun unsigned char queue; /* schedule queue */ 279*4882a593Smuzhiyun union snd_seq_timestamp time; /* schedule time */ 280*4882a593Smuzhiyun 281*4882a593Smuzhiyun 282*4882a593Smuzhiyun struct snd_seq_addr source; /* source address */ 283*4882a593Smuzhiyun struct snd_seq_addr dest; /* destination address */ 284*4882a593Smuzhiyun 285*4882a593Smuzhiyun union { /* event data... */ 286*4882a593Smuzhiyun struct snd_seq_ev_note note; 287*4882a593Smuzhiyun struct snd_seq_ev_ctrl control; 288*4882a593Smuzhiyun struct snd_seq_ev_raw8 raw8; 289*4882a593Smuzhiyun struct snd_seq_ev_raw32 raw32; 290*4882a593Smuzhiyun struct snd_seq_ev_ext ext; 291*4882a593Smuzhiyun struct snd_seq_ev_queue_control queue; 292*4882a593Smuzhiyun union snd_seq_timestamp time; 293*4882a593Smuzhiyun struct snd_seq_addr addr; 294*4882a593Smuzhiyun struct snd_seq_connect connect; 295*4882a593Smuzhiyun struct snd_seq_result result; 296*4882a593Smuzhiyun struct snd_seq_ev_quote quote; 297*4882a593Smuzhiyun } data; 298*4882a593Smuzhiyun }; 299*4882a593Smuzhiyun 300*4882a593Smuzhiyun 301*4882a593Smuzhiyun /* 302*4882a593Smuzhiyun * bounce event - stored as variable size data 303*4882a593Smuzhiyun */ 304*4882a593Smuzhiyun struct snd_seq_event_bounce { 305*4882a593Smuzhiyun int err; 306*4882a593Smuzhiyun struct snd_seq_event event; 307*4882a593Smuzhiyun /* external data follows here. */ 308*4882a593Smuzhiyun }; 309*4882a593Smuzhiyun 310*4882a593Smuzhiyun 311*4882a593Smuzhiyun /* system information */ 312*4882a593Smuzhiyun struct snd_seq_system_info { 313*4882a593Smuzhiyun int queues; /* maximum queues count */ 314*4882a593Smuzhiyun int clients; /* maximum clients count */ 315*4882a593Smuzhiyun int ports; /* maximum ports per client */ 316*4882a593Smuzhiyun int channels; /* maximum channels per port */ 317*4882a593Smuzhiyun int cur_clients; /* current clients */ 318*4882a593Smuzhiyun int cur_queues; /* current queues */ 319*4882a593Smuzhiyun char reserved[24]; 320*4882a593Smuzhiyun }; 321*4882a593Smuzhiyun 322*4882a593Smuzhiyun 323*4882a593Smuzhiyun /* system running information */ 324*4882a593Smuzhiyun struct snd_seq_running_info { 325*4882a593Smuzhiyun unsigned char client; /* client id */ 326*4882a593Smuzhiyun unsigned char big_endian; /* 1 = big-endian */ 327*4882a593Smuzhiyun unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ 328*4882a593Smuzhiyun unsigned char pad; /* reserved */ 329*4882a593Smuzhiyun unsigned char reserved[12]; 330*4882a593Smuzhiyun }; 331*4882a593Smuzhiyun 332*4882a593Smuzhiyun 333*4882a593Smuzhiyun /* known client numbers */ 334*4882a593Smuzhiyun #define SNDRV_SEQ_CLIENT_SYSTEM 0 335*4882a593Smuzhiyun /* internal client numbers */ 336*4882a593Smuzhiyun #define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ 337*4882a593Smuzhiyun #define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ 338*4882a593Smuzhiyun 339*4882a593Smuzhiyun 340*4882a593Smuzhiyun /* client types */ 341*4882a593Smuzhiyun typedef int __bitwise snd_seq_client_type_t; 342*4882a593Smuzhiyun #define NO_CLIENT ((__force snd_seq_client_type_t) 0) 343*4882a593Smuzhiyun #define USER_CLIENT ((__force snd_seq_client_type_t) 1) 344*4882a593Smuzhiyun #define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2) 345*4882a593Smuzhiyun 346*4882a593Smuzhiyun /* event filter flags */ 347*4882a593Smuzhiyun #define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ 348*4882a593Smuzhiyun #define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */ 349*4882a593Smuzhiyun #define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ 350*4882a593Smuzhiyun #define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ 351*4882a593Smuzhiyun 352*4882a593Smuzhiyun struct snd_seq_client_info { 353*4882a593Smuzhiyun int client; /* client number to inquire */ 354*4882a593Smuzhiyun snd_seq_client_type_t type; /* client type */ 355*4882a593Smuzhiyun char name[64]; /* client name */ 356*4882a593Smuzhiyun unsigned int filter; /* filter flags */ 357*4882a593Smuzhiyun unsigned char multicast_filter[8]; /* multicast filter bitmap */ 358*4882a593Smuzhiyun unsigned char event_filter[32]; /* event filter bitmap */ 359*4882a593Smuzhiyun int num_ports; /* RO: number of ports */ 360*4882a593Smuzhiyun int event_lost; /* number of lost events */ 361*4882a593Smuzhiyun int card; /* RO: card number[kernel] */ 362*4882a593Smuzhiyun int pid; /* RO: pid[user] */ 363*4882a593Smuzhiyun char reserved[56]; /* for future use */ 364*4882a593Smuzhiyun }; 365*4882a593Smuzhiyun 366*4882a593Smuzhiyun 367*4882a593Smuzhiyun /* client pool size */ 368*4882a593Smuzhiyun struct snd_seq_client_pool { 369*4882a593Smuzhiyun int client; /* client number to inquire */ 370*4882a593Smuzhiyun int output_pool; /* outgoing (write) pool size */ 371*4882a593Smuzhiyun int input_pool; /* incoming (read) pool size */ 372*4882a593Smuzhiyun int output_room; /* minimum free pool size for select/blocking mode */ 373*4882a593Smuzhiyun int output_free; /* unused size */ 374*4882a593Smuzhiyun int input_free; /* unused size */ 375*4882a593Smuzhiyun char reserved[64]; 376*4882a593Smuzhiyun }; 377*4882a593Smuzhiyun 378*4882a593Smuzhiyun 379*4882a593Smuzhiyun /* Remove events by specified criteria */ 380*4882a593Smuzhiyun 381*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */ 382*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */ 383*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */ 384*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */ 385*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */ 386*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */ 387*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */ 388*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */ 389*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ 390*4882a593Smuzhiyun #define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ 391*4882a593Smuzhiyun 392*4882a593Smuzhiyun struct snd_seq_remove_events { 393*4882a593Smuzhiyun unsigned int remove_mode; /* Flags that determine what gets removed */ 394*4882a593Smuzhiyun 395*4882a593Smuzhiyun union snd_seq_timestamp time; 396*4882a593Smuzhiyun 397*4882a593Smuzhiyun unsigned char queue; /* Queue for REMOVE_DEST */ 398*4882a593Smuzhiyun struct snd_seq_addr dest; /* Address for REMOVE_DEST */ 399*4882a593Smuzhiyun unsigned char channel; /* Channel for REMOVE_DEST */ 400*4882a593Smuzhiyun 401*4882a593Smuzhiyun int type; /* For REMOVE_EVENT_TYPE */ 402*4882a593Smuzhiyun char tag; /* Tag for REMOVE_TAG */ 403*4882a593Smuzhiyun 404*4882a593Smuzhiyun int reserved[10]; /* To allow for future binary compatibility */ 405*4882a593Smuzhiyun 406*4882a593Smuzhiyun }; 407*4882a593Smuzhiyun 408*4882a593Smuzhiyun 409*4882a593Smuzhiyun /* known port numbers */ 410*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_SYSTEM_TIMER 0 411*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1 412*4882a593Smuzhiyun 413*4882a593Smuzhiyun /* port capabilities (32 bits) */ 414*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */ 415*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */ 416*4882a593Smuzhiyun 417*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2) 418*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3) 419*4882a593Smuzhiyun 420*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4) 421*4882a593Smuzhiyun 422*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ 423*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ 424*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ 425*4882a593Smuzhiyun 426*4882a593Smuzhiyun /* port type */ 427*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */ 428*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */ 429*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */ 430*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */ 431*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */ 432*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */ 433*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */ 434*4882a593Smuzhiyun 435*4882a593Smuzhiyun /* other standards...*/ 436*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */ 437*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ 438*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ 439*4882a593Smuzhiyun /*...*/ 440*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */ 441*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */ 442*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */ 443*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */ 444*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ 445*4882a593Smuzhiyun 446*4882a593Smuzhiyun /* misc. conditioning flags */ 447*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0) 448*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) 449*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) 450*4882a593Smuzhiyun 451*4882a593Smuzhiyun struct snd_seq_port_info { 452*4882a593Smuzhiyun struct snd_seq_addr addr; /* client/port numbers */ 453*4882a593Smuzhiyun char name[64]; /* port name */ 454*4882a593Smuzhiyun 455*4882a593Smuzhiyun unsigned int capability; /* port capability bits */ 456*4882a593Smuzhiyun unsigned int type; /* port type bits */ 457*4882a593Smuzhiyun int midi_channels; /* channels per MIDI port */ 458*4882a593Smuzhiyun int midi_voices; /* voices per MIDI port */ 459*4882a593Smuzhiyun int synth_voices; /* voices per SYNTH port */ 460*4882a593Smuzhiyun 461*4882a593Smuzhiyun int read_use; /* R/O: subscribers for output (from this port) */ 462*4882a593Smuzhiyun int write_use; /* R/O: subscribers for input (to this port) */ 463*4882a593Smuzhiyun 464*4882a593Smuzhiyun void *kernel; /* reserved for kernel use (must be NULL) */ 465*4882a593Smuzhiyun unsigned int flags; /* misc. conditioning */ 466*4882a593Smuzhiyun unsigned char time_queue; /* queue # for timestamping */ 467*4882a593Smuzhiyun char reserved[59]; /* for future use */ 468*4882a593Smuzhiyun }; 469*4882a593Smuzhiyun 470*4882a593Smuzhiyun 471*4882a593Smuzhiyun /* queue flags */ 472*4882a593Smuzhiyun #define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ 473*4882a593Smuzhiyun 474*4882a593Smuzhiyun /* queue information */ 475*4882a593Smuzhiyun struct snd_seq_queue_info { 476*4882a593Smuzhiyun int queue; /* queue id */ 477*4882a593Smuzhiyun 478*4882a593Smuzhiyun /* 479*4882a593Smuzhiyun * security settings, only owner of this queue can start/stop timer 480*4882a593Smuzhiyun * etc. if the queue is locked for other clients 481*4882a593Smuzhiyun */ 482*4882a593Smuzhiyun int owner; /* client id for owner of the queue */ 483*4882a593Smuzhiyun unsigned locked:1; /* timing queue locked for other queues */ 484*4882a593Smuzhiyun char name[64]; /* name of this queue */ 485*4882a593Smuzhiyun unsigned int flags; /* flags */ 486*4882a593Smuzhiyun char reserved[60]; /* for future use */ 487*4882a593Smuzhiyun 488*4882a593Smuzhiyun }; 489*4882a593Smuzhiyun 490*4882a593Smuzhiyun /* queue info/status */ 491*4882a593Smuzhiyun struct snd_seq_queue_status { 492*4882a593Smuzhiyun int queue; /* queue id */ 493*4882a593Smuzhiyun int events; /* read-only - queue size */ 494*4882a593Smuzhiyun snd_seq_tick_time_t tick; /* current tick */ 495*4882a593Smuzhiyun struct snd_seq_real_time time; /* current time */ 496*4882a593Smuzhiyun int running; /* running state of queue */ 497*4882a593Smuzhiyun int flags; /* various flags */ 498*4882a593Smuzhiyun char reserved[64]; /* for the future */ 499*4882a593Smuzhiyun }; 500*4882a593Smuzhiyun 501*4882a593Smuzhiyun 502*4882a593Smuzhiyun /* queue tempo */ 503*4882a593Smuzhiyun struct snd_seq_queue_tempo { 504*4882a593Smuzhiyun int queue; /* sequencer queue */ 505*4882a593Smuzhiyun unsigned int tempo; /* current tempo, us/tick */ 506*4882a593Smuzhiyun int ppq; /* time resolution, ticks/quarter */ 507*4882a593Smuzhiyun unsigned int skew_value; /* queue skew */ 508*4882a593Smuzhiyun unsigned int skew_base; /* queue skew base */ 509*4882a593Smuzhiyun char reserved[24]; /* for the future */ 510*4882a593Smuzhiyun }; 511*4882a593Smuzhiyun 512*4882a593Smuzhiyun 513*4882a593Smuzhiyun /* sequencer timer sources */ 514*4882a593Smuzhiyun #define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */ 515*4882a593Smuzhiyun #define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */ 516*4882a593Smuzhiyun #define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ 517*4882a593Smuzhiyun 518*4882a593Smuzhiyun /* queue timer info */ 519*4882a593Smuzhiyun struct snd_seq_queue_timer { 520*4882a593Smuzhiyun int queue; /* sequencer queue */ 521*4882a593Smuzhiyun int type; /* source timer type */ 522*4882a593Smuzhiyun union { 523*4882a593Smuzhiyun struct { 524*4882a593Smuzhiyun struct snd_timer_id id; /* ALSA's timer ID */ 525*4882a593Smuzhiyun unsigned int resolution; /* resolution in Hz */ 526*4882a593Smuzhiyun } alsa; 527*4882a593Smuzhiyun } u; 528*4882a593Smuzhiyun char reserved[64]; /* for the future use */ 529*4882a593Smuzhiyun }; 530*4882a593Smuzhiyun 531*4882a593Smuzhiyun 532*4882a593Smuzhiyun struct snd_seq_queue_client { 533*4882a593Smuzhiyun int queue; /* sequencer queue */ 534*4882a593Smuzhiyun int client; /* sequencer client */ 535*4882a593Smuzhiyun int used; /* queue is used with this client 536*4882a593Smuzhiyun (must be set for accepting events) */ 537*4882a593Smuzhiyun /* per client watermarks */ 538*4882a593Smuzhiyun char reserved[64]; /* for future use */ 539*4882a593Smuzhiyun }; 540*4882a593Smuzhiyun 541*4882a593Smuzhiyun 542*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */ 543*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) 544*4882a593Smuzhiyun #define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) 545*4882a593Smuzhiyun 546*4882a593Smuzhiyun struct snd_seq_port_subscribe { 547*4882a593Smuzhiyun struct snd_seq_addr sender; /* sender address */ 548*4882a593Smuzhiyun struct snd_seq_addr dest; /* destination address */ 549*4882a593Smuzhiyun unsigned int voices; /* number of voices to be allocated (0 = don't care) */ 550*4882a593Smuzhiyun unsigned int flags; /* modes */ 551*4882a593Smuzhiyun unsigned char queue; /* input time-stamp queue (optional) */ 552*4882a593Smuzhiyun unsigned char pad[3]; /* reserved */ 553*4882a593Smuzhiyun char reserved[64]; 554*4882a593Smuzhiyun }; 555*4882a593Smuzhiyun 556*4882a593Smuzhiyun /* type of query subscription */ 557*4882a593Smuzhiyun #define SNDRV_SEQ_QUERY_SUBS_READ 0 558*4882a593Smuzhiyun #define SNDRV_SEQ_QUERY_SUBS_WRITE 1 559*4882a593Smuzhiyun 560*4882a593Smuzhiyun struct snd_seq_query_subs { 561*4882a593Smuzhiyun struct snd_seq_addr root; /* client/port id to be searched */ 562*4882a593Smuzhiyun int type; /* READ or WRITE */ 563*4882a593Smuzhiyun int index; /* 0..N-1 */ 564*4882a593Smuzhiyun int num_subs; /* R/O: number of subscriptions on this port */ 565*4882a593Smuzhiyun struct snd_seq_addr addr; /* R/O: result */ 566*4882a593Smuzhiyun unsigned char queue; /* R/O: result */ 567*4882a593Smuzhiyun unsigned int flags; /* R/O: result */ 568*4882a593Smuzhiyun char reserved[64]; /* for future use */ 569*4882a593Smuzhiyun }; 570*4882a593Smuzhiyun 571*4882a593Smuzhiyun 572*4882a593Smuzhiyun /* 573*4882a593Smuzhiyun * IOCTL commands 574*4882a593Smuzhiyun */ 575*4882a593Smuzhiyun 576*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) 577*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) 578*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) 579*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) 580*4882a593Smuzhiyun 581*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) 582*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) 583*4882a593Smuzhiyun 584*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) 585*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) 586*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) 587*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) 588*4882a593Smuzhiyun 589*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) 590*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) 591*4882a593Smuzhiyun 592*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) 593*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) 594*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) 595*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) 596*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) 597*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) 598*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) 599*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) 600*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) 601*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) 602*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) 603*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) 604*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) 605*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) 606*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) 607*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) 608*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) 609*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) 610*4882a593Smuzhiyun #define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) 611*4882a593Smuzhiyun 612*4882a593Smuzhiyun #endif /* _UAPI__SOUND_ASEQUENCER_H */ 613