结构体 | |
struct | aos_pcm_hw_params_t |
struct | aos_pcm_sw_params_t |
struct | aos_pcm_t |
struct | hint_list_t |
宏定义 | |
#define | AOS_PCM_BLOCK 0x00000000 |
#define | AOS_PCM_NONBLOCK 0x00000001 |
#define | AOS_PCM_ASYNC 0x00000002 |
#define | AOS_PCM_ABORT 0x00008000 |
#define | AOS_PCM_NO_AUTO_RESAMPLE 0x00010000 |
#define | AOS_PCM_NO_AUTO_CHANNELS 0x00020000 |
#define | AOS_PCM_NO_AUTO_FORMAT 0x00040000 |
#define | AOS_PCM_NO_SOFTVOL 0x00080000 |
#define | AOS_PCM_EVT_WRITE (1 << 0) |
#define | AOS_PCM_EVT_READ (1 << 1) |
#define | AOS_PCM_EVT_XRUN (1 << 2) |
类型定义 | |
typedef unsigned long | aos_pcm_uframes_t |
typedef signed long | aos_pcm_sframes_t |
枚举 | |
enum | aos_pcm_stream_t { AOS_PCM_STREAM_PLAYBACK = 0 , AOS_PCM_STREAM_CAPTURE , AOS_PCM_STREAM_LAST = AOS_PCM_STREAM_CAPTURE } |
enum | aos_pcm_state_t { AOS_PCM_STATE_IDLE = 0 , AOS_PCM_STATE_OPEN , AOS_PCM_STATE_PREPARED , AOS_PCM_STATE_RUNNING , AOS_PCM_STATE_XRUN , AOS_PCM_STATE_DRAINING , AOS_PCM_STATE_PAUSED , AOS_PCM_STATE_SUSPENDED , AOS_PCM_STATE_DISCONNECTED , AOS_PCM_STATE_LAST = AOS_PCM_STATE_DISCONNECTED , AOS_PCM_STATE_PRIVATE1 = 1024 } |
enum | aos_pcm_format_t { AOSRV_PCM_FORMAT_S8 = 1 , AOSRV_PCM_FORMAT_S16_LE = 2 , AOSRV_PCM_FORMAT_S24_LE = 3 , AOSRV_PCM_FORMAT_S32_LE = 4 , AOSRV_PCM_FORMAT_ALL } |
enum | aos_pcm_access_t { AOS_PCM_ACCESS_MMAP_INTERLEAVED = 0 , AOS_PCM_ACCESS_MMAP_NONINTERLEAVED , AOS_PCM_ACCESS_RW_INTERLEAVED , AOS_PCM_ACCESS_RW_NONINTERLEAVED } |
#define AOS_PCM_ABORT 0x00008000 |
In an abort state (internal, not allowed for open)
在文件 sound_pcm.h 第 38 行定义.
#define AOS_PCM_ASYNC 0x00000002 |
Async notification (flag for open mode)
在文件 sound_pcm.h 第 37 行定义.
#define AOS_PCM_BLOCK 0x00000000 |
Blocking mode (flag for open mode)
在文件 sound_pcm.h 第 35 行定义.
#define AOS_PCM_EVT_READ (1 << 1) |
capture data available event
在文件 sound_pcm.h 第 44 行定义.
#define AOS_PCM_EVT_WRITE (1 << 0) |
playback resource available event
在文件 sound_pcm.h 第 43 行定义.
#define AOS_PCM_EVT_XRUN (1 << 2) |
underrun (playback) or overrun (capture) detected
在文件 sound_pcm.h 第 45 行定义.
#define AOS_PCM_NO_AUTO_CHANNELS 0x00020000 |
Disable automatic (but not forced!) channel conversion
在文件 sound_pcm.h 第 40 行定义.
#define AOS_PCM_NO_AUTO_FORMAT 0x00040000 |
Disable automatic (but not forced!) format conversion
在文件 sound_pcm.h 第 41 行定义.
#define AOS_PCM_NO_AUTO_RESAMPLE 0x00010000 |
Disable automatic (but not forced!) rate resamplinig
在文件 sound_pcm.h 第 39 行定义.
#define AOS_PCM_NO_SOFTVOL 0x00080000 |
Disable soft volume control
在文件 sound_pcm.h 第 42 行定义.
#define AOS_PCM_NONBLOCK 0x00000001 |
Non blocking mode (flag for open mode)
在文件 sound_pcm.h 第 36 行定义.
typedef signed long aos_pcm_sframes_t |
在文件 sound_pcm.h 第 32 行定义.
typedef unsigned long aos_pcm_uframes_t |
在文件 sound_pcm.h 第 31 行定义.
enum aos_pcm_access_t |
在文件 sound_pcm.h 第 79 行定义.
enum aos_pcm_format_t |
在文件 sound_pcm.h 第 70 行定义.
enum aos_pcm_state_t |
在文件 sound_pcm.h 第 55 行定义.
enum aos_pcm_stream_t |
枚举值 | |
---|---|
AOS_PCM_STREAM_PLAYBACK | Playback stream |
AOS_PCM_STREAM_CAPTURE | Capture stream |
AOS_PCM_STREAM_LAST |
在文件 sound_pcm.h 第 48 行定义.
int aos_device_name_hint | ( | int | card, |
void * | hints | ||
) |
获取声卡card下属所有的PCM Stream
[in] | card | 声卡ID |
[out] | hints | hint_list_t类型列表 |
aos_pcm_sframes_t aos_pcm_bytes_to_frames | ( | aos_pcm_t * | pcm, |
int | bytes | ||
) |
根据pcm stream的参数配置计算bytes个字节对应的frame帧数
[in] | <em>pcm | aos_pcm_t 类型 |
[in] | bytes | 字节数 |
int aos_pcm_close | ( | aos_pcm_t * | pcm | ) |
int aos_pcm_drain | ( | aos_pcm_t * | pcm | ) |
等待Playback PCM Stream buffer中的数据播放完成
[in] | *pcm | aos_pcm_t 句柄 |
int aos_pcm_frames_to_bytes | ( | aos_pcm_t * | pcm, |
aos_pcm_sframes_t | frames | ||
) |
根据pcm stream的参数配置计算frame帧数对应的bytes字节数
[in] | <em>pcm | aos_pcm_t 类型 |
[in] | *frames | 帧数 |
int aos_pcm_hw_params | ( | aos_pcm_t * | pcm, |
aos_pcm_hw_params_t * | p | ||
) |
设置pcm stream的硬件参数为 *p 指向的参数
[in] | <em>pcm | aos_pcm_t 类型 |
[in] | <em>p | aos_pcm_hw_params_t 类型 |
int aos_pcm_hw_params_alloca | ( | aos_pcm_hw_params_t ** | p | ) |
分配 aos_pcm_hw_params_t 类型缓存区
[out] | **p | aos_pcm_hw_params_t 类型2级指针 |
int aos_pcm_hw_params_any | ( | aos_pcm_hw_params_t * | params | ) |
设置aos_pcm_hw_params_t 类型参数为默认参数
[in] | <em>params | aos_pcm_hw_params_t 类型 |
int aos_pcm_open | ( | aos_pcm_t ** | pcm, |
const char * | name, | ||
aos_pcm_stream_t | stream, | ||
int | mode | ||
) |
获取声卡card下属所有的PCM Stream
[out] | **pcm | aos_pcm_t 句柄指针 |
[in] | *name | pcm stream name |
[in] | stream | aos_pcm_stream_t 类型 |
[in] | mode | AOS_PCM_BLOCK 或者 AOS_PCM_NONBLOCK |
int aos_pcm_pause | ( | aos_pcm_t * | pcm, |
int | enable | ||
) |
int aos_pcm_prepare | ( | aos_pcm_t * | pcm | ) |
aos_pcm_sframes_t aos_pcm_readi | ( | aos_pcm_t * | pcm, |
void * | buffer, | ||
aos_pcm_uframes_t | size | ||
) |
以interleave格式从pcm stream读数据(e.g. CH0 -> CH1 -> CH2 -> CH0 ...)
[in] | <em>pcm | aos_pcm_t 类型 |
[in] | *buffer | 存储读出数据的buffer |
[in] | *size | 待读出的数据大小,以字节为单位 |
aos_pcm_sframes_t aos_pcm_readn | ( | aos_pcm_t * | pcm, |
void ** | bufs, | ||
aos_pcm_uframes_t | size | ||
) |
以non-interleave格式从pcm stream读数据(e.g. CH0 -> CH0 ...-> CH0 (size 单位数据全部读完) -> CH1 -> CH1 ...)
[in] | <em>pcm | aos_pcm_t 类型 |
[in] | *buffer | 存储读出数据的buffer |
[in] | *size | 待读出的数据大小,以字节为单位 |
int aos_pcm_recover | ( | aos_pcm_t * | pcm | ) |
int aos_pcm_resume | ( | aos_pcm_t * | pcm | ) |
int aos_pcm_set_params | ( | aos_pcm_t * | pcm, |
aos_pcm_format_t | format, | ||
aos_pcm_access_t | access, | ||
unsigned int | channels, | ||
unsigned int | rate, | ||
int | soft_resample, | ||
unsigned int | latency | ||
) |
根据输入参数设置pcm stream的硬件参数
[in] | <em>pcm | aos_pcm_t 类型 |
[in] | format | aos_pcm_format_t 类型 |
[in] | access | aos_pcm_access_t 类型 |
[in] | channels | unsigned int 类型, 通道数 |
[in] | rate | unsigned int 类型, 采样率 |
[in] | soft_resample | int 类型 |
[in] | latency | unsigned int 类型 |
int aos_pcm_start | ( | aos_pcm_t * | pcm | ) |
int aos_pcm_stop | ( | aos_pcm_t * | pcm | ) |
int aos_pcm_suspend | ( | aos_pcm_t * | pcm | ) |
int aos_pcm_sw_params | ( | aos_pcm_t * | pcm, |
aos_pcm_sw_params_t * | params | ||
) |
设置pcm stream的软件参数为 *params 指向的参数
[in] | <em>pcm | aos_pcm_t 类型 |
[in] | <em>params | aos_pcm_sw_params_t 类型 |
int aos_pcm_sw_params_alloca | ( | aos_pcm_sw_params_t ** | p | ) |
分配 aos_pcm_sw_params_t 类型缓存区
[in] | **p | aos_pcm_sw_params_t* 类型 |
int aos_pcm_sw_params_any | ( | aos_pcm_sw_params_t * | params | ) |
设置 aos_pcm_sw_params_t 类型参数为默认参数
[in] | <em>params | aos_pcm_sw_params_t 类型 |
int aos_pcm_wait | ( | aos_pcm_t * | pcm, |
int | timeout | ||
) |
设置PCM Stream为wait状态, 最大超时时间timeout milisecond
[in] | *pcm | aos_pcm_t 句柄 |
[in] | timeout | 超时时间,毫秒为单位 |
aos_pcm_sframes_t aos_pcm_writei | ( | aos_pcm_t * | pcm, |
const void * | buffer, | ||
aos_pcm_uframes_t | size | ||
) |
以interleave格式往pcm stream写数据(e.g. CH0 -> CH1 -> CH2 -> CH0 ...)
[in] | <em>pcm | aos_pcm_t 类型 |
[in] | *buffer | 待写入的数据buffer |
[in] | *size | 待写入的数据buffer大小,以字节为单位 |
aos_pcm_sframes_t aos_pcm_writen | ( | aos_pcm_t * | pcm, |
void ** | bufs, | ||
aos_pcm_uframes_t | size | ||
) |
以non-interleave格式往pcm stream写数据(e.g. CH0 -> CH0 ...-> CH0 (size 单位数据全部写完) -> CH1 -> CH1 ...)
[in] | <em>pcm | aos_pcm_t 类型 |
[in] | *buffer | 待写入的数据buffer |
[in] | *size | 待写入的数据buffer大小,以字节为单位 |