📄 seq.h
字号:
/** * \file include/seq.h * \brief Application interface library for the ALSA driver * \author Jaroslav Kysela <perex@perex.cz> * \author Abramo Bagnara <abramo@alsa-project.org> * \author Takashi Iwai <tiwai@suse.de> * \date 1998-2001 *//* * Application interface library for the ALSA driver * * * 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_SEQ_H#define __ALSA_SEQ_H#ifdef __cplusplusextern "C" {#endif/** * \defgroup Sequencer MIDI Sequencer * MIDI Sequencer Interface. * See \ref seq page for more details. * \{ *//** dlsym version for interface entry callback */#define SND_SEQ_DLSYM_VERSION _dlsym_seq_001/** Sequencer handle */typedef struct _snd_seq snd_seq_t;#ifndef DOC_HIDDEN#define SND_ALLOCA(type,ptr) \do {\ assert(ptr);\ *ptr = (type##_t *)alloca(type##_sizeof());\ memset(*ptr, 0, type##_sizeof());\} while (0)#endif/** * sequencer opening stream types */#define SND_SEQ_OPEN_OUTPUT 1 /**< open for output (write) */#define SND_SEQ_OPEN_INPUT 2 /**< open for input (read) */#define SND_SEQ_OPEN_DUPLEX (SND_SEQ_OPEN_OUTPUT|SND_SEQ_OPEN_INPUT) /**< open for both input and output (read/write) *//** * sequencer opening mode */#define SND_SEQ_NONBLOCK 0x0001 /**< non-blocking mode (flag to open mode) *//** sequencer handle type */typedef enum _snd_seq_type { SND_SEQ_TYPE_HW, /**< hardware */ SND_SEQ_TYPE_SHM, /**< shared memory (NYI) */ SND_SEQ_TYPE_INET /**< network (NYI) */} snd_seq_type_t;/** special client (port) ids */#define SND_SEQ_ADDRESS_UNKNOWN 253 /**< unknown source */#define SND_SEQ_ADDRESS_SUBSCRIBERS 254 /**< send event to all subscribed ports */#define SND_SEQ_ADDRESS_BROADCAST 255 /**< send event to all queues/clients/ports/channels *//** known client numbers */#define SND_SEQ_CLIENT_SYSTEM 0 /**< system client *//* */int snd_seq_open(snd_seq_t **handle, const char *name, int streams, int mode);int snd_seq_open_lconf(snd_seq_t **handle, const char *name, int streams, int mode, snd_config_t *lconf);const char *snd_seq_name(snd_seq_t *seq);snd_seq_type_t snd_seq_type(snd_seq_t *seq);int snd_seq_close(snd_seq_t *handle);int snd_seq_poll_descriptors_count(snd_seq_t *handle, short events);int snd_seq_poll_descriptors(snd_seq_t *handle, struct pollfd *pfds, unsigned int space, short events);int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);int snd_seq_nonblock(snd_seq_t *handle, int nonblock);int snd_seq_client_id(snd_seq_t *handle);size_t snd_seq_get_output_buffer_size(snd_seq_t *handle);size_t snd_seq_get_input_buffer_size(snd_seq_t *handle);int snd_seq_set_output_buffer_size(snd_seq_t *handle, size_t size);int snd_seq_set_input_buffer_size(snd_seq_t *handle, size_t size);/** system information container */typedef struct _snd_seq_system_info snd_seq_system_info_t;size_t snd_seq_system_info_sizeof(void);/** allocate a #snd_seq_system_info_t container on stack */#define snd_seq_system_info_alloca(ptr) \ SND_ALLOCA(snd_seq_system_info, ptr)int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);void snd_seq_system_info_free(snd_seq_system_info_t *ptr);void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);int snd_seq_system_info_get_queues(const snd_seq_system_info_t *info);int snd_seq_system_info_get_clients(const snd_seq_system_info_t *info);int snd_seq_system_info_get_ports(const snd_seq_system_info_t *info);int snd_seq_system_info_get_channels(const snd_seq_system_info_t *info);int snd_seq_system_info_get_cur_clients(const snd_seq_system_info_t *info);int snd_seq_system_info_get_cur_queues(const snd_seq_system_info_t *info);int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t *info);/** \} *//** * \defgroup SeqClient Sequencer Client Interface * Sequencer Client Interface * \ingroup Sequencer * \{ *//** client information container */typedef struct _snd_seq_client_info snd_seq_client_info_t;/** client types */typedef enum snd_seq_client_type { SND_SEQ_USER_CLIENT = 1, /**< user client */ SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */} snd_seq_client_type_t; size_t snd_seq_client_info_sizeof(void);/** allocate a #snd_seq_client_info_t container on stack */#define snd_seq_client_info_alloca(ptr) \ SND_ALLOCA(snd_seq_client_info, ptr)int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);void snd_seq_client_info_free(snd_seq_client_info_t *ptr);void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);int snd_seq_client_info_get_client(const snd_seq_client_info_t *info);snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *info);const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info);int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info);int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info);const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info);int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val);void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);int snd_seq_query_next_client(snd_seq_t *handle, snd_seq_client_info_t *info);/* *//** client pool information container */typedef struct _snd_seq_client_pool snd_seq_client_pool_t;size_t snd_seq_client_pool_sizeof(void);/** allocate a #snd_seq_client_pool_t container on stack */#define snd_seq_client_pool_alloca(ptr) \ SND_ALLOCA(snd_seq_client_pool, ptr)int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);int snd_seq_client_pool_get_client(const snd_seq_client_pool_t *info);size_t snd_seq_client_pool_get_output_pool(const snd_seq_client_pool_t *info);size_t snd_seq_client_pool_get_input_pool(const snd_seq_client_pool_t *info);size_t snd_seq_client_pool_get_output_room(const snd_seq_client_pool_t *info);size_t snd_seq_client_pool_get_output_free(const snd_seq_client_pool_t *info);size_t snd_seq_client_pool_get_input_free(const snd_seq_client_pool_t *info);void snd_seq_client_pool_set_output_pool(snd_seq_client_pool_t *info, size_t size);void snd_seq_client_pool_set_input_pool(snd_seq_client_pool_t *info, size_t size);void snd_seq_client_pool_set_output_room(snd_seq_client_pool_t *info, size_t size);int snd_seq_get_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);int snd_seq_set_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);/** \} *//** * \defgroup SeqPort Sequencer Port Interface * Sequencer Port Interface * \ingroup Sequencer * \{ *//** port information container */typedef struct _snd_seq_port_info snd_seq_port_info_t;/** known port numbers */#define SND_SEQ_PORT_SYSTEM_TIMER 0 /**< system timer port */#define SND_SEQ_PORT_SYSTEM_ANNOUNCE 1 /**< system announce port *//** port capabilities (32 bits) */#define SND_SEQ_PORT_CAP_READ (1<<0) /**< readable from this port */#define SND_SEQ_PORT_CAP_WRITE (1<<1) /**< writable to this port */#define SND_SEQ_PORT_CAP_SYNC_READ (1<<2) /**< allow read subscriptions */#define SND_SEQ_PORT_CAP_SYNC_WRITE (1<<3) /**< allow write subscriptions */#define SND_SEQ_PORT_CAP_DUPLEX (1<<4) /**< allow read/write duplex */#define SND_SEQ_PORT_CAP_SUBS_READ (1<<5) /**< allow read subscription */#define SND_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /**< allow write subscription */#define SND_SEQ_PORT_CAP_NO_EXPORT (1<<7) /**< routing not allowed *//* port type *//** Messages sent from/to this port have device-specific semantics. */#define SND_SEQ_PORT_TYPE_SPECIFIC (1<<0)/** This port understands MIDI messages. */#define SND_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)/** This port is compatible with the General MIDI specification. */#define SND_SEQ_PORT_TYPE_MIDI_GM (1<<2)/** This port is compatible with the Roland GS standard. */#define SND_SEQ_PORT_TYPE_MIDI_GS (1<<3)/** This port is compatible with the Yamaha XG specification. */#define SND_SEQ_PORT_TYPE_MIDI_XG (1<<4)/** This port is compatible with the Roland MT-32. */#define SND_SEQ_PORT_TYPE_MIDI_MT32 (1<<5)/** This port is compatible with the General MIDI 2 specification. */#define SND_SEQ_PORT_TYPE_MIDI_GM2 (1<<6)/** This port understands SND_SEQ_EVENT_SAMPLE_xxx messages (these are not MIDI messages). */#define SND_SEQ_PORT_TYPE_SYNTH (1<<10)/** Instruments can be downloaded to this port (with SND_SEQ_EVENT_INSTR_xxx messages sent directly). */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -