/home/users/builder/rpm/BUILD/alsa-lib-1.0.13/include/seqmid.h

Go to the documentation of this file.
00001 
00011 /*
00012  *   This library is free software; you can redistribute it and/or modify
00013  *   it under the terms of the GNU Lesser General Public License as
00014  *   published by the Free Software Foundation; either version 2.1 of
00015  *   the License, or (at your option) any later version.
00016  *
00017  *   This program is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU Lesser General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU Lesser General Public
00023  *   License along with this library; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00025  *
00026  */
00027 
00028 #ifndef __ALSA_SEQMID_H
00029 #define __ALSA_SEQMID_H
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00048 #define snd_seq_ev_clear(ev) \
00049         memset(ev, 0, sizeof(snd_seq_event_t))
00050 
00058 #define snd_seq_ev_set_tag(ev,t) \
00059         ((ev)->tag = (t))
00060 
00071 #define snd_seq_ev_set_dest(ev,c,p) \
00072         ((ev)->dest.client = (c), (ev)->dest.port = (p))
00073 
00082 #define snd_seq_ev_set_subs(ev) \
00083         ((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
00084          (ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
00085 
00094 #define snd_seq_ev_set_broadcast(ev) \
00095         ((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
00096          (ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
00097 
00105 #define snd_seq_ev_set_source(ev,p) \
00106         ((ev)->source.port = (p))
00107 
00117 #define snd_seq_ev_set_direct(ev) \
00118         ((ev)->queue = SND_SEQ_QUEUE_DIRECT)
00119 
00132 #define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
00133         ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
00134          (ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
00135          (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
00136          (ev)->time.tick = (ttick),\
00137          (ev)->queue = (q))
00138 
00151 #define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
00152         ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
00153          (ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
00154          (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
00155          (ev)->time.time = *(rtime),\
00156          (ev)->queue = (q))
00157 
00163 #define snd_seq_ev_set_priority(ev, high_prior) \
00164         ((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
00165          (ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
00166 
00175 #define snd_seq_ev_set_fixed(ev) \
00176         ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
00177          (ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
00178 
00189 #define snd_seq_ev_set_variable(ev, datalen, dataptr) \
00190         ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
00191          (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
00192          (ev)->data.ext.len = (datalen),\
00193          (ev)->data.ext.ptr = (dataptr))
00194 
00205 #define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
00206         ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
00207          (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
00208          (ev)->data.ext.len = (datalen),\
00209          (ev)->data.ext.ptr = (dataptr))
00210 
00218 #define snd_seq_ev_set_queue_control(ev, typ, q, val) \
00219         ((ev)->type = (typ),\
00220          snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
00221          (ev)->data.queue.queue = (q),\
00222          (ev)->data.queue.param.value = (val))
00223 
00231 #define snd_seq_ev_set_queue_start(ev, q) \
00232         snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
00233 
00241 #define snd_seq_ev_set_queue_stop(ev, q) \
00242         snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
00243 
00251 #define snd_seq_ev_set_queue_continue(ev, q) \
00252         snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
00253 
00260 #define snd_seq_ev_set_queue_tempo(ev, q, val) \
00261         snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
00262 
00269 #define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
00270         ((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
00271          snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
00272          (ev)->data.queue.queue = (q),\
00273          (ev)->data.queue.param.time.time = *(rtime))
00274 
00281 #define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
00282         ((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
00283          snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
00284          (ev)->data.queue.queue = (q),\
00285          (ev)->data.queue.param.time.tick = (ttime))
00286 
00287 /* set and send a queue control event */
00288 int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
00289 
00296 #define snd_seq_start_queue(seq, q, ev) \
00297         snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
00298 
00305 #define snd_seq_stop_queue(seq, q, ev) \
00306         snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
00307 
00314 #define snd_seq_continue_queue(seq, q, ev) \
00315         snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
00316 
00324 #define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
00325         snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
00326 
00327 /* create a port - simple version - return the port number */
00328 int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
00329                                unsigned int caps, unsigned int type);
00330 /* delete the port */
00331 int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
00332 
00333 /* simple subscription between this port and another port
00334    (w/o exclusive & time conversion)
00335    */
00336 int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
00337 int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
00338 int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
00339 int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
00340 
00341 /*
00342  * set client information
00343  */
00344 int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
00345 int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
00346 int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
00347 int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
00348 int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
00349 /* sync output queue */
00350 int snd_seq_sync_output_queue(snd_seq_t *seq);
00351 
00352 /*
00353  * parse the given string and get the sequencer address
00354  */
00355 int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
00356 
00357 /*
00358  * reset client input/output pool
00359  */
00360 int snd_seq_reset_pool_output(snd_seq_t *seq);
00361 int snd_seq_reset_pool_input(snd_seq_t *seq);
00362 
00371 #define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
00372         ((ev)->type = SND_SEQ_EVENT_NOTE,\
00373          snd_seq_ev_set_fixed(ev),\
00374          (ev)->data.note.channel = (ch),\
00375          (ev)->data.note.note = (key),\
00376          (ev)->data.note.velocity = (vel),\
00377          (ev)->data.note.duration = (dur))
00378 
00386 #define snd_seq_ev_set_noteon(ev, ch, key, vel) \
00387         ((ev)->type = SND_SEQ_EVENT_NOTEON,\
00388          snd_seq_ev_set_fixed(ev),\
00389          (ev)->data.note.channel = (ch),\
00390          (ev)->data.note.note = (key),\
00391          (ev)->data.note.velocity = (vel))
00392 
00400 #define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
00401         ((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
00402          snd_seq_ev_set_fixed(ev),\
00403          (ev)->data.note.channel = (ch),\
00404          (ev)->data.note.note = (key),\
00405          (ev)->data.note.velocity = (vel))
00406 
00414 #define snd_seq_ev_set_keypress(ev,ch,key,vel) \
00415         ((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
00416          snd_seq_ev_set_fixed(ev),\
00417          (ev)->data.note.channel = (ch),\
00418          (ev)->data.note.note = (key),\
00419          (ev)->data.note.velocity = (vel))
00420 
00428 #define snd_seq_ev_set_controller(ev,ch,cc,val) \
00429         ((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
00430          snd_seq_ev_set_fixed(ev),\
00431          (ev)->data.control.channel = (ch),\
00432          (ev)->data.control.param = (cc),\
00433          (ev)->data.control.value = (val))
00434 
00441 #define snd_seq_ev_set_pgmchange(ev,ch,val) \
00442         ((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
00443          snd_seq_ev_set_fixed(ev),\
00444          (ev)->data.control.channel = (ch),\
00445          (ev)->data.control.value = (val))
00446 
00453 #define snd_seq_ev_set_pitchbend(ev,ch,val) \
00454         ((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
00455          snd_seq_ev_set_fixed(ev),\
00456          (ev)->data.control.channel = (ch),\
00457          (ev)->data.control.value = (val))
00458 
00465 #define snd_seq_ev_set_chanpress(ev,ch,val) \
00466         ((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
00467          snd_seq_ev_set_fixed(ev),\
00468          (ev)->data.control.channel = (ch),\
00469          (ev)->data.control.value = (val))
00470 
00479 #define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
00480         ((ev)->type = SND_SEQ_EVENT_SYSEX,\
00481          snd_seq_ev_set_variable(ev, datalen, dataptr))
00482 
00485 #ifdef __cplusplus
00486 }
00487 #endif
00488 
00489 #endif /* __ALSA_SEQMID_H */
00490 

Generated on Sun Apr 1 18:36:42 2007 for ALSA project - the C library reference by  doxygen 1.5.1