Path: blob/master/thirdparty/linuxbsd_headers/alsa/seq.h
9898 views
/**1* \file include/seq.h2* \brief Application interface library for the ALSA driver3* \author Jaroslav Kysela <[email protected]>4* \author Abramo Bagnara <[email protected]>5* \author Takashi Iwai <[email protected]>6* \date 1998-20017*/8/*9* Application interface library for the ALSA driver10*11*12* This library is free software; you can redistribute it and/or modify13* it under the terms of the GNU Lesser General Public License as14* published by the Free Software Foundation; either version 2.1 of15* 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 of19* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20* GNU Lesser General Public License for more details.21*22* You should have received a copy of the GNU Lesser General Public23* License along with this library; if not, write to the Free Software24* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA25*26*/2728#ifndef __ALSA_SEQ_H29#define __ALSA_SEQ_H3031#ifdef __cplusplus32extern "C" {33#endif3435/**36* \defgroup Sequencer MIDI Sequencer37* MIDI Sequencer Interface.38* See \ref seq page for more details.39* \{40*/4142/** dlsym version for interface entry callback */43#define SND_SEQ_DLSYM_VERSION _dlsym_seq_0014445/** Sequencer handle */46typedef struct _snd_seq snd_seq_t;4748/**49* sequencer opening stream types50*/51#define SND_SEQ_OPEN_OUTPUT 1 /**< open for output (write) */52#define SND_SEQ_OPEN_INPUT 2 /**< open for input (read) */53#define SND_SEQ_OPEN_DUPLEX (SND_SEQ_OPEN_OUTPUT|SND_SEQ_OPEN_INPUT) /**< open for both input and output (read/write) */5455/**56* sequencer opening mode57*/58#define SND_SEQ_NONBLOCK 0x0001 /**< non-blocking mode (flag to open mode) */5960/** sequencer handle type */61typedef enum _snd_seq_type {62SND_SEQ_TYPE_HW, /**< hardware */63SND_SEQ_TYPE_SHM, /**< shared memory (NYI) */64SND_SEQ_TYPE_INET /**< network (NYI) */65} snd_seq_type_t;6667/** special client (port) ids */68#define SND_SEQ_ADDRESS_UNKNOWN 253 /**< unknown source */69#define SND_SEQ_ADDRESS_SUBSCRIBERS 254 /**< send event to all subscribed ports */70#define SND_SEQ_ADDRESS_BROADCAST 255 /**< send event to all queues/clients/ports/channels */7172/** known client numbers */73#define SND_SEQ_CLIENT_SYSTEM 0 /**< system client */7475/*76*/77int snd_seq_open(snd_seq_t **handle, const char *name, int streams, int mode);78int snd_seq_open_lconf(snd_seq_t **handle, const char *name, int streams, int mode, snd_config_t *lconf);79const char *snd_seq_name(snd_seq_t *seq);80snd_seq_type_t snd_seq_type(snd_seq_t *seq);81int snd_seq_close(snd_seq_t *handle);82int snd_seq_poll_descriptors_count(snd_seq_t *handle, short events);83int snd_seq_poll_descriptors(snd_seq_t *handle, struct pollfd *pfds, unsigned int space, short events);84int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);85int snd_seq_nonblock(snd_seq_t *handle, int nonblock);86int snd_seq_client_id(snd_seq_t *handle);8788size_t snd_seq_get_output_buffer_size(snd_seq_t *handle);89size_t snd_seq_get_input_buffer_size(snd_seq_t *handle);90int snd_seq_set_output_buffer_size(snd_seq_t *handle, size_t size);91int snd_seq_set_input_buffer_size(snd_seq_t *handle, size_t size);9293/** system information container */94typedef struct _snd_seq_system_info snd_seq_system_info_t;9596size_t snd_seq_system_info_sizeof(void);97/** allocate a #snd_seq_system_info_t container on stack */98#define snd_seq_system_info_alloca(ptr) \99__snd_alloca(ptr, snd_seq_system_info)100int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);101void snd_seq_system_info_free(snd_seq_system_info_t *ptr);102void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);103104int snd_seq_system_info_get_queues(const snd_seq_system_info_t *info);105int snd_seq_system_info_get_clients(const snd_seq_system_info_t *info);106int snd_seq_system_info_get_ports(const snd_seq_system_info_t *info);107int snd_seq_system_info_get_channels(const snd_seq_system_info_t *info);108int snd_seq_system_info_get_cur_clients(const snd_seq_system_info_t *info);109int snd_seq_system_info_get_cur_queues(const snd_seq_system_info_t *info);110111int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t *info);112113/** \} */114115116/**117* \defgroup SeqClient Sequencer Client Interface118* Sequencer Client Interface119* \ingroup Sequencer120* \{121*/122123/** client information container */124typedef struct _snd_seq_client_info snd_seq_client_info_t;125126/** client types */127typedef enum snd_seq_client_type {128SND_SEQ_USER_CLIENT = 1, /**< user client */129SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */130} snd_seq_client_type_t;131132size_t snd_seq_client_info_sizeof(void);133/** allocate a #snd_seq_client_info_t container on stack */134#define snd_seq_client_info_alloca(ptr) \135__snd_alloca(ptr, snd_seq_client_info)136int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);137void snd_seq_client_info_free(snd_seq_client_info_t *ptr);138void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);139140int snd_seq_client_info_get_client(const snd_seq_client_info_t *info);141snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *info);142const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info);143int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info);144int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info);145int snd_seq_client_info_get_card(const snd_seq_client_info_t *info);146int snd_seq_client_info_get_pid(const snd_seq_client_info_t *info);147const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info);148int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);149int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);150151void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);152void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);153void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val);154void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);155void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);156157void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info);158void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type);159void snd_seq_client_info_event_filter_del(snd_seq_client_info_t *info, int event_type);160int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int event_type);161162int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);163int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);164int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);165int snd_seq_query_next_client(snd_seq_t *handle, snd_seq_client_info_t *info);166167/*168*/169170/** client pool information container */171typedef struct _snd_seq_client_pool snd_seq_client_pool_t;172173size_t snd_seq_client_pool_sizeof(void);174/** allocate a #snd_seq_client_pool_t container on stack */175#define snd_seq_client_pool_alloca(ptr) \176__snd_alloca(ptr, snd_seq_client_pool)177int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);178void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);179void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);180181int snd_seq_client_pool_get_client(const snd_seq_client_pool_t *info);182size_t snd_seq_client_pool_get_output_pool(const snd_seq_client_pool_t *info);183size_t snd_seq_client_pool_get_input_pool(const snd_seq_client_pool_t *info);184size_t snd_seq_client_pool_get_output_room(const snd_seq_client_pool_t *info);185size_t snd_seq_client_pool_get_output_free(const snd_seq_client_pool_t *info);186size_t snd_seq_client_pool_get_input_free(const snd_seq_client_pool_t *info);187void snd_seq_client_pool_set_output_pool(snd_seq_client_pool_t *info, size_t size);188void snd_seq_client_pool_set_input_pool(snd_seq_client_pool_t *info, size_t size);189void snd_seq_client_pool_set_output_room(snd_seq_client_pool_t *info, size_t size);190191int snd_seq_get_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);192int snd_seq_set_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);193194195/** \} */196197198/**199* \defgroup SeqPort Sequencer Port Interface200* Sequencer Port Interface201* \ingroup Sequencer202* \{203*/204205/** port information container */206typedef struct _snd_seq_port_info snd_seq_port_info_t;207208/** known port numbers */209#define SND_SEQ_PORT_SYSTEM_TIMER 0 /**< system timer port */210#define SND_SEQ_PORT_SYSTEM_ANNOUNCE 1 /**< system announce port */211212/** port capabilities (32 bits) */213#define SND_SEQ_PORT_CAP_READ (1<<0) /**< readable from this port */214#define SND_SEQ_PORT_CAP_WRITE (1<<1) /**< writable to this port */215216#define SND_SEQ_PORT_CAP_SYNC_READ (1<<2) /**< allow read subscriptions */217#define SND_SEQ_PORT_CAP_SYNC_WRITE (1<<3) /**< allow write subscriptions */218219#define SND_SEQ_PORT_CAP_DUPLEX (1<<4) /**< allow read/write duplex */220221#define SND_SEQ_PORT_CAP_SUBS_READ (1<<5) /**< allow read subscription */222#define SND_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /**< allow write subscription */223#define SND_SEQ_PORT_CAP_NO_EXPORT (1<<7) /**< routing not allowed */224225/* port type */226/** Messages sent from/to this port have device-specific semantics. */227#define SND_SEQ_PORT_TYPE_SPECIFIC (1<<0)228/** This port understands MIDI messages. */229#define SND_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)230/** This port is compatible with the General MIDI specification. */231#define SND_SEQ_PORT_TYPE_MIDI_GM (1<<2)232/** This port is compatible with the Roland GS standard. */233#define SND_SEQ_PORT_TYPE_MIDI_GS (1<<3)234/** This port is compatible with the Yamaha XG specification. */235#define SND_SEQ_PORT_TYPE_MIDI_XG (1<<4)236/** This port is compatible with the Roland MT-32. */237#define SND_SEQ_PORT_TYPE_MIDI_MT32 (1<<5)238/** This port is compatible with the General MIDI 2 specification. */239#define SND_SEQ_PORT_TYPE_MIDI_GM2 (1<<6)240/** This port understands SND_SEQ_EVENT_SAMPLE_xxx messages241(these are not MIDI messages). */242#define SND_SEQ_PORT_TYPE_SYNTH (1<<10)243/** Instruments can be downloaded to this port244(with SND_SEQ_EVENT_INSTR_xxx messages sent directly). */245#define SND_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)246/** Instruments can be downloaded to this port247(with SND_SEQ_EVENT_INSTR_xxx messages sent directly or through a queue). */248#define SND_SEQ_PORT_TYPE_SAMPLE (1<<12)249/** This port is implemented in hardware. */250#define SND_SEQ_PORT_TYPE_HARDWARE (1<<16)251/** This port is implemented in software. */252#define SND_SEQ_PORT_TYPE_SOFTWARE (1<<17)253/** Messages sent to this port will generate sounds. */254#define SND_SEQ_PORT_TYPE_SYNTHESIZER (1<<18)255/** This port may connect to other devices256(whose characteristics are not known). */257#define SND_SEQ_PORT_TYPE_PORT (1<<19)258/** This port belongs to an application, such as a sequencer or editor. */259#define SND_SEQ_PORT_TYPE_APPLICATION (1<<20)260261262size_t snd_seq_port_info_sizeof(void);263/** allocate a #snd_seq_port_info_t container on stack */264#define snd_seq_port_info_alloca(ptr) \265__snd_alloca(ptr, snd_seq_port_info)266int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr);267void snd_seq_port_info_free(snd_seq_port_info_t *ptr);268void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src);269270int snd_seq_port_info_get_client(const snd_seq_port_info_t *info);271int snd_seq_port_info_get_port(const snd_seq_port_info_t *info);272const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info);273const char *snd_seq_port_info_get_name(const snd_seq_port_info_t *info);274unsigned int snd_seq_port_info_get_capability(const snd_seq_port_info_t *info);275unsigned int snd_seq_port_info_get_type(const snd_seq_port_info_t *info);276int snd_seq_port_info_get_midi_channels(const snd_seq_port_info_t *info);277int snd_seq_port_info_get_midi_voices(const snd_seq_port_info_t *info);278int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info);279int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info);280int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info);281int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);282int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info);283int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info);284int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info);285286void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);287void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);288void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr);289void snd_seq_port_info_set_name(snd_seq_port_info_t *info, const char *name);290void snd_seq_port_info_set_capability(snd_seq_port_info_t *info, unsigned int capability);291void snd_seq_port_info_set_type(snd_seq_port_info_t *info, unsigned int type);292void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels);293void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices);294void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices);295void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);296void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable);297void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int realtime);298void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue);299300int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);301int snd_seq_delete_port(snd_seq_t *handle, int port);302int snd_seq_get_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);303int snd_seq_get_any_port_info(snd_seq_t *handle, int client, int port, snd_seq_port_info_t *info);304int snd_seq_set_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);305int snd_seq_query_next_port(snd_seq_t *handle, snd_seq_port_info_t *info);306307/** \} */308309310/**311* \defgroup SeqSubscribe Sequencer Port Subscription312* Sequencer Port Subscription313* \ingroup Sequencer314* \{315*/316317/** port subscription container */318typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t;319320size_t snd_seq_port_subscribe_sizeof(void);321/** allocate a #snd_seq_port_subscribe_t container on stack */322#define snd_seq_port_subscribe_alloca(ptr) \323__snd_alloca(ptr, snd_seq_port_subscribe)324int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr);325void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr);326void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src);327328const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info);329const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info);330int snd_seq_port_subscribe_get_queue(const snd_seq_port_subscribe_t *info);331int snd_seq_port_subscribe_get_exclusive(const snd_seq_port_subscribe_t *info);332int snd_seq_port_subscribe_get_time_update(const snd_seq_port_subscribe_t *info);333int snd_seq_port_subscribe_get_time_real(const snd_seq_port_subscribe_t *info);334335void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);336void snd_seq_port_subscribe_set_dest(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);337void snd_seq_port_subscribe_set_queue(snd_seq_port_subscribe_t *info, int q);338void snd_seq_port_subscribe_set_exclusive(snd_seq_port_subscribe_t *info, int val);339void snd_seq_port_subscribe_set_time_update(snd_seq_port_subscribe_t *info, int val);340void snd_seq_port_subscribe_set_time_real(snd_seq_port_subscribe_t *info, int val);341342int snd_seq_get_port_subscription(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);343int snd_seq_subscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);344int snd_seq_unsubscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);345346/*347*/348349/** subscription query container */350typedef struct _snd_seq_query_subscribe snd_seq_query_subscribe_t;351352/** type of query subscription */353typedef enum {354SND_SEQ_QUERY_SUBS_READ, /**< query read subscriptions */355SND_SEQ_QUERY_SUBS_WRITE /**< query write subscriptions */356} snd_seq_query_subs_type_t;357358size_t snd_seq_query_subscribe_sizeof(void);359/** allocate a #snd_seq_query_subscribe_t container on stack */360#define snd_seq_query_subscribe_alloca(ptr) \361__snd_alloca(ptr, snd_seq_query_subscribe)362int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr);363void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr);364void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src);365366int snd_seq_query_subscribe_get_client(const snd_seq_query_subscribe_t *info);367int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info);368const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info);369snd_seq_query_subs_type_t snd_seq_query_subscribe_get_type(const snd_seq_query_subscribe_t *info);370int snd_seq_query_subscribe_get_index(const snd_seq_query_subscribe_t *info);371int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info);372const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info);373int snd_seq_query_subscribe_get_queue(const snd_seq_query_subscribe_t *info);374int snd_seq_query_subscribe_get_exclusive(const snd_seq_query_subscribe_t *info);375int snd_seq_query_subscribe_get_time_update(const snd_seq_query_subscribe_t *info);376int snd_seq_query_subscribe_get_time_real(const snd_seq_query_subscribe_t *info);377378void snd_seq_query_subscribe_set_client(snd_seq_query_subscribe_t *info, int client);379void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port);380void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr);381void snd_seq_query_subscribe_set_type(snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type);382void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int _index);383384int snd_seq_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);385386/** \} */387388389/**390* \defgroup SeqQueue Sequencer Queue Interface391* Sequencer Queue Interface392* \ingroup Sequencer393* \{394*/395396/** queue information container */397typedef struct _snd_seq_queue_info snd_seq_queue_info_t;398/** queue status container */399typedef struct _snd_seq_queue_status snd_seq_queue_status_t;400/** queue tempo container */401typedef struct _snd_seq_queue_tempo snd_seq_queue_tempo_t;402/** queue timer information container */403typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t;404405/** special queue ids */406#define SND_SEQ_QUEUE_DIRECT 253 /**< direct dispatch */407408size_t snd_seq_queue_info_sizeof(void);409/** allocate a #snd_seq_queue_info_t container on stack */410#define snd_seq_queue_info_alloca(ptr) \411__snd_alloca(ptr, snd_seq_queue_info)412int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr);413void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr);414void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src);415416int snd_seq_queue_info_get_queue(const snd_seq_queue_info_t *info);417const char *snd_seq_queue_info_get_name(const snd_seq_queue_info_t *info);418int snd_seq_queue_info_get_owner(const snd_seq_queue_info_t *info);419int snd_seq_queue_info_get_locked(const snd_seq_queue_info_t *info);420unsigned int snd_seq_queue_info_get_flags(const snd_seq_queue_info_t *info);421422void snd_seq_queue_info_set_name(snd_seq_queue_info_t *info, const char *name);423void snd_seq_queue_info_set_owner(snd_seq_queue_info_t *info, int owner);424void snd_seq_queue_info_set_locked(snd_seq_queue_info_t *info, int locked);425void snd_seq_queue_info_set_flags(snd_seq_queue_info_t *info, unsigned int flags);426427int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info);428int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name);429int snd_seq_alloc_queue(snd_seq_t *handle);430int snd_seq_free_queue(snd_seq_t *handle, int q);431int snd_seq_get_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);432int snd_seq_set_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);433int snd_seq_query_named_queue(snd_seq_t *seq, const char *name);434435int snd_seq_get_queue_usage(snd_seq_t *handle, int q);436int snd_seq_set_queue_usage(snd_seq_t *handle, int q, int used);437438/*439*/440size_t snd_seq_queue_status_sizeof(void);441/** allocate a #snd_seq_queue_status_t container on stack */442#define snd_seq_queue_status_alloca(ptr) \443__snd_alloca(ptr, snd_seq_queue_status)444int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr);445void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr);446void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src);447448int snd_seq_queue_status_get_queue(const snd_seq_queue_status_t *info);449int snd_seq_queue_status_get_events(const snd_seq_queue_status_t *info);450snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t *info);451const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info);452unsigned int snd_seq_queue_status_get_status(const snd_seq_queue_status_t *info);453454int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *status);455456/*457*/458size_t snd_seq_queue_tempo_sizeof(void);459/** allocate a #snd_seq_queue_tempo_t container on stack */460#define snd_seq_queue_tempo_alloca(ptr) \461__snd_alloca(ptr, snd_seq_queue_tempo)462int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr);463void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr);464void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src);465466int snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t *info);467unsigned int snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t *info);468int snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t *info);469unsigned int snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t *info);470unsigned int snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t *info);471void snd_seq_queue_tempo_set_tempo(snd_seq_queue_tempo_t *info, unsigned int tempo);472void snd_seq_queue_tempo_set_ppq(snd_seq_queue_tempo_t *info, int ppq);473void snd_seq_queue_tempo_set_skew(snd_seq_queue_tempo_t *info, unsigned int skew);474void snd_seq_queue_tempo_set_skew_base(snd_seq_queue_tempo_t *info, unsigned int base);475476int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);477int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);478479/*480*/481482/** sequencer timer sources */483typedef enum {484SND_SEQ_TIMER_ALSA = 0, /* ALSA timer */485SND_SEQ_TIMER_MIDI_CLOCK = 1, /* Midi Clock (CLOCK event) */486SND_SEQ_TIMER_MIDI_TICK = 2 /* Midi Timer Tick (TICK event */487} snd_seq_queue_timer_type_t;488489size_t snd_seq_queue_timer_sizeof(void);490/** allocate a #snd_seq_queue_timer_t container on stack */491#define snd_seq_queue_timer_alloca(ptr) \492__snd_alloca(ptr, snd_seq_queue_timer)493int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr);494void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr);495void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src);496497int snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t *info);498snd_seq_queue_timer_type_t snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t *info);499const snd_timer_id_t *snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t *info);500unsigned int snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t *info);501502void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, snd_seq_queue_timer_type_t type);503void snd_seq_queue_timer_set_id(snd_seq_queue_timer_t *info, const snd_timer_id_t *id);504void snd_seq_queue_timer_set_resolution(snd_seq_queue_timer_t *info, unsigned int resolution);505506int snd_seq_get_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);507int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);508509/** \} */510511/**512* \defgroup SeqEvent Sequencer Event API513* Sequencer Event API514* \ingroup Sequencer515* \{516*/517518int snd_seq_free_event(snd_seq_event_t *ev);519ssize_t snd_seq_event_length(snd_seq_event_t *ev);520int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);521int snd_seq_event_output_buffer(snd_seq_t *handle, snd_seq_event_t *ev);522int snd_seq_event_output_direct(snd_seq_t *handle, snd_seq_event_t *ev);523int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);524int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer);525int snd_seq_drain_output(snd_seq_t *handle);526int snd_seq_event_output_pending(snd_seq_t *seq);527int snd_seq_extract_output(snd_seq_t *handle, snd_seq_event_t **ev);528int snd_seq_drop_output(snd_seq_t *handle);529int snd_seq_drop_output_buffer(snd_seq_t *handle);530int snd_seq_drop_input(snd_seq_t *handle);531int snd_seq_drop_input_buffer(snd_seq_t *handle);532533/** event removal conditionals */534typedef struct _snd_seq_remove_events snd_seq_remove_events_t;535536/** Remove conditional flags */537#define SND_SEQ_REMOVE_INPUT (1<<0) /**< Flush input queues */538#define SND_SEQ_REMOVE_OUTPUT (1<<1) /**< Flush output queues */539#define SND_SEQ_REMOVE_DEST (1<<2) /**< Restrict by destination q:client:port */540#define SND_SEQ_REMOVE_DEST_CHANNEL (1<<3) /**< Restrict by channel */541#define SND_SEQ_REMOVE_TIME_BEFORE (1<<4) /**< Restrict to before time */542#define SND_SEQ_REMOVE_TIME_AFTER (1<<5) /**< Restrict to time or after */543#define SND_SEQ_REMOVE_TIME_TICK (1<<6) /**< Time is in ticks */544#define SND_SEQ_REMOVE_EVENT_TYPE (1<<7) /**< Restrict to event type */545#define SND_SEQ_REMOVE_IGNORE_OFF (1<<8) /**< Do not flush off events */546#define SND_SEQ_REMOVE_TAG_MATCH (1<<9) /**< Restrict to events with given tag */547548size_t snd_seq_remove_events_sizeof(void);549/** allocate a #snd_seq_remove_events_t container on stack */550#define snd_seq_remove_events_alloca(ptr) \551__snd_alloca(ptr, snd_seq_remove_events)552int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr);553void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr);554void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src);555556unsigned int snd_seq_remove_events_get_condition(const snd_seq_remove_events_t *info);557int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info);558const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info);559const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info);560int snd_seq_remove_events_get_channel(const snd_seq_remove_events_t *info);561int snd_seq_remove_events_get_event_type(const snd_seq_remove_events_t *info);562int snd_seq_remove_events_get_tag(const snd_seq_remove_events_t *info);563564void snd_seq_remove_events_set_condition(snd_seq_remove_events_t *info, unsigned int flags);565void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue);566void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time);567void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr);568void snd_seq_remove_events_set_channel(snd_seq_remove_events_t *info, int channel);569void snd_seq_remove_events_set_event_type(snd_seq_remove_events_t *info, int type);570void snd_seq_remove_events_set_tag(snd_seq_remove_events_t *info, int tag);571572int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);573574/** \} */575576/**577* \defgroup SeqMisc Sequencer Miscellaneous578* Sequencer Miscellaneous579* \ingroup Sequencer580* \{581*/582583void snd_seq_set_bit(int nr, void *array);584void snd_seq_unset_bit(int nr, void *array);585int snd_seq_change_bit(int nr, void *array);586int snd_seq_get_bit(int nr, void *array);587588/** \} */589590591/**592* \defgroup SeqEvType Sequencer Event Type Checks593* Sequencer Event Type Checks594* \ingroup Sequencer595* \{596*/597598/* event type macros */599enum {600SND_SEQ_EVFLG_RESULT,601SND_SEQ_EVFLG_NOTE,602SND_SEQ_EVFLG_CONTROL,603SND_SEQ_EVFLG_QUEUE,604SND_SEQ_EVFLG_SYSTEM,605SND_SEQ_EVFLG_MESSAGE,606SND_SEQ_EVFLG_CONNECTION,607SND_SEQ_EVFLG_SAMPLE,608SND_SEQ_EVFLG_USERS,609SND_SEQ_EVFLG_INSTR,610SND_SEQ_EVFLG_QUOTE,611SND_SEQ_EVFLG_NONE,612SND_SEQ_EVFLG_RAW,613SND_SEQ_EVFLG_FIXED,614SND_SEQ_EVFLG_VARIABLE,615SND_SEQ_EVFLG_VARUSR616};617618enum {619SND_SEQ_EVFLG_NOTE_ONEARG,620SND_SEQ_EVFLG_NOTE_TWOARG621};622623enum {624SND_SEQ_EVFLG_QUEUE_NOARG,625SND_SEQ_EVFLG_QUEUE_TICK,626SND_SEQ_EVFLG_QUEUE_TIME,627SND_SEQ_EVFLG_QUEUE_VALUE628};629630/**631* Exported event type table632*633* This table is referred by snd_seq_ev_is_xxx.634*/635extern const unsigned int snd_seq_event_types[];636637#define _SND_SEQ_TYPE(x) (1<<(x)) /**< master type - 24bit */638#define _SND_SEQ_TYPE_OPT(x) ((x)<<24) /**< optional type - 8bit */639640/** check the event type */641#define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x))642643/** event type check: result events */644#define snd_seq_ev_is_result_type(ev) \645snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT)646/** event type check: note events */647#define snd_seq_ev_is_note_type(ev) \648snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE)649/** event type check: control events */650#define snd_seq_ev_is_control_type(ev) \651snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL)652/** event type check: channel specific events */653#define snd_seq_ev_is_channel_type(ev) \654(snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL)))655656/** event type check: queue control events */657#define snd_seq_ev_is_queue_type(ev) \658snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE)659/** event type check: system status messages */660#define snd_seq_ev_is_message_type(ev) \661snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE)662/** event type check: system status messages */663#define snd_seq_ev_is_subscribe_type(ev) \664snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION)665/** event type check: sample messages */666#define snd_seq_ev_is_sample_type(ev) \667snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE)668/** event type check: user-defined messages */669#define snd_seq_ev_is_user_type(ev) \670snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS)671/** event type check: instrument layer events */672#define snd_seq_ev_is_instr_type(ev) \673snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR)674/** event type check: fixed length events */675#define snd_seq_ev_is_fixed_type(ev) \676snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED)677/** event type check: variable length events */678#define snd_seq_ev_is_variable_type(ev) \679snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE)680/** event type check: user pointer events */681#define snd_seq_ev_is_varusr_type(ev) \682snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)683/** event type check: reserved for kernel */684#define snd_seq_ev_is_reserved(ev) \685(! snd_seq_event_types[(ev)->type])686687/**688* macros to check event flags689*/690/** prior events */691#define snd_seq_ev_is_prior(ev) \692(((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH)693694/** get the data length type */695#define snd_seq_ev_length_type(ev) \696((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK)697/** fixed length events */698#define snd_seq_ev_is_fixed(ev) \699(snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED)700/** variable length events */701#define snd_seq_ev_is_variable(ev) \702(snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE)703/** variable length on user-space */704#define snd_seq_ev_is_varusr(ev) \705(snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)706707/** time-stamp type */708#define snd_seq_ev_timestamp_type(ev) \709((ev)->flags & SND_SEQ_TIME_STAMP_MASK)710/** event is in tick time */711#define snd_seq_ev_is_tick(ev) \712(snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK)713/** event is in real-time */714#define snd_seq_ev_is_real(ev) \715(snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL)716717/** time-mode type */718#define snd_seq_ev_timemode_type(ev) \719((ev)->flags & SND_SEQ_TIME_MODE_MASK)720/** scheduled in absolute time */721#define snd_seq_ev_is_abstime(ev) \722(snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS)723/** scheduled in relative time */724#define snd_seq_ev_is_reltime(ev) \725(snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL)726727/** direct dispatched events */728#define snd_seq_ev_is_direct(ev) \729((ev)->queue == SND_SEQ_QUEUE_DIRECT)730731/** \} */732733#ifdef __cplusplus734}735#endif736737#endif /* __ALSA_SEQ_H */738739740741