📄 soundcard.h
字号:
* special applications such as multi track hard disk recorders to find out * the initial setup. However the user should be able to override this * selection. * * To find out which modes are actually supported the application should * try to select them using SNDCTL_DSP_CHANNELS. */# define DSP_CH_MASK 0x06000000 /* Mask */# define DSP_CH_ANY 0x00000000 /* No preferred mode */# define DSP_CH_MONO 0x02000000# define DSP_CH_STEREO 0x04000000# define DSP_CH_MULTI 0x06000000 /* More than two channels */# define DSP_CAP_SLAVE 0x08000000 /* "Slave" device */#define SNDCTL_DSP_GETTRIGGER __SIOR ('P',16, int)#define SNDCTL_DSP_SETTRIGGER __SIOW ('P',16, int)# define PCM_ENABLE_INPUT 0x00000001# define PCM_ENABLE_OUTPUT 0x00000002typedef struct count_info{ int bytes; /* Total # of bytes processed */ int blocks; /* # of fragment transitions since last time */ int ptr; /* Current DMA pointer value */}count_info;#define SNDCTL_DSP_GETIPTR __SIOR ('P',17, count_info)#define SNDCTL_DSP_GETOPTR __SIOR ('P',18, count_info)typedef struct buffmem_desc{ unsigned *buffer; int size;}buffmem_desc;#define SNDCTL_DSP_MAPINBUF __SIOR ('P', 19, buffmem_desc)#define SNDCTL_DSP_MAPOUTBUF __SIOR ('P', 20, buffmem_desc)#define SNDCTL_DSP_SETSYNCRO __SIO ('P', 21)#define SNDCTL_DSP_SETDUPLEX __SIO ('P', 22)/* * Application's profile defines the way how playback underrun situations should be handled. * * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the * playback buffer whenever an underrun occurs. This consumes some time * prevents looping the existing buffer. * APF_CPUINTENS is intended to be set by CPU intensive applications which * are likely to run out of time occasionally. In this mode the buffer cleanup is * disabled which saves CPU time but also let's the previous buffer content to * be played during the "pause" after the underrun. */#define SNDCTL_DSP_PROFILE __SIOW ('P', 23, int)#define APF_NORMAL 0 /* Normal applications */#define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */#define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */#define SNDCTL_DSP_GETODELAY __SIOR ('P', 23, int)#define SNDCTL_DSP_GETOUTVOL __SIOR ('P', 24, int)#define SNDCTL_DSP_SETOUTVOL __SIOWR('P', 24, int)typedef struct audio_errinfo{ int play_underruns; int rec_overruns; unsigned int play_ptradjust; unsigned int rec_ptradjust; int play_errorcount; int rec_errorcount; int play_lasterror; int rec_lasterror; long play_errorparm; long rec_errorparm; int filler[16];}audio_errinfo;#define SNDCTL_DSP_GETERROR __SIOR ('P', 25, audio_errinfo)typedef struct oss_digital_control{ unsigned int caps;#define DIG_CBITIN_NONE 0x00000000#define DIG_CBITIN_LIMITED 0x00000001#define DIG_CBITIN_DATA 0x00000002#define DIG_CBITIN_BYTE0 0x00000004#define DIG_CBITIN_FULL 0x00000008#define DIG_CBITIN_MASK 0x0000000f#define DIG_CBITOUT_NONE 0x00000000#define DIG_CBITOUT_LIMITED 0x00000010#define DIG_CBITOUT_BYTE0 0x00000020#define DIG_CBITOUT_FULL 0x00000040#define DIG_CBITOUT_DATA 0x00000080#define DIG_CBITOUT_MASK 0x000000f0#define DIG_UBITIN 0x00000100#define DIG_UBITOUT 0x00000200#define DIG_VBITOUT 0x00000400#define DIG_OUTRATE 0x00000800#define DIG_INRATE 0x00001000#define DIG_INBITS 0x00002000#define DIG_OUTBITS 0x00004000#define DIG_EXACT 0x00010000#define DIG_PRO 0x00020000#define DIG_CONSUMER 0x00040000#define DIG_PASSTHROUGH 0x00080000#define DIG_OUTSEL 0x00100000 unsigned int valid;#define VAL_CBITIN 0x00000001#define VAL_UBITIN 0x00000002#define VAL_CBITOUT 0x00000004#define VAL_UBITOUT 0x00000008#define VAL_ISTATUS 0x00000010#define VAL_IRATE 0x00000020#define VAL_ORATE 0x00000040#define VAL_INBITS 0x00000080#define VAL_OUTBITS 0x00000100#define VAL_REQUEST 0x00000200#define VAL_OUTSEL 0x00000400 #define VAL_OUTMASK (VAL_CBITOUT|VAL_UBITOUT|VAL_ORATE|VAL_OUTBITS|VAL_OUTSEL) unsigned int request, param;#define SPD_RQ_PASSTHROUGH 1 unsigned char cbitin[24]; unsigned char ubitin[24]; unsigned char cbitout[24]; unsigned char ubitout[24]; unsigned int outsel;#define OUTSEL_DIGITAL 1#define OUTSEL_ANALOG 2#define OUTSEL_BOTH (OUTSEL_DIGITAL|OUTSEL_ANALOG) int in_data; /* Audio/data if autodetectable by the receiver */#define IND_UNKNOWN 0#define IND_AUDIO 1#define IND_DATA 2 int in_locked; /* Receiver locked */#define LOCK_NOT_INDICATED 0#define LOCK_UNLOCKED 1#define LOCK_LOCKED 2 int in_quality; /* Input signal quality */#define IN_QUAL_NOT_INDICATED 0#define IN_QUAL_POOR 1#define IN_QUAL_GOOD 2 int in_vbit, out_vbit; /* V bits */#define VBIT_NOT_INDICATED 0#define VBIT_OFF 1#define VBIT_ON 2 unsigned int in_errors; /* Various input errro conditions */#define INERR_CRC 0x0001#define INERR_QCODE_CRC 0x0002#define INERR_PARITY 0x0004#define INERR_BIPHASE 0x0008 int srate_in, srate_out; int bits_in, bits_out; int filler[32];}oss_digital_control;#define SNDCTL_DSP_READCTL __SIOWR('P', 26, oss_digital_control)#define SNDCTL_DSP_WRITECTL __SIOWR('P', 27, oss_digital_control)typedef struct oss_syncgroup{ int id; int mode;}oss_syncgroup;#define SNDCTL_DSP_SYNCGROUP __SIOWR('P', 28, oss_syncgroup)#define SNDCTL_DSP_SYNCSTART __SIOW ('P', 29, int)/* * "cooked" mode enables software based conversions for sample rate, sample * format (bits) and number of channels (mono/stereo). These conversions are * required with some devices that support only one sample rate or just stereo * to let the applications to use other formats. The cooked mode is enabled by * default. However it's necessary to disable this mode when mmap() is used or * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_ * since normally this call will return erno=EINVAL. * * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing * anything else. Otherwise the call will not have any effect. */#define SNDCTL_DSP_COOKEDMODE __SIOW ('P', 30, int)#define SNDCTL_DSP_GETCHANNELMASK __SIOWR('P', 64, int)#define SNDCTL_DSP_BIND_CHANNEL __SIOWR('P', 65, int)# define DSP_BIND_QUERY 0x00000000# define DSP_BIND_FRONT 0x00000001# define DSP_BIND_SURR 0x00000002# define DSP_BIND_CENTER_LFE 0x00000004# define DSP_BIND_HANDSET 0x00000008# define DSP_BIND_MIC 0x00000010# define DSP_BIND_MODEM1 0x00000020# define DSP_BIND_MODEM2 0x00000040# define DSP_BIND_I2S 0x00000080# define DSP_BIND_SPDIF 0x00000100/* * SOUND_PCM_* calls are obsolete. Use the SNDCTL_DSP_ ones instead. */#define SOUND_PCM_READ_RATE __SIOR ('P', 2, int)#define SOUND_PCM_READ_CHANNELS __SIOR ('P', 6, int)#define SOUND_PCM_READ_BITS __SIOR ('P', 5, int)#define SOUND_PCM_READ_FILTER __SIOR ('P', 7, int)/* Some alias names (obsolete) */#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED#define SOUND_PCM_POST SNDCTL_DSP_POST#define SOUND_PCM_RESET SNDCTL_DSP_RESET#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF/********************************************* * IOCTL commands for /dev/mixer *//* * Mixer devices * * There can be up to 20 different analog mixer channels. The * SOUND_MIXER_NRDEVICES gives the currently supported maximum. * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells * the devices supported by the particular mixer. */#define SOUND_MIXER_NRDEVICES 28#define SOUND_MIXER_VOLUME 0#define SOUND_MIXER_BASS 1#define SOUND_MIXER_TREBLE 2#define SOUND_MIXER_SYNTH 3#define SOUND_MIXER_PCM 4#define SOUND_MIXER_SPEAKER 5#define SOUND_MIXER_LINE 6#define SOUND_MIXER_MIC 7#define SOUND_MIXER_CD 8#define SOUND_MIXER_IMIX 9 /* Recording monitor */#define SOUND_MIXER_ALTPCM 10#define SOUND_MIXER_RECLEV 11 /* Recording level */#define SOUND_MIXER_IGAIN 12 /* Input gain */#define SOUND_MIXER_OGAIN 13 /* Output gain *//* * The AD1848 codec and compatibles have three line level inputs * (line, aux1 and aux2). Since each card manufacturer have assigned * different meanings to these inputs, it's inpractical to assign * specific meanings (line, cd, synth etc.) to them. */#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */#define SOUND_MIXER_PHONEIN 20 /* Phone input */#define SOUND_MIXER_PHONEOUT 21 /* Phone output */#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */#define SOUND_MIXER_RADIO 23 /* Radio in */#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */#define SOUND_MIXER_DEPTH 25 /* 3D "depth"/"space" parameter */#define SOUND_MIXER_CENTER 26 /* 3D "center" parameter */#define SOUND_MIXER_MIDI 27 /* Alternative for "synth" *//* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) *//* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */#define SOUND_ONOFF_MIN 28#define SOUND_ONOFF_MAX 30/* Note! Number 31 cannot be used since the sign bit is reserved */#define SOUND_MIXER_NONE 31/* * The following unsupported macros are no longer functional. * Use SOUND_MIXER_PRIVATE# macros in future. */#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE#define SOUND_MIXER_MUTE SOUND_MIXER_NONE#define SOUND_MIXER_LOUD SOUND_MIXER_NONE#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor", \ "Depth", "Center", "MIDI"}#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ "line1", "line2", "line3", "dig1", "dig2", "dig3", \ "phin", "phout", "video", "radio", "monitor", \ "depth", "center", "midi"}/* Device bitmask identifiers */#define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */#define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */#define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */#define SOUND_MIXER_CAPS 0xfc# define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo *//* OSS/Free ONLY */#define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */#define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output *//* OSS/Free ONLY *//* Device mask bits */#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)#define SOUND_MASK_CD (1 << SOUND_MIXER_CD)#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -