All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
seqmid.h
Go to the documentation of this file.
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __ALSA_SEQMID_H
#define __ALSA_SEQMID_H
#ifdef __cplusplus
extern "C" {
#endif
#define snd_seq_ev_clear(ev) \
memset(ev, 0, sizeof(snd_seq_event_t))
#define snd_seq_ev_set_tag(ev,t) \
((ev)->tag = (t))
#define snd_seq_ev_set_dest(ev,c,p) \
((ev)->dest.client = (c), (ev)->dest.port = (p))
#define snd_seq_ev_set_subs(ev) \
((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
(ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
#define snd_seq_ev_set_broadcast(ev) \
((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
(ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
#define snd_seq_ev_set_source(ev,p) \
((ev)->source.port = (p))
#define snd_seq_ev_set_direct(ev) \
((ev)->queue = SND_SEQ_QUEUE_DIRECT)
#define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
(ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
(ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
(ev)->time.tick = (ttick),\
(ev)->queue = (q))
#define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
(ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
(ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
(ev)->time.time = *(rtime),\
(ev)->queue = (q))
#define snd_seq_ev_set_priority(ev, high_prior) \
((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
(ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
#define snd_seq_ev_set_fixed(ev) \
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
(ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
#define snd_seq_ev_set_variable(ev, datalen, dataptr) \
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
(ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
(ev)->data.ext.len = (datalen),\
(ev)->data.ext.ptr = (dataptr))
#define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
(ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
(ev)->data.ext.len = (datalen),\
(ev)->data.ext.ptr = (dataptr))
#define snd_seq_ev_set_queue_control(ev, typ, q, val) \
((ev)->type = (typ),\
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.value = (val))
#define snd_seq_ev_set_queue_start(ev, q) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
#define snd_seq_ev_set_queue_stop(ev, q) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
#define snd_seq_ev_set_queue_continue(ev, q) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
#define snd_seq_ev_set_queue_tempo(ev, q, val) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
#define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.time.time = *(rtime))
#define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.time.tick = (ttime))
/* set and send a queue control event */
int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
#define snd_seq_start_queue(seq, q, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
#define snd_seq_stop_queue(seq, q, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
#define snd_seq_continue_queue(seq, q, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
#define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
/* create a port - simple version - return the port number */
int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
unsigned int caps, unsigned int type);
/* delete the port */
int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
/* simple subscription between this port and another port
(w/o exclusive & time conversion)
*/
int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
/*
* set client information
*/
int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
/* sync output queue */
int snd_seq_sync_output_queue(snd_seq_t *seq);
/*
* parse the given string and get the sequencer address
*/
int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
/*
* reset client input/output pool
*/
int snd_seq_reset_pool_output(snd_seq_t *seq);
int snd_seq_reset_pool_input(snd_seq_t *seq);
#define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
((ev)->type = SND_SEQ_EVENT_NOTE,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel),\
(ev)->data.note.duration = (dur))
#define snd_seq_ev_set_noteon(ev, ch, key, vel) \
((ev)->type = SND_SEQ_EVENT_NOTEON,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel))
#define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel))
#define snd_seq_ev_set_keypress(ev,ch,key,vel) \
((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel))
#define snd_seq_ev_set_controller(ev,ch,cc,val) \
((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.param = (cc),\
(ev)->data.control.value = (val))
#define snd_seq_ev_set_pgmchange(ev,ch,val) \
((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.value = (val))
#define snd_seq_ev_set_pitchbend(ev,ch,val) \
((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.value = (val))
#define snd_seq_ev_set_chanpress(ev,ch,val) \
((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.value = (val))
#define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
((ev)->type = SND_SEQ_EVENT_SYSEX,\
snd_seq_ev_set_variable(ev, datalen, dataptr))
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_SEQMID_H */
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 &amp; time conversion)
Definition: seqmid.c:121
snd_seq_set_client_name
int snd_seq_set_client_name(snd_seq_t *seq, const char *name)
set client name
Definition: seqmid.c:228
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:175
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:266
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:389
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:202
snd_seq_reset_pool_output
int snd_seq_reset_pool_output(snd_seq_t *seq)
reset client output pool
Definition: seqmid.c:322
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:304
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 &amp; time conversion)
Definition: seqmid.c:148
snd_seq_addr_t
Definition: seq_event.h:178
snd_seq_delete_simple_port
int snd_seq_delete_simple_port(snd_seq_t *seq, int port)
delete the port
Definition: seqmid.c:103
snd_seq_t
struct _snd_seq snd_seq_t
Definition: seq.h:47
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:48
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:73
snd_seq_reset_pool_input
int snd_seq_reset_pool_input(snd_seq_t *seq)
reset client input pool
Definition: seqmid.c:334
snd_seq_sync_output_queue
int snd_seq_sync_output_queue(snd_seq_t *seq)
wait until all events are processed
Definition: seqmid.c:348
snd_seq_event_t
Definition: seq_event.h:296
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:247
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:285