jpayne@69
|
1 /**
|
jpayne@69
|
2 * \file include/seq_event.h
|
jpayne@69
|
3 * \brief Application interface library for the ALSA driver
|
jpayne@69
|
4 * \author Jaroslav Kysela <perex@perex.cz>
|
jpayne@69
|
5 * \author Abramo Bagnara <abramo@alsa-project.org>
|
jpayne@69
|
6 * \author Takashi Iwai <tiwai@suse.de>
|
jpayne@69
|
7 * \date 1998-2001
|
jpayne@69
|
8 *
|
jpayne@69
|
9 * Application interface library for the ALSA driver
|
jpayne@69
|
10 */
|
jpayne@69
|
11 /*
|
jpayne@69
|
12 * This library is free software; you can redistribute it and/or modify
|
jpayne@69
|
13 * it under the terms of the GNU Lesser General Public License as
|
jpayne@69
|
14 * published by the Free Software Foundation; either version 2.1 of
|
jpayne@69
|
15 * the License, or (at your option) any later version.
|
jpayne@69
|
16 *
|
jpayne@69
|
17 * This program is distributed in the hope that it will be useful,
|
jpayne@69
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
jpayne@69
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
jpayne@69
|
20 * GNU Lesser General Public License for more details.
|
jpayne@69
|
21 *
|
jpayne@69
|
22 * You should have received a copy of the GNU Lesser General Public
|
jpayne@69
|
23 * License along with this library; if not, write to the Free Software
|
jpayne@69
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
jpayne@69
|
25 *
|
jpayne@69
|
26 */
|
jpayne@69
|
27
|
jpayne@69
|
28 #ifndef __ALSA_SEQ_EVENT_H
|
jpayne@69
|
29 #define __ALSA_SEQ_EVENT_H
|
jpayne@69
|
30
|
jpayne@69
|
31 /**
|
jpayne@69
|
32 * \defgroup SeqEvents Sequencer Event Definitions
|
jpayne@69
|
33 * Sequencer Event Definitions
|
jpayne@69
|
34 * \ingroup Sequencer
|
jpayne@69
|
35 * \{
|
jpayne@69
|
36 */
|
jpayne@69
|
37
|
jpayne@69
|
38 /**
|
jpayne@69
|
39 * Sequencer event data type
|
jpayne@69
|
40 */
|
jpayne@69
|
41 typedef unsigned char snd_seq_event_type_t;
|
jpayne@69
|
42
|
jpayne@69
|
43 /** Sequencer event type */
|
jpayne@69
|
44 enum snd_seq_event_type {
|
jpayne@69
|
45 /** system status; event data type = #snd_seq_result_t */
|
jpayne@69
|
46 SND_SEQ_EVENT_SYSTEM = 0,
|
jpayne@69
|
47 /** returned result status; event data type = #snd_seq_result_t */
|
jpayne@69
|
48 SND_SEQ_EVENT_RESULT,
|
jpayne@69
|
49
|
jpayne@69
|
50 /** note on and off with duration; event data type = #snd_seq_ev_note_t */
|
jpayne@69
|
51 SND_SEQ_EVENT_NOTE = 5,
|
jpayne@69
|
52 /** note on; event data type = #snd_seq_ev_note_t */
|
jpayne@69
|
53 SND_SEQ_EVENT_NOTEON,
|
jpayne@69
|
54 /** note off; event data type = #snd_seq_ev_note_t */
|
jpayne@69
|
55 SND_SEQ_EVENT_NOTEOFF,
|
jpayne@69
|
56 /** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */
|
jpayne@69
|
57 SND_SEQ_EVENT_KEYPRESS,
|
jpayne@69
|
58
|
jpayne@69
|
59 /** controller; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
60 SND_SEQ_EVENT_CONTROLLER = 10,
|
jpayne@69
|
61 /** program change; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
62 SND_SEQ_EVENT_PGMCHANGE,
|
jpayne@69
|
63 /** channel pressure; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
64 SND_SEQ_EVENT_CHANPRESS,
|
jpayne@69
|
65 /** pitchwheel; event data type = #snd_seq_ev_ctrl_t; data is from -8192 to 8191) */
|
jpayne@69
|
66 SND_SEQ_EVENT_PITCHBEND,
|
jpayne@69
|
67 /** 14 bit controller value; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
68 SND_SEQ_EVENT_CONTROL14,
|
jpayne@69
|
69 /** 14 bit NRPN; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
70 SND_SEQ_EVENT_NONREGPARAM,
|
jpayne@69
|
71 /** 14 bit RPN; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
72 SND_SEQ_EVENT_REGPARAM,
|
jpayne@69
|
73
|
jpayne@69
|
74 /** SPP with LSB and MSB values; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
75 SND_SEQ_EVENT_SONGPOS = 20,
|
jpayne@69
|
76 /** Song Select with song ID number; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
77 SND_SEQ_EVENT_SONGSEL,
|
jpayne@69
|
78 /** midi time code quarter frame; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
79 SND_SEQ_EVENT_QFRAME,
|
jpayne@69
|
80 /** SMF Time Signature event; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
81 SND_SEQ_EVENT_TIMESIGN,
|
jpayne@69
|
82 /** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */
|
jpayne@69
|
83 SND_SEQ_EVENT_KEYSIGN,
|
jpayne@69
|
84
|
jpayne@69
|
85 /** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
86 SND_SEQ_EVENT_START = 30,
|
jpayne@69
|
87 /** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
88 SND_SEQ_EVENT_CONTINUE,
|
jpayne@69
|
89 /** MIDI Real Time Stop message; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
90 SND_SEQ_EVENT_STOP,
|
jpayne@69
|
91 /** Set tick queue position; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
92 SND_SEQ_EVENT_SETPOS_TICK,
|
jpayne@69
|
93 /** Set real-time queue position; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
94 SND_SEQ_EVENT_SETPOS_TIME,
|
jpayne@69
|
95 /** (SMF) Tempo event; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
96 SND_SEQ_EVENT_TEMPO,
|
jpayne@69
|
97 /** MIDI Real Time Clock message; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
98 SND_SEQ_EVENT_CLOCK,
|
jpayne@69
|
99 /** MIDI Real Time Tick message; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
100 SND_SEQ_EVENT_TICK,
|
jpayne@69
|
101 /** Queue timer skew; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
102 SND_SEQ_EVENT_QUEUE_SKEW,
|
jpayne@69
|
103 /** Sync position changed; event data type = #snd_seq_ev_queue_control_t */
|
jpayne@69
|
104 SND_SEQ_EVENT_SYNC_POS,
|
jpayne@69
|
105
|
jpayne@69
|
106 /** Tune request; event data type = none */
|
jpayne@69
|
107 SND_SEQ_EVENT_TUNE_REQUEST = 40,
|
jpayne@69
|
108 /** Reset to power-on state; event data type = none */
|
jpayne@69
|
109 SND_SEQ_EVENT_RESET,
|
jpayne@69
|
110 /** Active sensing event; event data type = none */
|
jpayne@69
|
111 SND_SEQ_EVENT_SENSING,
|
jpayne@69
|
112
|
jpayne@69
|
113 /** Echo-back event; event data type = any type */
|
jpayne@69
|
114 SND_SEQ_EVENT_ECHO = 50,
|
jpayne@69
|
115 /** OSS emulation raw event; event data type = any type */
|
jpayne@69
|
116 SND_SEQ_EVENT_OSS,
|
jpayne@69
|
117
|
jpayne@69
|
118 /** New client has connected; event data type = #snd_seq_addr_t */
|
jpayne@69
|
119 SND_SEQ_EVENT_CLIENT_START = 60,
|
jpayne@69
|
120 /** Client has left the system; event data type = #snd_seq_addr_t */
|
jpayne@69
|
121 SND_SEQ_EVENT_CLIENT_EXIT,
|
jpayne@69
|
122 /** Client status/info has changed; event data type = #snd_seq_addr_t */
|
jpayne@69
|
123 SND_SEQ_EVENT_CLIENT_CHANGE,
|
jpayne@69
|
124 /** New port was created; event data type = #snd_seq_addr_t */
|
jpayne@69
|
125 SND_SEQ_EVENT_PORT_START,
|
jpayne@69
|
126 /** Port was deleted from system; event data type = #snd_seq_addr_t */
|
jpayne@69
|
127 SND_SEQ_EVENT_PORT_EXIT,
|
jpayne@69
|
128 /** Port status/info has changed; event data type = #snd_seq_addr_t */
|
jpayne@69
|
129 SND_SEQ_EVENT_PORT_CHANGE,
|
jpayne@69
|
130
|
jpayne@69
|
131 /** Ports connected; event data type = #snd_seq_connect_t */
|
jpayne@69
|
132 SND_SEQ_EVENT_PORT_SUBSCRIBED,
|
jpayne@69
|
133 /** Ports disconnected; event data type = #snd_seq_connect_t */
|
jpayne@69
|
134 SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
|
jpayne@69
|
135
|
jpayne@69
|
136 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
137 SND_SEQ_EVENT_USR0 = 90,
|
jpayne@69
|
138 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
139 SND_SEQ_EVENT_USR1,
|
jpayne@69
|
140 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
141 SND_SEQ_EVENT_USR2,
|
jpayne@69
|
142 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
143 SND_SEQ_EVENT_USR3,
|
jpayne@69
|
144 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
145 SND_SEQ_EVENT_USR4,
|
jpayne@69
|
146 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
147 SND_SEQ_EVENT_USR5,
|
jpayne@69
|
148 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
149 SND_SEQ_EVENT_USR6,
|
jpayne@69
|
150 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
151 SND_SEQ_EVENT_USR7,
|
jpayne@69
|
152 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
153 SND_SEQ_EVENT_USR8,
|
jpayne@69
|
154 /** user-defined event; event data type = any (fixed size) */
|
jpayne@69
|
155 SND_SEQ_EVENT_USR9,
|
jpayne@69
|
156
|
jpayne@69
|
157 /** system exclusive data (variable length); event data type = #snd_seq_ev_ext_t */
|
jpayne@69
|
158 SND_SEQ_EVENT_SYSEX = 130,
|
jpayne@69
|
159 /** error event; event data type = #snd_seq_ev_ext_t */
|
jpayne@69
|
160 SND_SEQ_EVENT_BOUNCE,
|
jpayne@69
|
161 /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
jpayne@69
|
162 SND_SEQ_EVENT_USR_VAR0 = 135,
|
jpayne@69
|
163 /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
jpayne@69
|
164 SND_SEQ_EVENT_USR_VAR1,
|
jpayne@69
|
165 /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
jpayne@69
|
166 SND_SEQ_EVENT_USR_VAR2,
|
jpayne@69
|
167 /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
jpayne@69
|
168 SND_SEQ_EVENT_USR_VAR3,
|
jpayne@69
|
169 /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
jpayne@69
|
170 SND_SEQ_EVENT_USR_VAR4,
|
jpayne@69
|
171
|
jpayne@69
|
172 /** NOP; ignored in any case */
|
jpayne@69
|
173 SND_SEQ_EVENT_NONE = 255
|
jpayne@69
|
174 };
|
jpayne@69
|
175
|
jpayne@69
|
176
|
jpayne@69
|
177 /** Sequencer event address */
|
jpayne@69
|
178 typedef struct snd_seq_addr {
|
jpayne@69
|
179 unsigned char client; /**< Client id */
|
jpayne@69
|
180 unsigned char port; /**< Port id */
|
jpayne@69
|
181 } snd_seq_addr_t;
|
jpayne@69
|
182
|
jpayne@69
|
183 /** Connection (subscription) between ports */
|
jpayne@69
|
184 typedef struct snd_seq_connect {
|
jpayne@69
|
185 snd_seq_addr_t sender; /**< sender address */
|
jpayne@69
|
186 snd_seq_addr_t dest; /**< destination address */
|
jpayne@69
|
187 } snd_seq_connect_t;
|
jpayne@69
|
188
|
jpayne@69
|
189
|
jpayne@69
|
190 /** Real-time data record */
|
jpayne@69
|
191 typedef struct snd_seq_real_time {
|
jpayne@69
|
192 unsigned int tv_sec; /**< seconds */
|
jpayne@69
|
193 unsigned int tv_nsec; /**< nanoseconds */
|
jpayne@69
|
194 } snd_seq_real_time_t;
|
jpayne@69
|
195
|
jpayne@69
|
196 /** (MIDI) Tick-time data record */
|
jpayne@69
|
197 typedef unsigned int snd_seq_tick_time_t;
|
jpayne@69
|
198
|
jpayne@69
|
199 /** unioned time stamp */
|
jpayne@69
|
200 typedef union snd_seq_timestamp {
|
jpayne@69
|
201 snd_seq_tick_time_t tick; /**< tick-time */
|
jpayne@69
|
202 struct snd_seq_real_time time; /**< real-time */
|
jpayne@69
|
203 } snd_seq_timestamp_t;
|
jpayne@69
|
204
|
jpayne@69
|
205
|
jpayne@69
|
206 /**
|
jpayne@69
|
207 * Event mode flags
|
jpayne@69
|
208 *
|
jpayne@69
|
209 * NOTE: only 8 bits available!
|
jpayne@69
|
210 */
|
jpayne@69
|
211 #define SND_SEQ_TIME_STAMP_TICK (0<<0) /**< timestamp in clock ticks */
|
jpayne@69
|
212 #define SND_SEQ_TIME_STAMP_REAL (1<<0) /**< timestamp in real time */
|
jpayne@69
|
213 #define SND_SEQ_TIME_STAMP_MASK (1<<0) /**< mask for timestamp bits */
|
jpayne@69
|
214
|
jpayne@69
|
215 #define SND_SEQ_TIME_MODE_ABS (0<<1) /**< absolute timestamp */
|
jpayne@69
|
216 #define SND_SEQ_TIME_MODE_REL (1<<1) /**< relative to current time */
|
jpayne@69
|
217 #define SND_SEQ_TIME_MODE_MASK (1<<1) /**< mask for time mode bits */
|
jpayne@69
|
218
|
jpayne@69
|
219 #define SND_SEQ_EVENT_LENGTH_FIXED (0<<2) /**< fixed event size */
|
jpayne@69
|
220 #define SND_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /**< variable event size */
|
jpayne@69
|
221 #define SND_SEQ_EVENT_LENGTH_VARUSR (2<<2) /**< variable event size - user memory space */
|
jpayne@69
|
222 #define SND_SEQ_EVENT_LENGTH_MASK (3<<2) /**< mask for event length bits */
|
jpayne@69
|
223
|
jpayne@69
|
224 #define SND_SEQ_PRIORITY_NORMAL (0<<4) /**< normal priority */
|
jpayne@69
|
225 #define SND_SEQ_PRIORITY_HIGH (1<<4) /**< event should be processed before others */
|
jpayne@69
|
226 #define SND_SEQ_PRIORITY_MASK (1<<4) /**< mask for priority bits */
|
jpayne@69
|
227
|
jpayne@69
|
228
|
jpayne@69
|
229 /** Note event */
|
jpayne@69
|
230 typedef struct snd_seq_ev_note {
|
jpayne@69
|
231 unsigned char channel; /**< channel number */
|
jpayne@69
|
232 unsigned char note; /**< note */
|
jpayne@69
|
233 unsigned char velocity; /**< velocity */
|
jpayne@69
|
234 unsigned char off_velocity; /**< note-off velocity; only for #SND_SEQ_EVENT_NOTE */
|
jpayne@69
|
235 unsigned int duration; /**< duration until note-off; only for #SND_SEQ_EVENT_NOTE */
|
jpayne@69
|
236 } snd_seq_ev_note_t;
|
jpayne@69
|
237
|
jpayne@69
|
238 /** Controller event */
|
jpayne@69
|
239 typedef struct snd_seq_ev_ctrl {
|
jpayne@69
|
240 unsigned char channel; /**< channel number */
|
jpayne@69
|
241 unsigned char unused[3]; /**< reserved */
|
jpayne@69
|
242 unsigned int param; /**< control parameter */
|
jpayne@69
|
243 signed int value; /**< control value */
|
jpayne@69
|
244 } snd_seq_ev_ctrl_t;
|
jpayne@69
|
245
|
jpayne@69
|
246 /** generic set of bytes (12x8 bit) */
|
jpayne@69
|
247 typedef struct snd_seq_ev_raw8 {
|
jpayne@69
|
248 unsigned char d[12]; /**< 8 bit value */
|
jpayne@69
|
249 } snd_seq_ev_raw8_t;
|
jpayne@69
|
250
|
jpayne@69
|
251 /** generic set of integers (3x32 bit) */
|
jpayne@69
|
252 typedef struct snd_seq_ev_raw32 {
|
jpayne@69
|
253 unsigned int d[3]; /**< 32 bit value */
|
jpayne@69
|
254 } snd_seq_ev_raw32_t;
|
jpayne@69
|
255
|
jpayne@69
|
256 /** external stored data */
|
jpayne@69
|
257 struct snd_seq_ev_ext {
|
jpayne@69
|
258 unsigned int len; /**< length of data */
|
jpayne@69
|
259 void *ptr; /**< pointer to data (note: can be 64-bit) */
|
jpayne@69
|
260 } __attribute__((packed));
|
jpayne@69
|
261 /** external stored data */
|
jpayne@69
|
262 typedef struct snd_seq_ev_ext snd_seq_ev_ext_t;
|
jpayne@69
|
263 #ifdef DOC_HIDDEN
|
jpayne@69
|
264 /* redefine typedef for stupid doxygen */
|
jpayne@69
|
265 typedef snd_seq_ev_ext snd_seq_ev_ext_t;
|
jpayne@69
|
266 #endif
|
jpayne@69
|
267
|
jpayne@69
|
268 /** Result events */
|
jpayne@69
|
269 typedef struct snd_seq_result {
|
jpayne@69
|
270 int event; /**< processed event type */
|
jpayne@69
|
271 int result; /**< status */
|
jpayne@69
|
272 } snd_seq_result_t;
|
jpayne@69
|
273
|
jpayne@69
|
274 /** Queue skew values */
|
jpayne@69
|
275 typedef struct snd_seq_queue_skew {
|
jpayne@69
|
276 unsigned int value; /**< skew value */
|
jpayne@69
|
277 unsigned int base; /**< skew base */
|
jpayne@69
|
278 } snd_seq_queue_skew_t;
|
jpayne@69
|
279
|
jpayne@69
|
280 /** queue timer control */
|
jpayne@69
|
281 typedef struct snd_seq_ev_queue_control {
|
jpayne@69
|
282 unsigned char queue; /**< affected queue */
|
jpayne@69
|
283 unsigned char unused[3]; /**< reserved */
|
jpayne@69
|
284 union {
|
jpayne@69
|
285 signed int value; /**< affected value (e.g. tempo) */
|
jpayne@69
|
286 snd_seq_timestamp_t time; /**< time */
|
jpayne@69
|
287 unsigned int position; /**< sync position */
|
jpayne@69
|
288 snd_seq_queue_skew_t skew; /**< queue skew */
|
jpayne@69
|
289 unsigned int d32[2]; /**< any data */
|
jpayne@69
|
290 unsigned char d8[8]; /**< any data */
|
jpayne@69
|
291 } param; /**< data value union */
|
jpayne@69
|
292 } snd_seq_ev_queue_control_t;
|
jpayne@69
|
293
|
jpayne@69
|
294
|
jpayne@69
|
295 /** Sequencer event */
|
jpayne@69
|
296 typedef struct snd_seq_event {
|
jpayne@69
|
297 snd_seq_event_type_t type; /**< event type */
|
jpayne@69
|
298 unsigned char flags; /**< event flags */
|
jpayne@69
|
299 unsigned char tag; /**< tag */
|
jpayne@69
|
300
|
jpayne@69
|
301 unsigned char queue; /**< schedule queue */
|
jpayne@69
|
302 snd_seq_timestamp_t time; /**< schedule time */
|
jpayne@69
|
303
|
jpayne@69
|
304 snd_seq_addr_t source; /**< source address */
|
jpayne@69
|
305 snd_seq_addr_t dest; /**< destination address */
|
jpayne@69
|
306
|
jpayne@69
|
307 union {
|
jpayne@69
|
308 snd_seq_ev_note_t note; /**< note information */
|
jpayne@69
|
309 snd_seq_ev_ctrl_t control; /**< MIDI control information */
|
jpayne@69
|
310 snd_seq_ev_raw8_t raw8; /**< raw8 data */
|
jpayne@69
|
311 snd_seq_ev_raw32_t raw32; /**< raw32 data */
|
jpayne@69
|
312 snd_seq_ev_ext_t ext; /**< external data */
|
jpayne@69
|
313 snd_seq_ev_queue_control_t queue; /**< queue control */
|
jpayne@69
|
314 snd_seq_timestamp_t time; /**< timestamp */
|
jpayne@69
|
315 snd_seq_addr_t addr; /**< address */
|
jpayne@69
|
316 snd_seq_connect_t connect; /**< connect information */
|
jpayne@69
|
317 snd_seq_result_t result; /**< operation result code */
|
jpayne@69
|
318 } data; /**< event data... */
|
jpayne@69
|
319 } snd_seq_event_t;
|
jpayne@69
|
320
|
jpayne@69
|
321
|
jpayne@69
|
322 /** \} */
|
jpayne@69
|
323
|
jpayne@69
|
324 #endif /* __ALSA_SEQ_EVENT_H */
|
jpayne@69
|
325
|