Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

273 lines
11KB

  1. /*
  2. * This library is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU Lesser General Public License as
  4. * published by the Free Software Foundation; either version 2.1 of
  5. * the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU Lesser General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU Lesser General Public
  13. * License along with this library; if not, write to the Free Software
  14. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. *
  16. */
  17. #ifndef __ALSA_SEQ_EVENT_COMPAT_H
  18. #define __ALSA_SEQ_EVENT_COMPAT_H
  19. /**
  20. * Sequencer event data type
  21. */
  22. typedef unsigned char snd_seq_event_type_t;
  23. /** Sequencer event type */
  24. enum snd_seq_event_type {
  25. /** system status; event data type = #snd_seq_result_t */
  26. SND_SEQ_EVENT_SYSTEM = 0,
  27. /** returned result status; event data type = #snd_seq_result_t */
  28. SND_SEQ_EVENT_RESULT,
  29. /** note on and off with duration; event data type = #snd_seq_ev_note_t */
  30. SND_SEQ_EVENT_NOTE = 5,
  31. /** note on; event data type = #snd_seq_ev_note_t */
  32. SND_SEQ_EVENT_NOTEON,
  33. /** note off; event data type = #snd_seq_ev_note_t */
  34. SND_SEQ_EVENT_NOTEOFF,
  35. /** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */
  36. SND_SEQ_EVENT_KEYPRESS,
  37. /** controller; event data type = #snd_seq_ev_ctrl_t */
  38. SND_SEQ_EVENT_CONTROLLER = 10,
  39. /** program change; event data type = #snd_seq_ev_ctrl_t */
  40. SND_SEQ_EVENT_PGMCHANGE,
  41. /** channel pressure; event data type = #snd_seq_ev_ctrl_t */
  42. SND_SEQ_EVENT_CHANPRESS,
  43. /** pitchwheel; event data type = #snd_seq_ev_ctrl_t; data is from -8192 to 8191) */
  44. SND_SEQ_EVENT_PITCHBEND,
  45. /** 14 bit controller value; event data type = #snd_seq_ev_ctrl_t */
  46. SND_SEQ_EVENT_CONTROL14,
  47. /** 14 bit NRPN; event data type = #snd_seq_ev_ctrl_t */
  48. SND_SEQ_EVENT_NONREGPARAM,
  49. /** 14 bit RPN; event data type = #snd_seq_ev_ctrl_t */
  50. SND_SEQ_EVENT_REGPARAM,
  51. /** SPP with LSB and MSB values; event data type = #snd_seq_ev_ctrl_t */
  52. SND_SEQ_EVENT_SONGPOS = 20,
  53. /** Song Select with song ID number; event data type = #snd_seq_ev_ctrl_t */
  54. SND_SEQ_EVENT_SONGSEL,
  55. /** midi time code quarter frame; event data type = #snd_seq_ev_ctrl_t */
  56. SND_SEQ_EVENT_QFRAME,
  57. /** SMF Time Signature event; event data type = #snd_seq_ev_ctrl_t */
  58. SND_SEQ_EVENT_TIMESIGN,
  59. /** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */
  60. SND_SEQ_EVENT_KEYSIGN,
  61. /** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */
  62. SND_SEQ_EVENT_START = 30,
  63. /** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */
  64. SND_SEQ_EVENT_CONTINUE,
  65. /** MIDI Real Time Stop message; event data type = #snd_seq_ev_queue_control_t */
  66. SND_SEQ_EVENT_STOP,
  67. /** Set tick queue position; event data type = #snd_seq_ev_queue_control_t */
  68. SND_SEQ_EVENT_SETPOS_TICK,
  69. /** Set real-time queue position; event data type = #snd_seq_ev_queue_control_t */
  70. SND_SEQ_EVENT_SETPOS_TIME,
  71. /** (SMF) Tempo event; event data type = #snd_seq_ev_queue_control_t */
  72. SND_SEQ_EVENT_TEMPO,
  73. /** MIDI Real Time Clock message; event data type = #snd_seq_ev_queue_control_t */
  74. SND_SEQ_EVENT_CLOCK,
  75. /** MIDI Real Time Tick message; event data type = #snd_seq_ev_queue_control_t */
  76. SND_SEQ_EVENT_TICK,
  77. /** Queue timer skew; event data type = #snd_seq_ev_queue_control_t */
  78. SND_SEQ_EVENT_QUEUE_SKEW,
  79. /** Sync position changed; event data type = #snd_seq_ev_queue_control_t */
  80. SND_SEQ_EVENT_SYNC_POS,
  81. /** Tune request; event data type = none */
  82. SND_SEQ_EVENT_TUNE_REQUEST = 40,
  83. /** Reset to power-on state; event data type = none */
  84. SND_SEQ_EVENT_RESET,
  85. /** Active sensing event; event data type = none */
  86. SND_SEQ_EVENT_SENSING,
  87. /** Echo-back event; event data type = any type */
  88. SND_SEQ_EVENT_ECHO = 50,
  89. /** OSS emulation raw event; event data type = any type */
  90. SND_SEQ_EVENT_OSS,
  91. /** New client has connected; event data type = #snd_seq_addr_t */
  92. SND_SEQ_EVENT_CLIENT_START = 60,
  93. /** Client has left the system; event data type = #snd_seq_addr_t */
  94. SND_SEQ_EVENT_CLIENT_EXIT,
  95. /** Client status/info has changed; event data type = #snd_seq_addr_t */
  96. SND_SEQ_EVENT_CLIENT_CHANGE,
  97. /** New port was created; event data type = #snd_seq_addr_t */
  98. SND_SEQ_EVENT_PORT_START,
  99. /** Port was deleted from system; event data type = #snd_seq_addr_t */
  100. SND_SEQ_EVENT_PORT_EXIT,
  101. /** Port status/info has changed; event data type = #snd_seq_addr_t */
  102. SND_SEQ_EVENT_PORT_CHANGE,
  103. /** Ports connected; event data type = #snd_seq_connect_t */
  104. SND_SEQ_EVENT_PORT_SUBSCRIBED,
  105. /** Ports disconnected; event data type = #snd_seq_connect_t */
  106. SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
  107. /** user-defined event; event data type = any (fixed size) */
  108. SND_SEQ_EVENT_USR0 = 90,
  109. /** user-defined event; event data type = any (fixed size) */
  110. SND_SEQ_EVENT_USR1,
  111. /** user-defined event; event data type = any (fixed size) */
  112. SND_SEQ_EVENT_USR2,
  113. /** user-defined event; event data type = any (fixed size) */
  114. SND_SEQ_EVENT_USR3,
  115. /** user-defined event; event data type = any (fixed size) */
  116. SND_SEQ_EVENT_USR4,
  117. /** user-defined event; event data type = any (fixed size) */
  118. SND_SEQ_EVENT_USR5,
  119. /** user-defined event; event data type = any (fixed size) */
  120. SND_SEQ_EVENT_USR6,
  121. /** user-defined event; event data type = any (fixed size) */
  122. SND_SEQ_EVENT_USR7,
  123. /** user-defined event; event data type = any (fixed size) */
  124. SND_SEQ_EVENT_USR8,
  125. /** user-defined event; event data type = any (fixed size) */
  126. SND_SEQ_EVENT_USR9,
  127. /** system exclusive data (variable length); event data type = #snd_seq_ev_ext_t */
  128. SND_SEQ_EVENT_SYSEX = 130,
  129. /** error event; event data type = #snd_seq_ev_ext_t */
  130. SND_SEQ_EVENT_BOUNCE,
  131. /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
  132. SND_SEQ_EVENT_USR_VAR0 = 135,
  133. /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
  134. SND_SEQ_EVENT_USR_VAR1,
  135. /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
  136. SND_SEQ_EVENT_USR_VAR2,
  137. /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
  138. SND_SEQ_EVENT_USR_VAR3,
  139. /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
  140. SND_SEQ_EVENT_USR_VAR4,
  141. /** NOP; ignored in any case */
  142. SND_SEQ_EVENT_NONE = 255
  143. };
  144. /** Sequencer event address */
  145. typedef struct snd_seq_addr {
  146. unsigned char client; /**< Client id */
  147. unsigned char port; /**< Port id */
  148. } snd_seq_addr_t;
  149. /** Connection (subscription) between ports */
  150. typedef struct snd_seq_connect {
  151. snd_seq_addr_t sender; /**< sender address */
  152. snd_seq_addr_t dest; /**< destination address */
  153. } snd_seq_connect_t;
  154. /** Real-time data record */
  155. typedef struct snd_seq_real_time {
  156. unsigned int tv_sec; /**< seconds */
  157. unsigned int tv_nsec; /**< nanoseconds */
  158. } snd_seq_real_time_t;
  159. /** (MIDI) Tick-time data record */
  160. typedef unsigned int snd_seq_tick_time_t;
  161. /** unioned time stamp */
  162. typedef union snd_seq_timestamp {
  163. snd_seq_tick_time_t tick; /**< tick-time */
  164. struct snd_seq_real_time time; /**< real-time */
  165. } snd_seq_timestamp_t;
  166. /** Note event */
  167. typedef struct snd_seq_ev_note {
  168. unsigned char channel; /**< channel number */
  169. unsigned char note; /**< note */
  170. unsigned char velocity; /**< velocity */
  171. unsigned char off_velocity; /**< note-off velocity; only for #SND_SEQ_EVENT_NOTE */
  172. unsigned int duration; /**< duration until note-off; only for #SND_SEQ_EVENT_NOTE */
  173. } snd_seq_ev_note_t;
  174. /** Controller event */
  175. typedef struct snd_seq_ev_ctrl {
  176. unsigned char channel; /**< channel number */
  177. unsigned char unused[3]; /**< reserved */
  178. unsigned int param; /**< control parameter */
  179. signed int value; /**< control value */
  180. } snd_seq_ev_ctrl_t;
  181. /** generic set of bytes (12x8 bit) */
  182. typedef struct snd_seq_ev_raw8 {
  183. unsigned char d[12]; /**< 8 bit value */
  184. } snd_seq_ev_raw8_t;
  185. /** generic set of integers (3x32 bit) */
  186. typedef struct snd_seq_ev_raw32 {
  187. unsigned int d[3]; /**< 32 bit value */
  188. } snd_seq_ev_raw32_t;
  189. /** external stored data */
  190. typedef struct snd_seq_ev_ext {
  191. unsigned int len; /**< length of data */
  192. void *ptr; /**< pointer to data (note: can be 64-bit) */
  193. } __attribute__((packed)) snd_seq_ev_ext_t;
  194. /** Result events */
  195. typedef struct snd_seq_result {
  196. int event; /**< processed event type */
  197. int result; /**< status */
  198. } snd_seq_result_t;
  199. /** Queue skew values */
  200. typedef struct snd_seq_queue_skew {
  201. unsigned int value; /**< skew value */
  202. unsigned int base; /**< skew base */
  203. } snd_seq_queue_skew_t;
  204. /** queue timer control */
  205. typedef struct snd_seq_ev_queue_control {
  206. unsigned char queue; /**< affected queue */
  207. unsigned char unused[3]; /**< reserved */
  208. union {
  209. signed int value; /**< affected value (e.g. tempo) */
  210. snd_seq_timestamp_t time; /**< time */
  211. unsigned int position; /**< sync position */
  212. snd_seq_queue_skew_t skew; /**< queue skew */
  213. unsigned int d32[2]; /**< any data */
  214. unsigned char d8[8]; /**< any data */
  215. } param; /**< data value union */
  216. } snd_seq_ev_queue_control_t;
  217. /** Sequencer event */
  218. typedef struct snd_seq_event {
  219. snd_seq_event_type_t type; /**< event type */
  220. unsigned char flags; /**< event flags */
  221. unsigned char tag; /**< tag */
  222. unsigned char queue; /**< schedule queue */
  223. snd_seq_timestamp_t time; /**< schedule time */
  224. snd_seq_addr_t source; /**< source address */
  225. snd_seq_addr_t dest; /**< destination address */
  226. union {
  227. snd_seq_ev_note_t note; /**< note information */
  228. snd_seq_ev_ctrl_t control; /**< MIDI control information */
  229. snd_seq_ev_raw8_t raw8; /**< raw8 data */
  230. snd_seq_ev_raw32_t raw32; /**< raw32 data */
  231. snd_seq_ev_ext_t ext; /**< external data */
  232. snd_seq_ev_queue_control_t queue; /**< queue control */
  233. snd_seq_timestamp_t time; /**< timestamp */
  234. snd_seq_addr_t addr; /**< address */
  235. snd_seq_connect_t connect; /**< connect information */
  236. snd_seq_result_t result; /**< operation result code */
  237. } data; /**< event data... */
  238. } snd_seq_event_t;
  239. #endif /* __ALSA_SEQ_EVENT_COMPAT_H */