#include <asr_online.h>
|
static size_t | writefunc (void *ptr, size_t size, size_t nmemb, char **result) |
| libcurl 返回回调函数. More...
|
|
百度在线语音识别模块
Definition at line 38 of file asr_online.h.
struct DataBuff BaiduAsrOnline::getOneChannelData |
( |
| ) |
|
|
private |
void BaiduAsrOnline::getPCMData |
( |
struct DataBuff |
pcm_buff | ) |
|
获取pcm数据接口.
- Parameters
-
pcm_buff | - [in] pcm数据的内容和数据大小. |
Definition at line 158 of file asr_online.cpp.
void BaiduAsrOnline::getPcmFileData |
( |
| ) |
|
读取pcm文件里的音频数据,并将数据的内容和数据大小存入pcm_data_结构体.
Definition at line 83 of file asr_online.cpp.
void BaiduAsrOnline::initAndConfigAsr |
( |
| ) |
|
void BaiduAsrOnline::praseToken |
( |
| ) |
|
|
private |
struct DataBuff BaiduAsrOnline::recordThroughMIC |
( |
const float |
record_time, |
|
|
bool |
enable_audio_save |
|
) |
| |
录音接口.
- Parameters
-
record_time | - [in] 录音时长(s). |
enable_audio_save | - [in] 是否将录音保存到pcm文件. |
- Returns
- struct DataBuff pcm_data_ - 返回录音的pcm数据和大小.
Definition at line 187 of file asr_online.cpp.
std::string BaiduAsrOnline::resultFromJson |
( |
| ) |
|
从完整的json语音识别结果中解析出需要的字符串结果.
- Returns
- std::string online_final_result - 返回解析出的字符串识别结果.
Definition at line 241 of file asr_online.cpp.
char * BaiduAsrOnline::runAsrAndRecog |
( |
| ) |
|
将pcm_data_结构体里存储的音频用于百度在线语音识别并获取识别结果.
- Returns
- char* rec_result_ - 返回在线语音识别的完整json结果.
Definition at line 88 of file asr_online.cpp.
void BaiduAsrOnline::saveRecordDataToFile |
( |
| ) |
|
|
private |
把录音数据存入/cache/pcm/目录下的pcm文件里,以次序和时间命名.
Definition at line 178 of file asr_online.cpp.
void BaiduAsrOnline::setAsrParams |
( |
const std::string |
base_path, |
|
|
const std::string |
pcm_file, |
|
|
const int |
channel |
|
) |
| |
设置语音模块需外部传入的路径等参数.
- Parameters
-
base_path | - [in] 到/xbot_talker目录的结对路径. |
pcm_file | - [in] 用于进行语音识别的录音文件. |
channel | - [in] 音频声道数.1表示单声道,2表示双声道. |
Definition at line 28 of file asr_online.cpp.
void BaiduAsrOnline::speechGetToken |
( |
| ) |
|
void BaiduAsrOnline::stopRecordThroughMIC |
( |
| ) |
|
void BaiduAsrOnline::uninitAsr |
( |
| ) |
|
size_t BaiduAsrOnline::writefunc |
( |
void * |
ptr, |
|
|
size_t |
size, |
|
|
size_t |
nmemb, |
|
|
char ** |
result |
|
) |
| |
|
staticprivate |
const std::string BaiduAsrOnline::API_TOKEN_URL = "http://openapi.baidu.com/oauth/2.0/token" |
|
private |
struct recorder* BaiduAsrOnline::asr_record_ = NULL |
|
private |
std::string BaiduAsrOnline::base_path_ |
|
private |
int BaiduAsrOnline::channel_ |
|
private |
std::string BaiduAsrOnline::online_final_result |
|
private |
struct DataBuff BaiduAsrOnline::pcm_data_ = { NULL, 0 } |
|
private |
std::string BaiduAsrOnline::pcm_file_ |
|
private |
char* BaiduAsrOnline::rec_result_ = NULL |
|
private |
int BaiduAsrOnline::record_loops_ = 0 |
|
private |
std::string BaiduAsrOnline::token_ |
|
private |
char* BaiduAsrOnline::url_response_ = NULL |
|
private |
The documentation for this class was generated from the following files: