📄 control.h
字号:
/** * \file include/control.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_CONTROL_H#define __ALSA_CONTROL_H#ifdef __cplusplusextern "C" {#endif/** * \defgroup Control Control Interface * The control interface. * See \ref control page for more details. * \{ *//** dlsym version for interface entry callback */#define SND_CONTROL_DLSYM_VERSION _dlsym_control_001/** IEC958 structure */typedef struct snd_aes_iec958 { unsigned char status[24]; /**< AES/IEC958 channel status bits */ unsigned char subcode[147]; /**< AES/IEC958 subcode bits */ unsigned char pad; /**< nothing */ unsigned char dig_subframe[4]; /**< AES/IEC958 subframe bits */} snd_aes_iec958_t;/** CTL card info container */typedef struct _snd_ctl_card_info snd_ctl_card_info_t;/** CTL element identifier container */typedef struct _snd_ctl_elem_id snd_ctl_elem_id_t;/** CTL element identifier list container */typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t;/** CTL element info container */typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t;/** CTL element value container */typedef struct _snd_ctl_elem_value snd_ctl_elem_value_t;/** CTL event container */typedef struct _snd_ctl_event snd_ctl_event_t;/** CTL element type */typedef enum _snd_ctl_elem_type { /** Invalid type */ SND_CTL_ELEM_TYPE_NONE = 0, /** Boolean contents */ SND_CTL_ELEM_TYPE_BOOLEAN, /** Integer contents */ SND_CTL_ELEM_TYPE_INTEGER, /** Enumerated contents */ SND_CTL_ELEM_TYPE_ENUMERATED, /** Bytes contents */ SND_CTL_ELEM_TYPE_BYTES, /** IEC958 (S/PDIF) setting content */ SND_CTL_ELEM_TYPE_IEC958, /** 64-bit integer contents */ SND_CTL_ELEM_TYPE_INTEGER64, SND_CTL_ELEM_TYPE_LAST = SND_CTL_ELEM_TYPE_INTEGER64} snd_ctl_elem_type_t;/** CTL related interface */typedef enum _snd_ctl_elem_iface { /** Card level */ SND_CTL_ELEM_IFACE_CARD = 0, /** Hardware dependent device */ SND_CTL_ELEM_IFACE_HWDEP, /** Mixer */ SND_CTL_ELEM_IFACE_MIXER, /** PCM */ SND_CTL_ELEM_IFACE_PCM, /** RawMidi */ SND_CTL_ELEM_IFACE_RAWMIDI, /** Timer */ SND_CTL_ELEM_IFACE_TIMER, /** Sequencer */ SND_CTL_ELEM_IFACE_SEQUENCER, SND_CTL_ELEM_IFACE_LAST = SND_CTL_ELEM_IFACE_SEQUENCER} snd_ctl_elem_iface_t;/** Event class */typedef enum _snd_ctl_event_type { /** Elements related event */ SND_CTL_EVENT_ELEM = 0, SND_CTL_EVENT_LAST = SND_CTL_EVENT_ELEM}snd_ctl_event_type_t;/** Element has been removed (Warning: test this first and if set don't * test the other masks) \hideinitializer */#define SND_CTL_EVENT_MASK_REMOVE (~0U)/** Element value has been changed \hideinitializer */#define SND_CTL_EVENT_MASK_VALUE (1<<0)/** Element info has been changed \hideinitializer */#define SND_CTL_EVENT_MASK_INFO (1<<1)/** Element has been added \hideinitializer */#define SND_CTL_EVENT_MASK_ADD (1<<2)/** Element's TLV value has been changed \hideinitializer */#define SND_CTL_EVENT_MASK_TLV (1<<3)/** CTL name helper */#define SND_CTL_NAME_NONE ""/** CTL name helper */#define SND_CTL_NAME_PLAYBACK "Playback "/** CTL name helper */#define SND_CTL_NAME_CAPTURE "Capture "/** CTL name helper */#define SND_CTL_NAME_IEC958_NONE ""/** CTL name helper */#define SND_CTL_NAME_IEC958_SWITCH "Switch"/** CTL name helper */#define SND_CTL_NAME_IEC958_VOLUME "Volume"/** CTL name helper */#define SND_CTL_NAME_IEC958_DEFAULT "Default"/** CTL name helper */#define SND_CTL_NAME_IEC958_MASK "Mask"/** CTL name helper */#define SND_CTL_NAME_IEC958_CON_MASK "Con Mask"/** CTL name helper */#define SND_CTL_NAME_IEC958_PRO_MASK "Pro Mask"/** CTL name helper */#define SND_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"/** Element name for IEC958 (S/PDIF) */#define SND_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SND_CTL_NAME_##direction SND_CTL_NAME_IEC958_##what/** Mask for the major Power State identifier */#define SND_CTL_POWER_MASK 0xff00/** ACPI/PCI Power State D0 */#define SND_CTL_POWER_D0 0x0000/** ACPI/PCI Power State D1 */#define SND_CTL_POWER_D1 0x0100/** ACPI/PCI Power State D2 */#define SND_CTL_POWER_D2 0x0200/** ACPI/PCI Power State D3 */#define SND_CTL_POWER_D3 0x0300/** ACPI/PCI Power State D3hot */#define SND_CTL_POWER_D3hot (SND_CTL_POWER_D3|0x0000)/** ACPI/PCI Power State D3cold */#define SND_CTL_POWER_D3cold (SND_CTL_POWER_D3|0x0001)/** TLV type - Container */#define SND_CTL_TLVT_CONTAINER 0x0000/** TLV type - basic dB scale */#define SND_CTL_TLVT_DB_SCALE 0x0001/** TLV type - linear volume */#define SND_CTL_TLVT_DB_LINEAR 0x0002/** TLV type - dB range container */#define SND_CTL_TLVT_DB_RANGE 0x0003/** Mute state */#define SND_CTL_TLV_DB_GAIN_MUTE -9999999/** CTL type */typedef enum _snd_ctl_type { /** Kernel level CTL */ SND_CTL_TYPE_HW, /** Shared memory client CTL */ SND_CTL_TYPE_SHM, /** INET client CTL (not yet implemented) */ SND_CTL_TYPE_INET, /** External control plugin */ SND_CTL_TYPE_EXT} snd_ctl_type_t;/** Non blocking mode (flag for open mode) \hideinitializer */#define SND_CTL_NONBLOCK 0x0001/** Async notification (flag for open mode) \hideinitializer */#define SND_CTL_ASYNC 0x0002/** Read only (flag for open mode) \hideinitializer */#define SND_CTL_READONLY 0x0004/** CTL handle */typedef struct _snd_ctl snd_ctl_t;/** Don't destroy the ctl handle when close */#define SND_SCTL_NOFREE 0x0001/** SCTL type */typedef struct _snd_sctl snd_sctl_t;int snd_card_load(int card);int snd_card_next(int *card);int snd_card_get_index(const char *name);int snd_card_get_name(int card, char **name);int snd_card_get_longname(int card, char **name);int snd_device_name_hint(int card, const char *iface, void ***hints);int snd_device_name_free_hint(void **hints);char *snd_device_name_get_hint(const void *hint, const char *id);int snd_ctl_open(snd_ctl_t **ctl, const char *name, int mode);int snd_ctl_open_lconf(snd_ctl_t **ctl, const char *name, int mode, snd_config_t *lconf);int snd_ctl_close(snd_ctl_t *ctl);int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl, snd_async_callback_t callback, void *private_data);snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler);int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl);int snd_ctl_poll_descriptors(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int space);int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe);int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info);int snd_ctl_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t *list);int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info);int snd_ctl_elem_read(snd_ctl_t *ctl, snd_ctl_elem_value_t *value);int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *value);int snd_ctl_elem_lock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);int snd_ctl_elem_unlock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);int snd_ctl_elem_tlv_read(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int *tlv, unsigned int tlv_size);int snd_ctl_elem_tlv_write(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, const unsigned int *tlv);int snd_ctl_elem_tlv_command(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, const unsigned int *tlv);int snd_ctl_hwdep_next_device(snd_ctl_t *ctl, int * device);int snd_ctl_hwdep_info(snd_ctl_t *ctl, snd_hwdep_info_t * info);int snd_ctl_pcm_next_device(snd_ctl_t *ctl, int *device);int snd_ctl_pcm_info(snd_ctl_t *ctl, snd_pcm_info_t * info);int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev);int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device);int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info);int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev);int snd_ctl_set_power_state(snd_ctl_t *ctl, unsigned int state);int snd_ctl_get_power_state(snd_ctl_t *ctl, unsigned int *state);int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_event_t *event);int snd_ctl_wait(snd_ctl_t *ctl, int timeout);const char *snd_ctl_name(snd_ctl_t *ctl);snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);const char *snd_ctl_elem_type_name(snd_ctl_elem_type_t type);const char *snd_ctl_elem_iface_name(snd_ctl_elem_iface_t iface);const char *snd_ctl_event_type_name(snd_ctl_event_type_t type);unsigned int snd_ctl_event_elem_get_mask(const snd_ctl_event_t *obj);unsigned int snd_ctl_event_elem_get_numid(const snd_ctl_event_t *obj);void snd_ctl_event_elem_get_id(const snd_ctl_event_t *obj, snd_ctl_elem_id_t *ptr);snd_ctl_elem_iface_t snd_ctl_event_elem_get_interface(const snd_ctl_event_t *obj);unsigned int snd_ctl_event_elem_get_device(const snd_ctl_event_t *obj);unsigned int snd_ctl_event_elem_get_subdevice(const snd_ctl_event_t *obj);const char *snd_ctl_event_elem_get_name(const snd_ctl_event_t *obj);unsigned int snd_ctl_event_elem_get_index(const snd_ctl_event_t *obj);int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries);void snd_ctl_elem_list_free_space(snd_ctl_elem_list_t *obj);size_t snd_ctl_elem_id_sizeof(void);/** \hideinitializer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -