asequencer.h 23 KB

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