asequencer.h 22 KB

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