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.

seq_event-compat.h 10KB

12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. /** NOP; ignored in any case */
  128. SND_SEQ_EVENT_NONE = 255
  129. };
  130. /** Sequencer event address */
  131. typedef struct snd_seq_addr {
  132. unsigned char client; /**< Client id */
  133. unsigned char port; /**< Port id */
  134. } snd_seq_addr_t;
  135. /** Connection (subscription) between ports */
  136. typedef struct snd_seq_connect {
  137. snd_seq_addr_t sender; /**< sender address */
  138. snd_seq_addr_t dest; /**< destination address */
  139. } snd_seq_connect_t;
  140. /** Real-time data record */
  141. typedef struct snd_seq_real_time {
  142. unsigned int tv_sec; /**< seconds */
  143. unsigned int tv_nsec; /**< nanoseconds */
  144. } snd_seq_real_time_t;
  145. /** (MIDI) Tick-time data record */
  146. typedef unsigned int snd_seq_tick_time_t;
  147. /** unioned time stamp */
  148. typedef union snd_seq_timestamp {
  149. snd_seq_tick_time_t tick; /**< tick-time */
  150. struct snd_seq_real_time time; /**< real-time */
  151. } snd_seq_timestamp_t;
  152. /** Note event */
  153. typedef struct snd_seq_ev_note {
  154. unsigned char channel; /**< channel number */
  155. unsigned char note; /**< note */
  156. unsigned char velocity; /**< velocity */
  157. unsigned char off_velocity; /**< note-off velocity; only for #SND_SEQ_EVENT_NOTE */
  158. unsigned int duration; /**< duration until note-off; only for #SND_SEQ_EVENT_NOTE */
  159. } snd_seq_ev_note_t;
  160. /** Controller event */
  161. typedef struct snd_seq_ev_ctrl {
  162. unsigned char channel; /**< channel number */
  163. unsigned char unused[3]; /**< reserved */
  164. unsigned int param; /**< control parameter */
  165. signed int value; /**< control value */
  166. } snd_seq_ev_ctrl_t;
  167. /** generic set of bytes (12x8 bit) */
  168. typedef struct snd_seq_ev_raw8 {
  169. unsigned char d[12]; /**< 8 bit value */
  170. } snd_seq_ev_raw8_t;
  171. /** generic set of integers (3x32 bit) */
  172. typedef struct snd_seq_ev_raw32 {
  173. unsigned int d[3]; /**< 32 bit value */
  174. } snd_seq_ev_raw32_t;
  175. /** Result events */
  176. typedef struct snd_seq_result {
  177. int event; /**< processed event type */
  178. int result; /**< status */
  179. } snd_seq_result_t;
  180. /** Queue skew values */
  181. typedef struct snd_seq_queue_skew {
  182. unsigned int value; /**< skew value */
  183. unsigned int base; /**< skew base */
  184. } snd_seq_queue_skew_t;
  185. /** queue timer control */
  186. typedef struct snd_seq_ev_queue_control {
  187. unsigned char queue; /**< affected queue */
  188. unsigned char unused[3]; /**< reserved */
  189. union {
  190. signed int value; /**< affected value (e.g. tempo) */
  191. snd_seq_timestamp_t time; /**< time */
  192. unsigned int position; /**< sync position */
  193. snd_seq_queue_skew_t skew; /**< queue skew */
  194. unsigned int d32[2]; /**< any data */
  195. unsigned char d8[8]; /**< any data */
  196. } param; /**< data value union */
  197. } snd_seq_ev_queue_control_t;
  198. /** Sequencer event */
  199. typedef struct snd_seq_event {
  200. snd_seq_event_type_t type; /**< event type */
  201. unsigned char flags; /**< event flags */
  202. unsigned char tag; /**< tag */
  203. unsigned char queue; /**< schedule queue */
  204. snd_seq_timestamp_t time; /**< schedule time */
  205. snd_seq_addr_t source; /**< source address */
  206. snd_seq_addr_t dest; /**< destination address */
  207. union {
  208. snd_seq_ev_note_t note; /**< note information */
  209. snd_seq_ev_ctrl_t control; /**< MIDI control information */
  210. snd_seq_ev_raw8_t raw8; /**< raw8 data */
  211. snd_seq_ev_raw32_t raw32; /**< raw32 data */
  212. snd_seq_ev_queue_control_t queue; /**< queue control */
  213. snd_seq_timestamp_t time; /**< timestamp */
  214. snd_seq_addr_t addr; /**< address */
  215. snd_seq_connect_t connect; /**< connect information */
  216. snd_seq_result_t result; /**< operation result code */
  217. } data; /**< event data... */
  218. } snd_seq_event_t;
  219. #endif /* __ALSA_SEQ_EVENT_COMPAT_H */