jpayne@69
|
1 /**
|
jpayne@69
|
2 * \file include/seqmid.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_SEQMID_H
|
jpayne@69
|
29 #define __ALSA_SEQMID_H
|
jpayne@69
|
30
|
jpayne@69
|
31 #ifdef __cplusplus
|
jpayne@69
|
32 extern "C" {
|
jpayne@69
|
33 #endif
|
jpayne@69
|
34
|
jpayne@69
|
35 /**
|
jpayne@69
|
36 * \defgroup SeqMiddle Sequencer Middle Level Interface
|
jpayne@69
|
37 * Sequencer Middle Level Interface
|
jpayne@69
|
38 * \ingroup Sequencer
|
jpayne@69
|
39 * \{
|
jpayne@69
|
40 */
|
jpayne@69
|
41
|
jpayne@69
|
42 /**
|
jpayne@69
|
43 * \brief initialize event record
|
jpayne@69
|
44 * \param ev event record pointer
|
jpayne@69
|
45 *
|
jpayne@69
|
46 * This macro clears the given event record pointer to the default status.
|
jpayne@69
|
47 */
|
jpayne@69
|
48 #define snd_seq_ev_clear(ev) \
|
jpayne@69
|
49 memset(ev, 0, sizeof(snd_seq_event_t))
|
jpayne@69
|
50
|
jpayne@69
|
51 /**
|
jpayne@69
|
52 * \brief set the tag for given event
|
jpayne@69
|
53 * \param ev event record
|
jpayne@69
|
54 * \param t event tag
|
jpayne@69
|
55 *
|
jpayne@69
|
56 * This macro sets the tag to the given event record.
|
jpayne@69
|
57 */
|
jpayne@69
|
58 #define snd_seq_ev_set_tag(ev,t) \
|
jpayne@69
|
59 ((ev)->tag = (t))
|
jpayne@69
|
60
|
jpayne@69
|
61 /**
|
jpayne@69
|
62 * \brief set the explicit destination
|
jpayne@69
|
63 * \param ev event record
|
jpayne@69
|
64 * \param c destination client id
|
jpayne@69
|
65 * \param p destination port id
|
jpayne@69
|
66 *
|
jpayne@69
|
67 * This macro sets the client and port id numbers to the given event record.
|
jpayne@69
|
68 *
|
jpayne@69
|
69 * \sa snd_seq_ev_set_subs()
|
jpayne@69
|
70 */
|
jpayne@69
|
71 #define snd_seq_ev_set_dest(ev,c,p) \
|
jpayne@69
|
72 ((ev)->dest.client = (c), (ev)->dest.port = (p))
|
jpayne@69
|
73
|
jpayne@69
|
74 /**
|
jpayne@69
|
75 * \brief set broadcasting to subscribers
|
jpayne@69
|
76 * \param ev event record
|
jpayne@69
|
77 *
|
jpayne@69
|
78 * This macro sets the destination as the subscribers.
|
jpayne@69
|
79 *
|
jpayne@69
|
80 * \sa snd_seq_ev_set_dest()
|
jpayne@69
|
81 */
|
jpayne@69
|
82 #define snd_seq_ev_set_subs(ev) \
|
jpayne@69
|
83 ((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
|
jpayne@69
|
84 (ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
|
jpayne@69
|
85
|
jpayne@69
|
86 /**
|
jpayne@69
|
87 * \brief set broadcasting to all clients/ports
|
jpayne@69
|
88 * \param ev event record
|
jpayne@69
|
89 *
|
jpayne@69
|
90 * This macro sets the destination as the broadcasting.
|
jpayne@69
|
91 *
|
jpayne@69
|
92 * \sa snd_seq_ev_set_dest()
|
jpayne@69
|
93 */
|
jpayne@69
|
94 #define snd_seq_ev_set_broadcast(ev) \
|
jpayne@69
|
95 ((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
|
jpayne@69
|
96 (ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
|
jpayne@69
|
97
|
jpayne@69
|
98 /**
|
jpayne@69
|
99 * \brief set the source port
|
jpayne@69
|
100 * \param ev event record
|
jpayne@69
|
101 * \param p source port id
|
jpayne@69
|
102 *
|
jpayne@69
|
103 * This macro sets the source port id number.
|
jpayne@69
|
104 */
|
jpayne@69
|
105 #define snd_seq_ev_set_source(ev,p) \
|
jpayne@69
|
106 ((ev)->source.port = (p))
|
jpayne@69
|
107
|
jpayne@69
|
108 /**
|
jpayne@69
|
109 * \brief set direct passing mode (without queued)
|
jpayne@69
|
110 * \param ev event instance
|
jpayne@69
|
111 *
|
jpayne@69
|
112 * This macro sets the event to the direct passing mode
|
jpayne@69
|
113 * to be delivered immediately without queueing.
|
jpayne@69
|
114 *
|
jpayne@69
|
115 * \sa snd_seq_ev_schedule_tick(), snd_seq_ev_schedule_real()
|
jpayne@69
|
116 */
|
jpayne@69
|
117 #define snd_seq_ev_set_direct(ev) \
|
jpayne@69
|
118 ((ev)->queue = SND_SEQ_QUEUE_DIRECT)
|
jpayne@69
|
119
|
jpayne@69
|
120 /**
|
jpayne@69
|
121 * \brief set tick-scheduling mode on queue
|
jpayne@69
|
122 * \param ev event instance
|
jpayne@69
|
123 * \param q queue id to schedule
|
jpayne@69
|
124 * \param relative relative time-stamp if non-zero
|
jpayne@69
|
125 * \param ttick tick time-stamp to be delivered
|
jpayne@69
|
126 *
|
jpayne@69
|
127 * This macro sets the scheduling of the event in the
|
jpayne@69
|
128 * MIDI tick mode.
|
jpayne@69
|
129 *
|
jpayne@69
|
130 * \sa snd_seq_ev_schedule_real(), snd_seq_ev_set_direct()
|
jpayne@69
|
131 */
|
jpayne@69
|
132 #define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
|
jpayne@69
|
133 ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
|
jpayne@69
|
134 (ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
|
jpayne@69
|
135 (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
|
jpayne@69
|
136 (ev)->time.tick = (ttick),\
|
jpayne@69
|
137 (ev)->queue = (q))
|
jpayne@69
|
138
|
jpayne@69
|
139 /**
|
jpayne@69
|
140 * \brief set real-time-scheduling mode on queue
|
jpayne@69
|
141 * \param ev event instance
|
jpayne@69
|
142 * \param q queue id to schedule
|
jpayne@69
|
143 * \param relative relative time-stamp if non-zero
|
jpayne@69
|
144 * \param rtime time-stamp to be delivered
|
jpayne@69
|
145 *
|
jpayne@69
|
146 * This macro sets the scheduling of the event in the
|
jpayne@69
|
147 * realtime mode.
|
jpayne@69
|
148 *
|
jpayne@69
|
149 * \sa snd_seq_ev_schedule_tick(), snd_seq_ev_set_direct()
|
jpayne@69
|
150 */
|
jpayne@69
|
151 #define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
|
jpayne@69
|
152 ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
|
jpayne@69
|
153 (ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
|
jpayne@69
|
154 (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
|
jpayne@69
|
155 (ev)->time.time = *(rtime),\
|
jpayne@69
|
156 (ev)->queue = (q))
|
jpayne@69
|
157
|
jpayne@69
|
158 /**
|
jpayne@69
|
159 * \brief set event priority
|
jpayne@69
|
160 * \param ev event instance
|
jpayne@69
|
161 * \param high_prior 1 for high priority mode
|
jpayne@69
|
162 */
|
jpayne@69
|
163 #define snd_seq_ev_set_priority(ev, high_prior) \
|
jpayne@69
|
164 ((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
|
jpayne@69
|
165 (ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
|
jpayne@69
|
166
|
jpayne@69
|
167 /**
|
jpayne@69
|
168 * \brief set fixed data
|
jpayne@69
|
169 * \param ev event instance
|
jpayne@69
|
170 *
|
jpayne@69
|
171 * Sets the event length mode as fixed size.
|
jpayne@69
|
172 *
|
jpayne@69
|
173 * \sa snd_seq_ev_set_variable(), snd_seq_ev_set_varusr()
|
jpayne@69
|
174 */
|
jpayne@69
|
175 #define snd_seq_ev_set_fixed(ev) \
|
jpayne@69
|
176 ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
|
jpayne@69
|
177 (ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
|
jpayne@69
|
178
|
jpayne@69
|
179 /**
|
jpayne@69
|
180 * \brief set variable data
|
jpayne@69
|
181 * \param ev event instance
|
jpayne@69
|
182 * \param datalen length of the external data
|
jpayne@69
|
183 * \param dataptr pointer of the external data
|
jpayne@69
|
184 *
|
jpayne@69
|
185 * Sets the event length mode as variable length and stores the data.
|
jpayne@69
|
186 *
|
jpayne@69
|
187 * \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_varusr()
|
jpayne@69
|
188 */
|
jpayne@69
|
189 #define snd_seq_ev_set_variable(ev, datalen, dataptr) \
|
jpayne@69
|
190 ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
|
jpayne@69
|
191 (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
|
jpayne@69
|
192 (ev)->data.ext.len = (datalen),\
|
jpayne@69
|
193 (ev)->data.ext.ptr = (dataptr))
|
jpayne@69
|
194
|
jpayne@69
|
195 /**
|
jpayne@69
|
196 * \brief set varusr data
|
jpayne@69
|
197 * \param ev event instance
|
jpayne@69
|
198 * \param datalen length of the external data
|
jpayne@69
|
199 * \param dataptr pointer of the external data
|
jpayne@69
|
200 *
|
jpayne@69
|
201 * Sets the event length mode as variable user-space data and stores the data.
|
jpayne@69
|
202 *
|
jpayne@69
|
203 * \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_variable()
|
jpayne@69
|
204 */
|
jpayne@69
|
205 #define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
|
jpayne@69
|
206 ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
|
jpayne@69
|
207 (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
|
jpayne@69
|
208 (ev)->data.ext.len = (datalen),\
|
jpayne@69
|
209 (ev)->data.ext.ptr = (dataptr))
|
jpayne@69
|
210
|
jpayne@69
|
211 /**
|
jpayne@69
|
212 * \brief set queue controls
|
jpayne@69
|
213 * \param ev event record
|
jpayne@69
|
214 * \param typ event type
|
jpayne@69
|
215 * \param q queue id
|
jpayne@69
|
216 * \param val control value
|
jpayne@69
|
217 */
|
jpayne@69
|
218 #define snd_seq_ev_set_queue_control(ev, typ, q, val) \
|
jpayne@69
|
219 ((ev)->type = (typ),\
|
jpayne@69
|
220 snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
|
jpayne@69
|
221 (ev)->data.queue.queue = (q),\
|
jpayne@69
|
222 (ev)->data.queue.param.value = (val))
|
jpayne@69
|
223
|
jpayne@69
|
224 /**
|
jpayne@69
|
225 * \brief set the start queue event
|
jpayne@69
|
226 * \param ev event record
|
jpayne@69
|
227 * \param q queue id to start
|
jpayne@69
|
228 *
|
jpayne@69
|
229 * \sa snd_seq_ev_set_queue_stop(), snd_seq_ev_set_queue_continue()
|
jpayne@69
|
230 */
|
jpayne@69
|
231 #define snd_seq_ev_set_queue_start(ev, q) \
|
jpayne@69
|
232 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
|
jpayne@69
|
233
|
jpayne@69
|
234 /**
|
jpayne@69
|
235 * \brief set the stop queue event
|
jpayne@69
|
236 * \param ev event record
|
jpayne@69
|
237 * \param q queue id to stop
|
jpayne@69
|
238 *
|
jpayne@69
|
239 * \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_continue()
|
jpayne@69
|
240 */
|
jpayne@69
|
241 #define snd_seq_ev_set_queue_stop(ev, q) \
|
jpayne@69
|
242 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
|
jpayne@69
|
243
|
jpayne@69
|
244 /**
|
jpayne@69
|
245 * \brief set the stop queue event
|
jpayne@69
|
246 * \param ev event record
|
jpayne@69
|
247 * \param q queue id to continue
|
jpayne@69
|
248 *
|
jpayne@69
|
249 * \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_stop()
|
jpayne@69
|
250 */
|
jpayne@69
|
251 #define snd_seq_ev_set_queue_continue(ev, q) \
|
jpayne@69
|
252 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
|
jpayne@69
|
253
|
jpayne@69
|
254 /**
|
jpayne@69
|
255 * \brief set the stop queue event
|
jpayne@69
|
256 * \param ev event record
|
jpayne@69
|
257 * \param q queue id to change tempo
|
jpayne@69
|
258 * \param val the new tempo value
|
jpayne@69
|
259 */
|
jpayne@69
|
260 #define snd_seq_ev_set_queue_tempo(ev, q, val) \
|
jpayne@69
|
261 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
|
jpayne@69
|
262
|
jpayne@69
|
263 /**
|
jpayne@69
|
264 * \brief set the real-time position of a queue
|
jpayne@69
|
265 * \param ev event record
|
jpayne@69
|
266 * \param q queue id to change tempo
|
jpayne@69
|
267 * \param rtime the new real-time pointer
|
jpayne@69
|
268 */
|
jpayne@69
|
269 #define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
|
jpayne@69
|
270 ((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
|
jpayne@69
|
271 snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
|
jpayne@69
|
272 (ev)->data.queue.queue = (q),\
|
jpayne@69
|
273 (ev)->data.queue.param.time.time = *(rtime))
|
jpayne@69
|
274
|
jpayne@69
|
275 /**
|
jpayne@69
|
276 * \brief set the tick-time position of a queue
|
jpayne@69
|
277 * \param ev event record
|
jpayne@69
|
278 * \param q queue id to change tempo
|
jpayne@69
|
279 * \param ttime the new tick-time
|
jpayne@69
|
280 */
|
jpayne@69
|
281 #define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
|
jpayne@69
|
282 ((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
|
jpayne@69
|
283 snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
|
jpayne@69
|
284 (ev)->data.queue.queue = (q),\
|
jpayne@69
|
285 (ev)->data.queue.param.time.tick = (ttime))
|
jpayne@69
|
286
|
jpayne@69
|
287 /* set and send a queue control event */
|
jpayne@69
|
288 int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
|
jpayne@69
|
289
|
jpayne@69
|
290 /**
|
jpayne@69
|
291 * \brief start the specified queue
|
jpayne@69
|
292 * \param seq sequencer handle
|
jpayne@69
|
293 * \param q queue id to start
|
jpayne@69
|
294 * \param ev optional event record (see #snd_seq_control_queue)
|
jpayne@69
|
295 */
|
jpayne@69
|
296 #define snd_seq_start_queue(seq, q, ev) \
|
jpayne@69
|
297 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
|
jpayne@69
|
298
|
jpayne@69
|
299 /**
|
jpayne@69
|
300 * \brief stop the specified queue
|
jpayne@69
|
301 * \param seq sequencer handle
|
jpayne@69
|
302 * \param q queue id to stop
|
jpayne@69
|
303 * \param ev optional event record (see #snd_seq_control_queue)
|
jpayne@69
|
304 */
|
jpayne@69
|
305 #define snd_seq_stop_queue(seq, q, ev) \
|
jpayne@69
|
306 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
|
jpayne@69
|
307
|
jpayne@69
|
308 /**
|
jpayne@69
|
309 * \brief continue the specified queue
|
jpayne@69
|
310 * \param seq sequencer handle
|
jpayne@69
|
311 * \param q queue id to continue
|
jpayne@69
|
312 * \param ev optional event record (see #snd_seq_control_queue)
|
jpayne@69
|
313 */
|
jpayne@69
|
314 #define snd_seq_continue_queue(seq, q, ev) \
|
jpayne@69
|
315 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
|
jpayne@69
|
316
|
jpayne@69
|
317 /**
|
jpayne@69
|
318 * \brief change the tempo of the specified queue
|
jpayne@69
|
319 * \param seq sequencer handle
|
jpayne@69
|
320 * \param q queue id
|
jpayne@69
|
321 * \param tempo the new tempo value
|
jpayne@69
|
322 * \param ev optional event record (see #snd_seq_control_queue)
|
jpayne@69
|
323 */
|
jpayne@69
|
324 #define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
|
jpayne@69
|
325 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
|
jpayne@69
|
326
|
jpayne@69
|
327 /* create a port - simple version - return the port number */
|
jpayne@69
|
328 int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
|
jpayne@69
|
329 unsigned int caps, unsigned int type);
|
jpayne@69
|
330 /* delete the port */
|
jpayne@69
|
331 int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
|
jpayne@69
|
332
|
jpayne@69
|
333 /* simple subscription between this port and another port
|
jpayne@69
|
334 (w/o exclusive & time conversion)
|
jpayne@69
|
335 */
|
jpayne@69
|
336 int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
|
jpayne@69
|
337 int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
|
jpayne@69
|
338 int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
|
jpayne@69
|
339 int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
|
jpayne@69
|
340
|
jpayne@69
|
341 /*
|
jpayne@69
|
342 * set client information
|
jpayne@69
|
343 */
|
jpayne@69
|
344 int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
|
jpayne@69
|
345 int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
|
jpayne@69
|
346 int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
|
jpayne@69
|
347 int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
|
jpayne@69
|
348 int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
|
jpayne@69
|
349 /* sync output queue */
|
jpayne@69
|
350 int snd_seq_sync_output_queue(snd_seq_t *seq);
|
jpayne@69
|
351
|
jpayne@69
|
352 /*
|
jpayne@69
|
353 * parse the given string and get the sequencer address
|
jpayne@69
|
354 */
|
jpayne@69
|
355 int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
|
jpayne@69
|
356
|
jpayne@69
|
357 /*
|
jpayne@69
|
358 * reset client input/output pool
|
jpayne@69
|
359 */
|
jpayne@69
|
360 int snd_seq_reset_pool_output(snd_seq_t *seq);
|
jpayne@69
|
361 int snd_seq_reset_pool_input(snd_seq_t *seq);
|
jpayne@69
|
362
|
jpayne@69
|
363 /**
|
jpayne@69
|
364 * \brief set note event
|
jpayne@69
|
365 * \param ev event record
|
jpayne@69
|
366 * \param ch channel number
|
jpayne@69
|
367 * \param key note key
|
jpayne@69
|
368 * \param vel velocity
|
jpayne@69
|
369 * \param dur duration (in tick or msec)
|
jpayne@69
|
370 */
|
jpayne@69
|
371 #define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
|
jpayne@69
|
372 ((ev)->type = SND_SEQ_EVENT_NOTE,\
|
jpayne@69
|
373 snd_seq_ev_set_fixed(ev),\
|
jpayne@69
|
374 (ev)->data.note.channel = (ch),\
|
jpayne@69
|
375 (ev)->data.note.note = (key),\
|
jpayne@69
|
376 (ev)->data.note.velocity = (vel),\
|
jpayne@69
|
377 (ev)->data.note.duration = (dur))
|
jpayne@69
|
378
|
jpayne@69
|
379 /**
|
jpayne@69
|
380 * \brief set note-on event
|
jpayne@69
|
381 * \param ev event record
|
jpayne@69
|
382 * \param ch channel number
|
jpayne@69
|
383 * \param key note key
|
jpayne@69
|
384 * \param vel velocity
|
jpayne@69
|
385 */
|
jpayne@69
|
386 #define snd_seq_ev_set_noteon(ev, ch, key, vel) \
|
jpayne@69
|
387 ((ev)->type = SND_SEQ_EVENT_NOTEON,\
|
jpayne@69
|
388 snd_seq_ev_set_fixed(ev),\
|
jpayne@69
|
389 (ev)->data.note.channel = (ch),\
|
jpayne@69
|
390 (ev)->data.note.note = (key),\
|
jpayne@69
|
391 (ev)->data.note.velocity = (vel))
|
jpayne@69
|
392
|
jpayne@69
|
393 /**
|
jpayne@69
|
394 * \brief set note-off event
|
jpayne@69
|
395 * \param ev event record
|
jpayne@69
|
396 * \param ch channel number
|
jpayne@69
|
397 * \param key note key
|
jpayne@69
|
398 * \param vel velocity
|
jpayne@69
|
399 */
|
jpayne@69
|
400 #define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
|
jpayne@69
|
401 ((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
|
jpayne@69
|
402 snd_seq_ev_set_fixed(ev),\
|
jpayne@69
|
403 (ev)->data.note.channel = (ch),\
|
jpayne@69
|
404 (ev)->data.note.note = (key),\
|
jpayne@69
|
405 (ev)->data.note.velocity = (vel))
|
jpayne@69
|
406
|
jpayne@69
|
407 /**
|
jpayne@69
|
408 * \brief set key-pressure event
|
jpayne@69
|
409 * \param ev event record
|
jpayne@69
|
410 * \param ch channel number
|
jpayne@69
|
411 * \param key note key
|
jpayne@69
|
412 * \param vel velocity
|
jpayne@69
|
413 */
|
jpayne@69
|
414 #define snd_seq_ev_set_keypress(ev,ch,key,vel) \
|
jpayne@69
|
415 ((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
|
jpayne@69
|
416 snd_seq_ev_set_fixed(ev),\
|
jpayne@69
|
417 (ev)->data.note.channel = (ch),\
|
jpayne@69
|
418 (ev)->data.note.note = (key),\
|
jpayne@69
|
419 (ev)->data.note.velocity = (vel))
|
jpayne@69
|
420
|
jpayne@69
|
421 /**
|
jpayne@69
|
422 * \brief set MIDI controller event
|
jpayne@69
|
423 * \param ev event record
|
jpayne@69
|
424 * \param ch channel number
|
jpayne@69
|
425 * \param cc controller number
|
jpayne@69
|
426 * \param val control value
|
jpayne@69
|
427 */
|
jpayne@69
|
428 #define snd_seq_ev_set_controller(ev,ch,cc,val) \
|
jpayne@69
|
429 ((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
|
jpayne@69
|
430 snd_seq_ev_set_fixed(ev),\
|
jpayne@69
|
431 (ev)->data.control.channel = (ch),\
|
jpayne@69
|
432 (ev)->data.control.param = (cc),\
|
jpayne@69
|
433 (ev)->data.control.value = (val))
|
jpayne@69
|
434
|
jpayne@69
|
435 /**
|
jpayne@69
|
436 * \brief set program change event
|
jpayne@69
|
437 * \param ev event record
|
jpayne@69
|
438 * \param ch channel number
|
jpayne@69
|
439 * \param val program number
|
jpayne@69
|
440 */
|
jpayne@69
|
441 #define snd_seq_ev_set_pgmchange(ev,ch,val) \
|
jpayne@69
|
442 ((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
|
jpayne@69
|
443 snd_seq_ev_set_fixed(ev),\
|
jpayne@69
|
444 (ev)->data.control.channel = (ch),\
|
jpayne@69
|
445 (ev)->data.control.value = (val))
|
jpayne@69
|
446
|
jpayne@69
|
447 /**
|
jpayne@69
|
448 * \brief set pitch-bend event
|
jpayne@69
|
449 * \param ev event record
|
jpayne@69
|
450 * \param ch channel number
|
jpayne@69
|
451 * \param val pitch bend; zero centered from -8192 to 8191
|
jpayne@69
|
452 */
|
jpayne@69
|
453 #define snd_seq_ev_set_pitchbend(ev,ch,val) \
|
jpayne@69
|
454 ((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
|
jpayne@69
|
455 snd_seq_ev_set_fixed(ev),\
|
jpayne@69
|
456 (ev)->data.control.channel = (ch),\
|
jpayne@69
|
457 (ev)->data.control.value = (val))
|
jpayne@69
|
458
|
jpayne@69
|
459 /**
|
jpayne@69
|
460 * \brief set channel pressure event
|
jpayne@69
|
461 * \param ev event record
|
jpayne@69
|
462 * \param ch channel number
|
jpayne@69
|
463 * \param val channel pressure value
|
jpayne@69
|
464 */
|
jpayne@69
|
465 #define snd_seq_ev_set_chanpress(ev,ch,val) \
|
jpayne@69
|
466 ((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
|
jpayne@69
|
467 snd_seq_ev_set_fixed(ev),\
|
jpayne@69
|
468 (ev)->data.control.channel = (ch),\
|
jpayne@69
|
469 (ev)->data.control.value = (val))
|
jpayne@69
|
470
|
jpayne@69
|
471 /**
|
jpayne@69
|
472 * \brief set sysex event
|
jpayne@69
|
473 * \param ev event record
|
jpayne@69
|
474 * \param datalen length of sysex data
|
jpayne@69
|
475 * \param dataptr sysex data pointer
|
jpayne@69
|
476 *
|
jpayne@69
|
477 * the sysex data must contain the start byte 0xf0 and the end byte 0xf7.
|
jpayne@69
|
478 */
|
jpayne@69
|
479 #define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
|
jpayne@69
|
480 ((ev)->type = SND_SEQ_EVENT_SYSEX,\
|
jpayne@69
|
481 snd_seq_ev_set_variable(ev, datalen, dataptr))
|
jpayne@69
|
482
|
jpayne@69
|
483 /** \} */
|
jpayne@69
|
484
|
jpayne@69
|
485 #ifdef __cplusplus
|
jpayne@69
|
486 }
|
jpayne@69
|
487 #endif
|
jpayne@69
|
488
|
jpayne@69
|
489 #endif /* __ALSA_SEQMID_H */
|
jpayne@69
|
490
|