ALSA project - the C library reference: /tmp/work/src/alsa-lib-1.2.12/include/seqmid.h Source File

ALSA project - the C library reference

Loading...
Searching...
No Matches
seqmid.h
Go to the documentation of this file.
1
11/*
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation; either version 2.1 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 *
26 */
27
28#ifndef __ALSA_SEQMID_H
29#define __ALSA_SEQMID_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
48static inline void snd_seq_ev_clear(snd_seq_event_t *ev)
49{
50 memset(ev, 0, sizeof(*ev));
51}
52
59static inline void snd_seq_ump_ev_clear(snd_seq_ump_event_t *ev)
60{
61 memset(ev, 0, sizeof(*ev));
62}
63
71#define snd_seq_ev_set_tag(ev,t) \
72 ((ev)->tag = (t))
73
84#define snd_seq_ev_set_dest(ev,c,p) \
85 ((ev)->dest.client = (c), (ev)->dest.port = (p))
86
95#define snd_seq_ev_set_subs(ev) \
96 ((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
97 (ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
98
107#define snd_seq_ev_set_broadcast(ev) \
108 ((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
109 (ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
110
118#define snd_seq_ev_set_source(ev,p) \
119 ((ev)->source.port = (p))
120
130#define snd_seq_ev_set_direct(ev) \
131 ((ev)->queue = SND_SEQ_QUEUE_DIRECT)
132
145#define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
146 ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
147 (ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
148 (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
149 (ev)->time.tick = (ttick),\
150 (ev)->queue = (q))
151
164#define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
165 ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
166 (ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
167 (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
168 (ev)->time.time = *(rtime),\
169 (ev)->queue = (q))
170
176#define snd_seq_ev_set_priority(ev, high_prior) \
177 ((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
178 (ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
179
188#define snd_seq_ev_set_fixed(ev) \
189 ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
190 (ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
191
202#define snd_seq_ev_set_variable(ev, datalen, dataptr) \
203 ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
204 (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
205 (ev)->data.ext.len = (datalen),\
206 (ev)->data.ext.ptr = (dataptr))
207
218#define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
219 ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
220 (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
221 (ev)->data.ext.len = (datalen),\
222 (ev)->data.ext.ptr = (dataptr))
223
231#define snd_seq_ev_set_queue_control(ev, typ, q, val) \
232 ((ev)->type = (typ),\
233 snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
234 (ev)->data.queue.queue = (q),\
235 (ev)->data.queue.param.value = (val))
236
244#define snd_seq_ev_set_queue_start(ev, q) \
245 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
246
254#define snd_seq_ev_set_queue_stop(ev, q) \
255 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
256
264#define snd_seq_ev_set_queue_continue(ev, q) \
265 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
266
273#define snd_seq_ev_set_queue_tempo(ev, q, val) \
274 snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
275
282#define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
283 ((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
284 snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
285 (ev)->data.queue.queue = (q),\
286 (ev)->data.queue.param.time.time = *(rtime))
287
294#define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
295 ((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
296 snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
297 (ev)->data.queue.queue = (q),\
298 (ev)->data.queue.param.time.tick = (ttime))
299
304static inline void snd_seq_ev_set_ump(snd_seq_ump_event_t *ev)
305{
306 ev->flags |= SND_SEQ_EVENT_UMP;
307 ev->type = 0; /* unused for UMP */
308}
309
316static inline int snd_seq_ev_set_ump_data(snd_seq_ump_event_t *ev, void *data, size_t bytes)
317{
318 if (bytes > 16)
319 return -EINVAL;
320 snd_seq_ev_set_ump(ev);
321 memcpy(ev->ump, data, bytes);
322 return 0;
323}
324
325/* set and send a queue control event */
326int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
327
334#define snd_seq_start_queue(seq, q, ev) \
335 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
336
343#define snd_seq_stop_queue(seq, q, ev) \
344 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
345
352#define snd_seq_continue_queue(seq, q, ev) \
353 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
354
362#define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
363 snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
364
365/* create a port - simple version - return the port number */
366int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
367 unsigned int caps, unsigned int type);
368/* delete the port */
369int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
370
371/* simple subscription between this port and another port
372 (w/o exclusive & time conversion)
373 */
374int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
375int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
376int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
377int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
378
379/*
380 * set client information
381 */
382int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
383int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
384int snd_seq_set_client_midi_version(snd_seq_t *seq, int midi_version);
385int snd_seq_set_client_ump_conversion(snd_seq_t *seq, int enable);
386int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
387int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
388int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
389/* sync output queue */
390int snd_seq_sync_output_queue(snd_seq_t *seq);
391
392/*
393 * parse the given string and get the sequencer address
394 */
395int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
396
397/*
398 * reset client input/output pool
399 */
400int snd_seq_reset_pool_output(snd_seq_t *seq);
401int snd_seq_reset_pool_input(snd_seq_t *seq);
402
411#define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
412 ((ev)->type = SND_SEQ_EVENT_NOTE,\
413 snd_seq_ev_set_fixed(ev),\
414 (ev)->data.note.channel = (ch),\
415 (ev)->data.note.note = (key),\
416 (ev)->data.note.velocity = (vel),\
417 (ev)->data.note.duration = (dur))
418
426#define snd_seq_ev_set_noteon(ev, ch, key, vel) \
427 ((ev)->type = SND_SEQ_EVENT_NOTEON,\
428 snd_seq_ev_set_fixed(ev),\
429 (ev)->data.note.channel = (ch),\
430 (ev)->data.note.note = (key),\
431 (ev)->data.note.velocity = (vel))
432
440#define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
441 ((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
442 snd_seq_ev_set_fixed(ev),\
443 (ev)->data.note.channel = (ch),\
444 (ev)->data.note.note = (key),\
445 (ev)->data.note.velocity = (vel))
446
454#define snd_seq_ev_set_keypress(ev,ch,key,vel) \
455 ((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
456 snd_seq_ev_set_fixed(ev),\
457 (ev)->data.note.channel = (ch),\
458 (ev)->data.note.note = (key),\
459 (ev)->data.note.velocity = (vel))
460
468#define snd_seq_ev_set_controller(ev,ch,cc,val) \
469 ((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
470 snd_seq_ev_set_fixed(ev),\
471 (ev)->data.control.channel = (ch),\
472 (ev)->data.control.param = (cc),\
473 (ev)->data.control.value = (val))
474
481#define snd_seq_ev_set_pgmchange(ev,ch,val) \
482 ((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
483 snd_seq_ev_set_fixed(ev),\
484 (ev)->data.control.channel = (ch),\
485 (ev)->data.control.value = (val))
486
493#define snd_seq_ev_set_pitchbend(ev,ch,val) \
494 ((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
495 snd_seq_ev_set_fixed(ev),\
496 (ev)->data.control.channel = (ch),\
497 (ev)->data.control.value = (val))
498
505#define snd_seq_ev_set_chanpress(ev,ch,val) \
506 ((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
507 snd_seq_ev_set_fixed(ev),\
508 (ev)->data.control.channel = (ch),\
509 (ev)->data.control.value = (val))
510
519#define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
520 ((ev)->type = SND_SEQ_EVENT_SYSEX,\
521 snd_seq_ev_set_variable(ev, datalen, dataptr))
522
525#ifdef __cplusplus
526}
527#endif
528
529#endif /* __ALSA_SEQMID_H */
530
SND_SEQ_EVENT_UMP
#define SND_SEQ_EVENT_UMP
Definition seq_event.h:228
snd_seq_set_client_pool_input
int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size)
change the input pool size of the given client
Definition seqmid.c:340
snd_seq_connect_from
int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port)
simple subscription (w/o exclusive & time conversion)
Definition seqmid.c:119
snd_seq_control_queue
int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev)
queue controls - start/stop/continue
Definition seqmid.c:46
snd_seq_set_client_pool_output
int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size)
change the output pool size of the given client
Definition seqmid.c:302
snd_seq_reset_pool_output
int snd_seq_reset_pool_output(snd_seq_t *seq)
reset client output pool
Definition seqmid.c:358
snd_seq_set_client_pool_output_room
int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size)
change the output room size of the given client
Definition seqmid.c:321
snd_seq_parse_address
int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str)
parse the given string and get the sequencer address
Definition seqmid.c:425
snd_seq_sync_output_queue
int snd_seq_sync_output_queue(snd_seq_t *seq)
wait until all events are processed
Definition seqmid.c:384
snd_seq_set_client_event_filter
int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type)
add client event filter
Definition seqmid.c:245
snd_seq_delete_simple_port
int snd_seq_delete_simple_port(snd_seq_t *seq, int port)
delete the port
Definition seqmid.c:101
snd_seq_disconnect_from
int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port)
simple disconnection
Definition seqmid.c:173
snd_seq_create_simple_port
int snd_seq_create_simple_port(snd_seq_t *seq, const char *name, unsigned int caps, unsigned int type)
create a port - simple version
Definition seqmid.c:71
snd_seq_connect_to
int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port)
simple subscription (w/o exclusive & time conversion)
Definition seqmid.c:146
snd_seq_set_client_midi_version
int snd_seq_set_client_midi_version(snd_seq_t *seq, int midi_version)
set client MIDI protocol version
Definition seqmid.c:264
snd_seq_set_client_ump_conversion
int snd_seq_set_client_ump_conversion(snd_seq_t *seq, int enable)
enable/disable client's automatic conversion of UMP/legacy events
Definition seqmid.c:283
snd_seq_reset_pool_input
int snd_seq_reset_pool_input(snd_seq_t *seq)
reset client input pool
Definition seqmid.c:370
snd_seq_set_client_name
int snd_seq_set_client_name(snd_seq_t *seq, const char *name)
set client name
Definition seqmid.c:226
snd_seq_disconnect_to
int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port)
simple disconnection
Definition seqmid.c:200
snd_seq_t
struct _snd_seq snd_seq_t
Definition seq.h:47
snd_seq_addr_t
Definition seq_event.h:178
snd_seq_event_t
Definition seq_event.h:310
snd_seq_ump_event_t
Definition seq_event.h:325
snd_seq_ump_event_t::flags
unsigned char flags
Definition seq_event.h:327
snd_seq_ump_event_t::ump
unsigned int ump[4]
Definition seq_event.h:336
snd_seq_ump_event_t::type
snd_seq_event_type_t type
Definition seq_event.h:326