⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asound.h

📁 unxi下共享内存的使用
💻 H
📖 第 1 页 / 共 5 页
字号:
/* *  Advanced Linux Sound Architecture - ALSA - Driver *  Copyright (c) 1994-2000 by Jaroslav Kysela <perex@suse.cz>, *                             Abramo Bagnara <abramo@alsa-project.org> * * *   This program is free software; you can redistribute it and/or modify *   it under the terms of the GNU General Public License as published by *   the Free Software Foundation; either version 2 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 General Public License for more details. * *   You should have received a copy of the GNU General Public License *   along with this program; if not, write to the Free Software *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */#ifndef __ASOUND_H#define __ASOUND_H#if defined(LINUX) || defined(__LINUX__) || defined(__linux__)#include <linux/ioctl.h>#include <endian.h>#if __BYTE_ORDER == __LITTLE_ENDIAN#define SND_LITTLE_ENDIAN#elif __BYTE_ORDER == __BIG_ENDIAN#define SND_BIG_ENDIAN#else#error "Unsupported endian..."#endif#endif#ifndef __KERNEL__#include <sys/time.h>#include <netinet/in.h>#else#include <linux/in.h>#endif/* *  protocol version */#define SND_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))#define SND_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)#define SND_PROTOCOL_MINOR(version) (((version)>>8)&0xff)#define SND_PROTOCOL_MICRO(version) ((version)&0xff)#define SND_PROTOCOL_INCOMPATIBLE(kversion, uversion) \	(SND_PROTOCOL_MAJOR(kversion) != SND_PROTOCOL_MAJOR(uversion) || \	 (SND_PROTOCOL_MAJOR(kversion) == SND_PROTOCOL_MAJOR(uversion) && \	   SND_PROTOCOL_MINOR(kversion) != SND_PROTOCOL_MINOR(uversion)))/* *  hardware independent conversion */#define snd_htoi_32(val) htonl(val)#define snd_htoi_16(val) htons(val)#define snd_itoh_32(val) ntohl(val)#define snd_itoh_16(val) ntohs(val)/* *  various limits */#define SND_CARDS			8/* *  Universal switch interface */#define SND_SW_TYPE_NONE		0	/* invalid */#define SND_SW_TYPE_BOOLEAN		1	/* 0 or 1 (enable) */#define SND_SW_TYPE_BYTE		2	/* 0 to 255 (low to high) */#define SND_SW_TYPE_WORD		3	/* 0 to 65535 (low to high) */#define SND_SW_TYPE_DWORD		4	/* 0 to 4294967296 (low to high) */#define SND_SW_TYPE_LIST		5	/* list type */#define SND_SW_TYPE_LIST_ITEM		6	/* list item */#define SND_SW_TYPE_LAST		6	/* last known */#define SND_SW_TYPE_USER_READ_ONLY	0xfffffffe /* user type - read only */#define SND_SW_TYPE_USER		0xffffffff /* user type */#define SND_SW_SUBTYPE_NONE		0	/* ignored */#define SND_SW_SUBTYPE_HEXA		1	/* hexadecimal value */#define SND_CTL_IFACE_CONTROL		0#define SND_CTL_IFACE_MIXER		1#define SND_CTL_IFACE_PCM		2#define SND_CTL_IFACE_RAWMIDI		3typedef struct snd_switch_list_item {	unsigned char name[32];} snd_switch_list_item_t;typedef struct snd_switch_list {	int iface;			/* WR: switch interface number */	int device;			/* WR: device number */	int channel;			/* WR: channel number */	int switches_size;		/* WR: size of switches in array */	int switches;			/* RO: filled switches in array */	int switches_over;		/* RO: missing switches in array */	snd_switch_list_item_t *pswitches; /* WR: pointer to list item array */	char reserved[12];} snd_switch_list_t;typedef struct snd_switch {	int iface;		/* WR: interface number */	int device;		/* WR: device number */	int channel;		/* WR: channel number */	unsigned char name[32];	/* WR: unique identification of switch (from driver) */	unsigned int type;	/* RW: look to SND_SW_TYPE_* */	unsigned int subtype;	/* RW: look to SND_SW_SUBTYPE_* */	unsigned int low;	/* RO: low range value */	unsigned int high;	/* RO: high range value */	union {		unsigned int enable: 1;		/* 0 = off, 1 = on */		unsigned char data8[32];	/* 8-bit data */		unsigned short data16[16];	/* 16-bit data */		unsigned int data32[8];		/* 32-bit data */		unsigned int item_number;	/* active list item number */		char item[32];			/* list item, low -> item number */	} value;		/* RO */	unsigned char reserved[32];} snd_switch_t; /**************************************************************************** *                                                                          * *        Section for driver control interface - /dev/snd/control?          * *                                                                          * ****************************************************************************/#define SND_CTL_VERSION			SND_PROTOCOL_VERSION(1, 0, 0)#define SND_CTL_SW_JOYSTICK		"Joystick"#define SND_CTL_SW_JOYSTICK_ADDRESS	"Joystick Address"#define SND_CTL_SW_JOYSTICK_SPEED	"Joystick Speed Compensation"typedef struct snd_ctl_hw_info {	unsigned int type;	/* type of card - look to SND_CARD_TYPE_XXXX */	unsigned int hwdepdevs;	/* count of hardware dependent devices (0 to N) */	unsigned int pcmdevs;	/* count of PCM devices (0 to N) */	unsigned int mixerdevs;	/* count of MIXER devices (0 to N) */	unsigned int mididevs;	/* count of raw MIDI devices (0 to N) */	unsigned int timerdevs;	/* count of timer devices (0 to N) */	char id[16];		/* ID of card (user selectable) */	char abbreviation[16];	/* Abbreviation for soundcard */	char name[32];		/* Short name of soundcard */	char longname[80];	/* name + info text about soundcard */	unsigned char reserved[128];	/* reserved for future */} snd_ctl_hw_info_t;#define SND_CTL_IOCTL_PVERSION		_IOR ('U', 0x00, int)#define SND_CTL_IOCTL_HW_INFO		_IOR ('U', 0x01, snd_ctl_hw_info_t)#define SND_CTL_IOCTL_SWITCH_LIST	_IOWR('U', 0x02, snd_switch_list_t)#define SND_CTL_IOCTL_SWITCH_READ	_IOWR('U', 0x03, snd_switch_t)#define SND_CTL_IOCTL_SWITCH_WRITE	_IOWR('U', 0x04, snd_switch_t)#define SND_CTL_IOCTL_HWDEP_DEVICE	_IOW ('U', 0x08, int)#define SND_CTL_IOCTL_HWDEP_INFO	_IOR ('U', 0x09, snd_hwdep_info_t)#define SND_CTL_IOCTL_MIXER_DEVICE	_IOW ('U', 0x10, int)#define SND_CTL_IOCTL_MIXER_INFO	_IOR ('U', 0x10, snd_mixer_info_t)#define SND_CTL_IOCTL_PCM_DEVICE	_IOW ('U', 0x20, int)#define SND_CTL_IOCTL_PCM_CHANNEL	_IOW ('U', 0x21, int)#define SND_CTL_IOCTL_PCM_SUBDEVICE	_IOW ('U', 0x22, int)#define SND_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x23, int)#define SND_CTL_IOCTL_PCM_INFO		_IOR ('U', 0x24, snd_pcm_info_t)#define SND_CTL_IOCTL_PCM_CHANNEL_INFO	_IOR ('U', 0x25, snd_pcm_channel_info_t)#define SND_CTL_IOCTL_RAWMIDI_DEVICE	_IOW ('U', 0x30, int)#define SND_CTL_IOCTL_RAWMIDI_CHANNEL	_IOW ('U', 0x31, int)#define SND_CTL_IOCTL_RAWMIDI_INFO	_IOR ('U', 0x32, snd_rawmidi_info_t)/* *  Read interface. */#define SND_CTL_READ_REBUILD		0	/* rebuild the whole structure */#define SND_CTL_READ_SWITCH_VALUE	1	/* the switch value was changed */#define SND_CTL_READ_SWITCH_CHANGE	2	/* the switch was changed */#define SND_CTL_READ_SWITCH_ADD		3	/* the switch was added */#define SND_CTL_READ_SWITCH_REMOVE	4	/* the switch was removed */typedef struct snd_ctl_read {	unsigned int cmd;		/* command - SND_MIXER_READ_* */	union {		struct {			int iface;	/* interface */			int device;	/* device */			int channel;	/* channel */			snd_switch_list_item_t switem; /* switch item */		} sw;		unsigned char data8[60];	} data;} snd_ctl_read_t;/**************************************************************************** *                                                                          * *        Section for driver control interface - /dev/snd/control?          * *                                                                          * ****************************************************************************/#define SND_HWDEP_VERSION		SND_PROTOCOL_VERSION(1, 0, 0)#define SND_HWDEP_TYPE_OPL2		0#define SND_HWDEP_TYPE_OPL3		1#define SND_HWDEP_TYPE_OPL4		2#define SND_HWDEP_TYPE_SB16CSP		3	/* Creative Signal Processor */#define SND_HWDEP_TYPE_EMU8000		4#define SND_HWDEP_TYPE_YSS225		5	/* Yamaha FX processor */#define SND_HWDEP_TYPE_ICS2115		6	/* Wavetable synth *//* --- */#define SND_HWDEP_TYPE_LAST		6typedef struct snd_hwdep_info {	unsigned int type;	/* type of card - look to SND_CARD_TYPE_XXXX */	unsigned char id[64];	/* ID of this hardware dependent device (user selectable) */	unsigned char name[80];	/* name of this hardware dependent device */	unsigned int hw_type;	/* hardware depedent device type */	unsigned char reserved[64];	/* reserved for future */} snd_hwdep_info_t;#define SND_HWDEP_IOCTL_PVERSION	_IOR ('H', 0x00, int)#define SND_HWDEP_IOCTL_INFO		_IOR ('H', 0x01, snd_hwdep_info_t)/**************************************************************************** *                                                                          * *                  MIXER interface - /dev/snd/mixer??                      * *                                                                          * ****************************************************************************/#define SND_MIXER_VERSION		SND_PROTOCOL_VERSION(1, 0, 0)/* inputs */				/* max 24 chars */#define SND_MIXER_IN_SYNTHESIZER	"Synth"#define SND_MIXER_IN_PCM		"PCM"#define SND_MIXER_IN_DAC		"DAC"#define SND_MIXER_IN_FM			"FM"#define SND_MIXER_IN_DSP		"DSP Input"#define SND_MIXER_IN_LINE		"Line"#define SND_MIXER_IN_MIC		"MIC"#define SND_MIXER_IN_CD			"CD"#define SND_MIXER_IN_VIDEO		"Video"#define SND_MIXER_IN_RADIO		"Radio"#define SND_MIXER_IN_PHONE		"Phone"#define SND_MIXER_IN_MONO		"Mono"#define SND_MIXER_IN_SPEAKER		"PC Speaker"#define SND_MIXER_IN_AUX		"Aux"#define SND_MIXER_IN_CENTER		"Center Input"#define SND_MIXER_IN_WOOFER		"Woofer Input"#define SND_MIXER_IN_SURROUND		"Surround Input"/* outputs */				/* max 24 chars */#define SND_MIXER_OUT_MASTER		"Master"#define SND_MIXER_OUT_MASTER_MONO	"Master Mono"#define SND_MIXER_OUT_MASTER_DIGITAL	"Master Digital"#define SND_MIXER_OUT_HEADPHONE		"Headphone"#define SND_MIXER_OUT_PHONE		"Phone Output"#define SND_MIXER_OUT_CENTER		"Center"#define SND_MIXER_OUT_WOOFER		"Woofer"#define SND_MIXER_OUT_SURROUND		"Surround"#define SND_MIXER_OUT_DSP		"DSP Output"/* groups */				/* max 24 chars */#define SND_MIXER_GRP_BASS		"Bass"#define SND_MIXER_GRP_TREBLE		"Treble"#define SND_MIXER_GRP_EQUALIZER		"Equalizer"#define SND_MIXER_GRP_FADER		"Fader"#define SND_MIXER_GRP_EFFECT		"Effect"#define SND_MIXER_GRP_EFFECT_3D		"3D Effect"#define SND_MIXER_GRP_MIC_GAIN		"Mic Gain"#define SND_MIXER_GRP_IGAIN		"Input Gain"#define SND_MIXER_GRP_OGAIN		"Output Gain"#define SND_MIXER_GRP_ANALOG_LOOPBACK	"Analog Loopback"#define SND_MIXER_GRP_DIGITAL_LOOPBACK	"Digital Loopback"/* others */#define SND_MIXER_ELEMENT_TONE_CONTROL	"Tone Control"#define SND_MIXER_ELEMENT_INPUT_MUX	"Input MUX"#define SND_MIXER_ELEMENT_DIGITAL_ACCU	"Digital Accumulator"#define SND_MIXER_ELEMENT_OUTPUT_ACCU	"Output Accumulator"#define SND_MIXER_ELEMENT_INPUT_ACCU	"Input Accumulator"#define SND_MIXER_ELEMENT_MONO_OUT_ACCU	"Mono-Out Accumulator"#define SND_MIXER_ELEMENT_MONO_IN_ACCU	"Mono-In Accumulator"#define SND_MIXER_ELEMENT_DAC		"Digital-Analog Converter"#define SND_MIXER_ELEMENT_ADC		"Analog-Digital Converter"#define SND_MIXER_ELEMENT_CAPTURE	"Capture"#define SND_MIXER_ELEMENT_PLAYBACK	"Playback"/* switches */#define SND_MIXER_SW_IEC958_OUTPUT	"IEC-958 (S/PDIF) Output"#define SND_MIXER_SW_IEC958_INPUT	"IEC-958 (S/PDIF) Input"#define SND_MIXER_SW_SIM_STEREO		"Simulated Stereo Enhancement"#define SND_MIXER_SW_LOUDNESS		"Loudness (bass boost)"/* *  element types *//* input */#define SND_MIXER_ETYPE_INPUT		0/* output */#define SND_MIXER_ETYPE_OUTPUT		1/* capture channel endpoint */#define SND_MIXER_ETYPE_CAPTURE1	2/* capture subchannel endpoint */#define SND_MIXER_ETYPE_CAPTURE2	3/* playback channel startpoint */#define SND_MIXER_ETYPE_PLAYBACK1	4/* playback subchannel startpoint */#define SND_MIXER_ETYPE_PLAYBACK2	5/* ADC */#define SND_MIXER_ETYPE_ADC		6/* DAC */#define SND_MIXER_ETYPE_DAC		7/* simple on/off switch (voices separated) */#define SND_MIXER_ETYPE_SWITCH1		100/* simple on/off switch (all voices together) */#define SND_MIXER_ETYPE_SWITCH2		101/* simple voice route switch */#define SND_MIXER_ETYPE_SWITCH3		102/* simple volume control */#define SND_MIXER_ETYPE_VOLUME1		200/* simple volume control - PCM voices to DAC */#define SND_MIXER_ETYPE_VOLUME2		201/* simple accumulator */#define SND_MIXER_ETYPE_ACCU1		300/* simple accumulator with MONO output */#define SND_MIXER_ETYPE_ACCU2		301/* simple accumulator with programmable attenuation */#define SND_MIXER_ETYPE_ACCU3		302/* simple MUX (voices separated) */#define SND_MIXER_ETYPE_MUX1		400/* simple MUX (all voices together) */#define SND_MIXER_ETYPE_MUX2		401/* simple tone control */#define SND_MIXER_ETYPE_TONE_CONTROL1	500/* equalizer */#define SND_MIXER_ETYPE_EQUALIZER1	501/* simple pan control */#define SND_MIXER_ETYPE_PAN_CONTROL1	502/* simple 3D effect */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -