#include <xfei_speech_recog.h>
Definition at line 24 of file xfei_speech_recog.h.
XfeiSpeechRecog::XfeiSpeechRecog |
( |
| ) |
|
|
inline |
char * XfeiSpeechRecog::dataLoopRecog |
( |
| ) |
|
将全部音频数据循环写入科大讯飞接口进行识别并获取完整的json识别结果.
- Returns
- char* rec_result_ - 完整的json识别结果,若没有识别结果,返回NULL.
Definition at line 95 of file xfei_speech_recog.cpp.
struct DataBuff XfeiSpeechRecog::getOneChannelData |
( |
| ) |
|
|
private |
void XfeiSpeechRecog::getPCMData |
( |
struct DataBuff |
pcm_buff | ) |
|
void XfeiSpeechRecog::getPcmFileData |
( |
| ) |
|
char * XfeiSpeechRecog::getRecogResultLoop |
( |
| ) |
|
|
private |
获取完整的json语音识别结果.
- Returns
- char* rec_result_ - 返回语音识别的完整json结果,若没有识别结果,返回NULL.
Definition at line 52 of file xfei_speech_recog.cpp.
void XfeiSpeechRecog::initAsr |
( |
| ) |
|
struct DataBuff XfeiSpeechRecog::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 223 of file xfei_speech_recog.cpp.
std::vector< std::string > XfeiSpeechRecog::resultFromJson |
( |
| ) |
|
从完整的json语音识别结果中解析出需要的字符串结果和置信度值.
- Returns
- std::vector<std::string> recog_result_vector[2] - 返回保存识别结果和置信度值的变量.
Definition at line 178 of file xfei_speech_recog.cpp.
void XfeiSpeechRecog::saveRecordDataToFile |
( |
| ) |
|
|
private |
void XfeiSpeechRecog::setAsrParams |
( |
const std::string |
base_path, |
|
|
const std::string |
pcm_file, |
|
|
const std::string |
params, |
|
|
const int |
channel |
|
) |
| |
设置语音模块需外部传入的路径等参数.
- Parameters
-
base_path | - [in] 到/xbot_talker目录的结对路径. |
pcm_file | - [in] 用于进行语音识别的录音文件. |
params | - [in] 科大讯飞参数 |
channel | - [in] 音频声道数.1表示单声道,2表示双声道. |
Definition at line 13 of file xfei_speech_recog.cpp.
void XfeiSpeechRecog::stopRecordThroughMIC |
( |
| ) |
|
void XfeiSpeechRecog::uninitAsr |
( |
| ) |
|
void XfeiSpeechRecog::writeAudioData |
( |
const char * |
audio_data, |
|
|
unsigned int |
audio_len |
|
) |
| |
将pcm音频写入科大讯飞QISRAudioWrite接口.
- Parameters
-
audio_data | - [in] pcm音频数据. |
audio_len | - [in] pcm音频大小. |
Definition at line 40 of file xfei_speech_recog.cpp.
std::string XfeiSpeechRecog::asr_params_ |
|
private |
struct recorder* XfeiSpeechRecog::asr_record_ = NULL |
|
private |
int XfeiSpeechRecog::audio_stat_ |
|
private |
std::string XfeiSpeechRecog::base_path_ |
|
private |
int XfeiSpeechRecog::channel_ |
|
private |
std::string XfeiSpeechRecog::final_recog_result_ |
|
private |
struct DataBuff XfeiSpeechRecog::pcm_data_ = { NULL, 0 } |
|
private |
std::string XfeiSpeechRecog::pcm_file_ |
|
private |
char* XfeiSpeechRecog::rec_result_ = NULL |
|
private |
int XfeiSpeechRecog::recog_confidence_ = 0 |
|
private |
std::vector<std::string> XfeiSpeechRecog::recog_result_vector |
|
private |
int XfeiSpeechRecog::record_loops_ = 0 |
|
private |
const char* XfeiSpeechRecog::session_id_ = NULL |
|
private |
The documentation for this class was generated from the following files: