📄 asound.h
字号:
int frag; /* current fragment */ int count; /* number of bytes in queue/buffer */ int free; /* bytes in queue still free */ int underrun; /* count of underruns (playback) from last status */ int overrun; /* count of overruns (capture) from last status */ int overrange; /* count of ADC (capture) overrange detections from last status */ char reserved[64]; /* must be filled with zero */} snd_pcm_channel_status_t;typedef struct { volatile int status; /* RO: status - SND_PCM_STATUS_XXXX */ volatile int frag_io; /* RO: index to the fragment under I/O operation */ int frags; /* RO: fragments */ int frag_size; /* RO: fragment size */ int voices; /* RO: number of voices, -1 = interleaved */ volatile unsigned int block; /* RO: block number */ volatile unsigned int expblock; /* RW: expected block number for wakeup */ int res[9]; /* reserved */} snd_pcm_mmap_io_status_t;typedef struct { unsigned int number; /* RO: fragment number */ off_t addr; /* RO: fragment address */ int voice; /* RO: voice number, -1 = interleaved */ volatile char data; /* RW: non-zero - contains valid data */ volatile char io; /* RO: non-zero - I/O operation (don't change data) */ char res[2]; /* reserved */} snd_pcm_mmap_fragment_t;typedef struct { snd_pcm_mmap_io_status_t status; snd_pcm_mmap_fragment_t fragments[128];} snd_pcm_mmap_control_t;#define SND_PCM_IOCTL_PVERSION _IOR ('A', 0x00, int)#define SND_PCM_IOCTL_INFO _IOR ('A', 0x01, snd_pcm_info_t)#define SND_PCM_IOCTL_CHANNEL_INFO _IOR ('A', 0x02, snd_pcm_channel_info_t)#define SND_PCM_IOCTL_CHANNEL_PARAMS _IOW ('A', 0x10, snd_pcm_channel_params_t)#define SND_PCM_IOCTL_CHANNEL_SETUP _IOR ('A', 0x20, snd_pcm_channel_setup_t)#define SND_PCM_IOCTL_CHANNEL_STATUS _IOR ('A', 0x21, snd_pcm_channel_status_t)#define SND_PCM_IOCTL_CHANNEL_PREPARE _IO ('A', 0x30)#define SND_PCM_IOCTL_CHANNEL_GO _IO ('A', 0x31)#define SND_PCM_IOCTL_CHANNEL_FLUSH _IO ('A', 0x32)#define SND_PCM_IOCTL_SYNC_GO _IOW ('A', 0x33, snd_pcm_sync_t)#define SND_PCM_IOCTL_CHANNEL_DRAIN _IO ('A', 0x34)#define SND_PCM_IOCTL_CHANNEL_PAUSE _IOW ('A', 0x35, int)/* * Loopback interface */#define SND_PCM_LB_VERSION SND_PROTOCOL_VERSION(1, 0, 0)#define SND_PCM_LB_STREAM_MODE_RAW 0#define SND_PCM_LB_STREAM_MODE_PACKET 1#define SND_PCM_LB_TYPE_DATA 0 /* sample data */#define SND_PCM_LB_TYPE_FORMAT 1 /* format change */#define SND_PCM_LB_TYPE_POSITION 2 /* position change (in bytes) */#define SND_PCM_LB_TYPE_SILENCE 3 /* silence (no data) */typedef struct snd_pcm_loopback_header { int size; /* block size in bytes */ int type; /* block type (SND_PCM_LB_TYPE_*) */} snd_pcm_loopback_header_t;typedef struct snd_pcm_loopback_status { snd_pcm_channel_status_t status; /* channel status */ unsigned int lost; /* bytes lost */} snd_pcm_loopback_status_t;#define SND_PCM_LB_IOCTL_PVERSION _IOR ('L', 0x00, int)#define SND_PCM_LB_IOCTL_STREAM_MODE _IOW ('L', 0x01, int)#define SND_PCM_LB_IOCTL_FORMAT _IOR ('L', 0x02, snd_pcm_format_t)#define SND_PCM_LB_IOCTL_STATUS _IOR ('L', 0x03, snd_pcm_loopback_status_t)/* * Interface compatible with Open Sound System API */#ifdef __SND_OSS_COMPAT__#define SND_PCM_AFMT_QUERY 0#define SND_PCM_AFMT_MU_LAW (1<<0)#define SND_PCM_AFMT_A_LAW (1<<1)#define SND_PCM_AFMT_IMA_ADPCM (1<<2)#define SND_PCM_AFMT_U8 (1<<3)#define SND_PCM_AFMT_S16_LE (1<<4)#define SND_PCM_AFMT_S16_BE (1<<5)#define SND_PCM_AFMT_S8 (1<<6)#define SND_PCM_AFMT_U16_LE (1<<7)#define SND_PCM_AFMT_U16_BE (1<<8)#define SND_PCM_AFMT_MPEG (1<<9)#define SND_PCM_ENABLE_CAPTURE 0x00000001#define SND_PCM_ENABLE_PLAYBACK 0x00000002#define SND_PCM_CAP_REVISION 0x000000ff#define SND_PCM_CAP_DUPLEX 0x00000100#define SND_PCM_CAP_REALTIME 0x00000200#define SND_PCM_CAP_BATCH 0x00000400#define SND_PCM_CAP_COPROC 0x00000800#define SND_PCM_CAP_TRIGGER 0x00001000#define SND_PCM_CAP_MMAP 0x00002000#define SND_PCM_AFP_NORMAL 0#define SND_PCM_AFP_NETWORK 1#define SND_PCM_AFP_CPUINTENS 2struct snd_pcm_buffer_info { int fragments; /* # of available fragments (partially used ones not counted) */ int fragstotal; /* Total # of fragments allocated */ int fragsize; /* Size of a fragment in bytes */ int bytes; /* Available space in bytes (includes partially used fragments) */};struct snd_pcm_count_info { int bytes; /* Total # of bytes processed */ int blocks; /* # of fragment transitions since last time */ int ptr; /* Current DMA pointer value */};struct snd_pcm_buffer_description { unsigned char *buffer; int size;};#define SND_PCM_IOCTL_OSS_RESET _IO ('P', 0)#define SND_PCM_IOCTL_OSS_SYNC _IO ('P', 1)#define SND_PCM_IOCTL_OSS_RATE _IOWR('P', 2, int)#define SND_PCM_IOCTL_OSS_GETRATE _IOR ('P', 2, int)#define SND_PCM_IOCTL_OSS_STEREO _IOWR('P', 3, int)#define SND_PCM_IOCTL_OSS_GETBLKSIZE _IOWR('P', 4, int)#define SND_PCM_IOCTL_OSS_FORMAT _IOWR('P', 5, int)#define SND_PCM_IOCTL_OSS_GETFORMAT _IOR ('P', 5, int)#define SND_PCM_IOCTL_OSS_CHANNELS _IOWR('P', 6, int)#define SND_PCM_IOCTL_OSS_GETCHANNELS _IOR ('P', 6, int)#define SND_PCM_IOCTL_OSS_FILTER _IOWR('P', 7, int)#define SND_PCM_IOCTL_OSS_GETFILTER _IOR ('P', 7, int)#define SND_PCM_IOCTL_OSS_POST _IO ('P', 8 )#define SND_PCM_IOCTL_OSS_SUBDIVIDE _IOWR('P', 9, int)#define SND_PCM_IOCTL_OSS_SETFRAGMENT _IOWR('P', 10, int)#define SND_PCM_IOCTL_OSS_GETFORMATS _IOR ('P', 11, int)#define SND_PCM_IOCTL_OSS_GETPBKSPACE _IOR ('P', 12, struct snd_pcm_buffer_info)#define SND_PCM_IOCTL_OSS_GETRECSPACE _IOR ('P', 13, struct snd_pcm_buffer_info)#define SND_PCM_IOCTL_OSS_NONBLOCK _IO ('P', 14)#define SND_PCM_IOCTL_OSS_GETCAPS _IOR ('P', 15, int)#define SND_PCM_IOCTL_OSS_GETTRIGGER _IOR ('P', 16, int)#define SND_PCM_IOCTL_OSS_SETTRIGGER _IOW ('P', 16, int)#define SND_PCM_IOCTL_OSS_GETRECPTR _IOR ('P', 17, struct snd_pcm_count_info)#define SND_PCM_IOCTL_OSS_GETPBKPTR _IOR ('P', 18, struct snd_pcm_count_info)#define SND_PCM_IOCTL_OSS_MAPRECBUFFER _IOR ('P', 19, struct snd_pcm_buffer_description)#define SND_PCM_IOCTL_OSS_MAPPBKBUFFER _IOR ('P', 20, struct snd_pcm_buffer_description)#define SND_PCM_IOCTL_OSS_SYNCRO _IO ('P', 21)#define SND_PCM_IOCTL_OSS_DUPLEX _IO ('P', 22)#define SND_PCM_IOCTL_OSS_GETODELAY _IOR ('P', 23, int)#define SND_PCM_IOCTL_OSS_PROFILE _IOW ('P', 23, int)#endif /* __SND_OSS_COMPAT__ *//***************************************************************************** * * * MIDI v1.0 interface * * * *****************************************************************************/#define SND_MIDI_CHANNELS 16#define SND_MIDI_GM_DRUM_CHANNEL (10-1)/* * MIDI commands */#define SND_MCMD_NOTE_OFF 0x80#define SND_MCMD_NOTE_ON 0x90#define SND_MCMD_NOTE_PRESSURE 0xa0#define SND_MCMD_CONTROL 0xb0#define SND_MCMD_PGM_CHANGE 0xc0#define SND_MCMD_CHANNEL_PRESSURE 0xd0#define SND_MCMD_BENDER 0xe0#define SND_MCMD_COMMON_SYSEX 0xf0#define SND_MCMD_COMMON_MTC_QUARTER 0xf1#define SND_MCMD_COMMON_SONG_POS 0xf2#define SND_MCMD_COMMON_SONG_SELECT 0xf3#define SND_MCMD_COMMON_TUNE_REQUEST 0xf6#define SND_MCMD_COMMON_SYSEX_END 0xf7#define SND_MCMD_COMMON_CLOCK 0xf8#define SND_MCMD_COMMON_START 0xfa#define SND_MCMD_COMMON_CONTINUE 0xfb#define SND_MCMD_COMMON_STOP 0xfc#define SND_MCMD_COMMON_SENSING 0xfe#define SND_MCMD_COMMON_RESET 0xff/* * MIDI controllers */#define SND_MCTL_MSB_BANK 0x00#define SND_MCTL_MSB_MODWHEEL 0x01#define SND_MCTL_MSB_BREATH 0x02#define SND_MCTL_MSB_FOOT 0x04#define SND_MCTL_MSB_PORTNAMENTO_TIME 0x05#define SND_MCTL_MSB_DATA_ENTRY 0x06#define SND_MCTL_MSB_MAIN_VOLUME 0x07#define SND_MCTL_MSB_BALANCE 0x08#define SND_MCTL_MSB_PAN 0x0a#define SND_MCTL_MSB_EXPRESSION 0x0b#define SND_MCTL_MSB_EFFECT1 0x0c#define SND_MCTL_MSB_EFFECT2 0x0d#define SND_MCTL_MSB_GENERAL_PURPOSE1 0x10#define SND_MCTL_MSB_GENERAL_PURPOSE2 0x11#define SND_MCTL_MSB_GENERAL_PURPOSE3 0x12#define SND_MCTL_MSB_GENERAL_PURPOSE4 0x13#define SND_MCTL_LSB_BANK 0x20#define SND_MCTL_LSB_MODWHEEL 0x21#define SND_MCTL_LSB_BREATH 0x22#define SND_MCTL_LSB_FOOT 0x24#define SND_MCTL_LSB_PORTNAMENTO_TIME 0x25#define SND_MCTL_LSB_DATA_ENTRY 0x26#define SND_MCTL_LSB_MAIN_VOLUME 0x27#define SND_MCTL_LSB_BALANCE 0x28#define SND_MCTL_LSB_PAN 0x2a#define SND_MCTL_LSB_EXPRESSION 0x2b#define SND_MCTL_LSB_EFFECT1 0x2c#define SND_MCTL_LSB_EFFECT2 0x2d#define SND_MCTL_LSB_GENERAL_PURPOSE1 0x30#define SND_MCTL_LSB_GENERAL_PURPOSE2 0x31#define SND_MCTL_LSB_GENERAL_PURPOSE3 0x32#define SND_MCTL_LSB_GENERAL_PURPOSE4 0x33#define SND_MCTL_SUSTAIN 0x40#define SND_MCTL_PORTAMENTO 0x41#define SND_MCTL_SUSTENUTO 0x42#define SND_MCTL_SOFT_PEDAL 0x43#define SND_MCTL_LEGATO_FOOTSWITCH 0x44#define SND_MCTL_HOLD2 0x45#define SND_MCTL_SC1_SOUND_VARIATION 0x46#define SND_MCTL_SC2_TIMBRE 0x47#define SND_MCTL_SC3_RELEASE_TIME 0x48#define SND_MCTL_SC4_ATTACK_TIME 0x49#define SND_MCTL_SC5_BRIGHTNESS 0x4a#define SND_MCTL_SC6 0x4b#define SND_MCTL_SC7 0x4c#define SND_MCTL_SC8 0x4d#define SND_MCTL_SC9 0x4e#define SND_MCTL_SC10 0x4f#define SND_MCTL_GENERAL_PURPOSE5 0x50#define SND_MCTL_GENERAL_PURPOSE6 0x51#define SND_MCTL_GENERAL_PURPOSE7 0x52#define SND_MCTL_GENERAL_PURPOSE8 0x53#define SND_MCTL_PORNAMENTO_CONTROL 0x54#define SND_MCTL_E1_REVERB_DEPTH 0x5b#define SND_MCTL_E2_TREMOLO_DEPTH 0x5c#define SND_MCTL_E3_CHORUS_DEPTH 0x5d#define SND_MCTL_E4_DETUNE_DEPTH 0x5e#define SND_MCTL_E5_PHASER_DEPTH 0x5f#define SND_MCTL_DATA_INCREMENT 0x60#define SND_MCTL_DATA_DECREMENT 0x61#define SND_MCTL_NONREG_PARM_NUM_LSB 0x62#define SND_MCTL_NONREG_PARM_NUM_MSB 0x63#define SND_MCTL_REGIST_PARM_NUM_LSB 0x64#define SND_MCTL_REGIST_PARM_NUM_MSB 0x65#define SND_MCTL_ALL_SOUNDS_OFF 0x78#define SND_MCTL_RESET_CONTROLLERS 0x79#define SND_MCTL_LOCAL_CONTROL_SWITCH 0x7a#define SND_MCTL_ALL_NOTES_OFF 0x7b#define SND_MCTL_OMNI_OFF 0x7c#define SND_MCTL_OMNI_ON 0x7d#define SND_MCTL_MONO1 0x7e#define SND_MCTL_MONO2 0x7f/* * Raw MIDI section - /dev/snd/midi?? */#define SND_RAWMIDI_VERSION SND_PROTOCOL_VERSION(1, 0, 0)#define SND_RAWMIDI_CHANNEL_OUTPUT 0#define SND_RAWMIDI_CHANNEL_INPUT 1#define SND_RAWMIDI_INFO_OUTPUT 0x00000001#define SND_RAWMIDI_INFO_INPUT 0x00000002#define SND_RAWMIDI_INFO_DUPLEX 0x00000004typedef struct snd_rawmidi_info { unsigned int type; /* soundcard type */ unsigned int flags; /* SND_RAWMIDI_INFO_XXXX */ unsigned char id[64]; /* ID of this raw midi device (user selectable) */ unsigned char name[80]; /* name of this raw midi device */ unsigned char reserved[64]; /* reserved for future use */} snd_rawmidi_info_t;typedef struct snd_rawmidi_params { int channel; /* Requested channel */ int size; /* I/O requested queue size in bytes */ int min; /* I minimum number of bytes fragments for wakeup */ int max; /* O maximum number of bytes in queue for wakeup */ int room; /* minumum number of bytes writeable for wakeup */ unsigned char reserved[16]; /* reserved for future use */} snd_rawmidi_params_t;typedef struct snd_rawmidi_status { int channel; /* Requested channel */ int size; /* I/O real queue size */ int count; /* I/O number of bytes readable/writeable without blocking */ int queue; /* O number of bytes in queue */ int pad; /* O not used yet */ int free; /* I bytes in buffer still free */ int overrun; /* I count of overruns from last status (in bytes) */ unsigned char reserved[16]; /* reserved for future use */} snd_rawmidi_status_t;#define SND_RAWMIDI_IOCTL_PVERSION _IOR ('W', 0x00, int)#define SND_RAWMIDI_IOCTL_INFO _IOR ('W', 0x01, snd_rawmidi_info_t)#define SND_RAWMIDI_IOCTL_CHANNEL_PARAMS _IOW ('W', 0x10, snd_rawmidi_params_t)#define SND_RAWMIDI_IOCTL_CHANNEL_STATUS _IOWR('W', 0x20, snd_rawmidi_status_t)#define SND_RAWMIDI_IOCTL_CHANNEL_DRAIN _IOW ('W', 0x30, int)#define SND_RAWMIDI_IOCTL_CHANNEL_FLUSH _IOW ('W', 0x31, int)/* * Timer section - /dev/snd/timer */#define SND_TIMER_VERSION SND_PROTOCOL_VERSION(1, 0, 0)#define SND_TIMER_TYPE_GLOBAL (0<<28)#define SND_TIMER_TYPE_SOUNDCARD (1<<28)#define SND_TIMER_TYPE_PCM (2<<28)#define SND_TIMER_TYPE_MAX (7<<28)/* type */#define SND_TIMER_TYPE(tmr) (((tmr) >> 28) & 0x3f)/* global number */#define SND_TIMER_GLOBAL_MAX 0x000003ff#define SND_TIMER_GLOBAL(tmr) ((tmr) & SND_TIMER_GLOBAL_MAX)#define SND_TIMER_GLOBAL_SYSTEM 0 /* system timer number *//* soundcard number */#define SND_TIMER_SOUNDCARD_CARD_MAX (SND_CARDS-1)#define SND_TIMER_SOUNDCARD_CARD_SHIFT 22#define SND_TIMER_SOUNDCARD_CARD(tmr) (((tmr) >> SND_TIMER_SOUNDCARD_CARD_SHIFT) & SND_TIMER_SOUNDCARD_CARD_MAX)#define SND_TIMER_SOUNDCARD_DEV_MAX 0x003fffff#define SND_TIMER_SOUNDCARD_DEV(tmr) ((tmr) & SND_TIMER_SOUNDCARD_DEV_MAX)#define SND_TIMER_SOUNDCARD(card,dev) (SND_TIMER_TYPE_SOUNDCARD|(((card)&SND_TIMER_SOUNDCARD_CARD_MAX)<<SND_TIMER_SOUNDCARD_CARD_SHIFT)|((dev)&SND_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -