Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
AwakenOffline Class Reference

#include <awaken_offline.h>

Public Member Functions

void awakenInit ()
 科大讯飞离线唤醒模块的初始化. More...
 
void checkIsAwaken ()
 检测是否唤醒. More...
 
void dataLoopAwaken ()
 将音频数据循环写入科大讯飞接口进行离线唤醒. More...
 
void getPcmFileData ()
 读取pcm文件里的音频数据,并将数据的内容和数据大小存入pcm_data_结构体. More...
 
void loginAndSetParams (const std::string base_path, const std::string pcm_file, const int channel)
 科大讯飞离线唤醒登录以及参数设置. More...
 
void recordThroughMIC (const float record_time, bool enable_audio_save)
 录音并进行语音唤醒. More...
 
void saveRecordDataToFile ()
 把录音数据存入/cache/pcm/目录下的pcm文件里,以次序和时间命名. More...
 
void stopRecordThroughMIC ()
 关闭录音设备. More...
 
void uninitAsr ()
 一次离线唤醒结束后释放资源. More...
 
void writeAudioData (const char *audio_data, unsigned int audio_len)
 将pcm音频写入科大讯飞QIVWAudioWrite接口. More...
 

Static Public Attributes

static char * awaken_result_ = NULL
 
static bool is_awaken = false
 

Private Member Functions

struct DataBuff getOneChannelData ()
 

Static Private Member Functions

static int cb_ivw_msg_proc (const char *sessionID, int msg, int param1, int param2, const void *info, void *userData)
 

Private Attributes

int audio_stat_
 
const char * awaken_params_
 
struct recorderawaken_record_ = NULL
 
std::string base_path_
 
int channel_
 
FileOperation file_operation
 
const int FRAME_LEN = 640
 
struct DataBuff pcm_data_ = { NULL, 0 }
 
std::string pcm_file_
 
RecordAlsaAPI record_alsa
 
int record_loops_
 
const char * session_id_ = NULL
 

Detailed Description

科大讯飞离线唤醒模块接

Definition at line 13 of file awaken_offline.h.

Member Function Documentation

void AwakenOffline::awakenInit ( )

科大讯飞离线唤醒模块的初始化.

Definition at line 123 of file awaken_offline.cpp.

int AwakenOffline::cb_ivw_msg_proc ( const char *  sessionID,
int  msg,
int  param1,
int  param2,
const void *  info,
void *  userData 
)
staticprivate

Definition at line 103 of file awaken_offline.cpp.

void AwakenOffline::checkIsAwaken ( )

检测是否唤醒.

Definition at line 13 of file awaken_offline.cpp.

void AwakenOffline::dataLoopAwaken ( )

将音频数据循环写入科大讯飞接口进行离线唤醒.

Definition at line 142 of file awaken_offline.cpp.

struct DataBuff AwakenOffline::getOneChannelData ( )
private

Definition at line 65 of file awaken_offline.cpp.

void AwakenOffline::getPcmFileData ( )

读取pcm文件里的音频数据,并将数据的内容和数据大小存入pcm_data_结构体.

Definition at line 80 of file awaken_offline.cpp.

void AwakenOffline::loginAndSetParams ( 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 34 of file awaken_offline.cpp.

void AwakenOffline::recordThroughMIC ( const float  record_time,
bool  enable_audio_save 
)

录音并进行语音唤醒.

Parameters
record_time- [in] 录音时长(s).
enable_audio_save- [in] 是否将录音保存到pcm文件.

Definition at line 187 of file awaken_offline.cpp.

void AwakenOffline::saveRecordDataToFile ( )

把录音数据存入/cache/pcm/目录下的pcm文件里,以次序和时间命名.

Definition at line 178 of file awaken_offline.cpp.

void AwakenOffline::stopRecordThroughMIC ( )

关闭录音设备.

Definition at line 240 of file awaken_offline.cpp.

void AwakenOffline::uninitAsr ( )

一次离线唤醒结束后释放资源.

Definition at line 54 of file awaken_offline.cpp.

void AwakenOffline::writeAudioData ( const char *  audio_data,
unsigned int  audio_len 
)

将pcm音频写入科大讯飞QIVWAudioWrite接口.

Parameters
audio_data- [in] pcm音频数据.
audio_len- [in] pcm音频大小.

Definition at line 86 of file awaken_offline.cpp.

Member Data Documentation

int AwakenOffline::audio_stat_
private

Definition at line 93 of file awaken_offline.h.

const char* AwakenOffline::awaken_params_
private

Definition at line 88 of file awaken_offline.h.

struct recorder* AwakenOffline::awaken_record_ = NULL
private

Definition at line 94 of file awaken_offline.h.

char * AwakenOffline::awaken_result_ = NULL
static

Definition at line 83 of file awaken_offline.h.

std::string AwakenOffline::base_path_
private

Definition at line 91 of file awaken_offline.h.

int AwakenOffline::channel_
private

Definition at line 98 of file awaken_offline.h.

FileOperation AwakenOffline::file_operation
private

Definition at line 96 of file awaken_offline.h.

const int AwakenOffline::FRAME_LEN = 640
private

Definition at line 87 of file awaken_offline.h.

bool AwakenOffline::is_awaken = false
static

Definition at line 84 of file awaken_offline.h.

struct DataBuff AwakenOffline::pcm_data_ = { NULL, 0 }
private

Definition at line 89 of file awaken_offline.h.

std::string AwakenOffline::pcm_file_
private

Definition at line 90 of file awaken_offline.h.

RecordAlsaAPI AwakenOffline::record_alsa
private

Definition at line 97 of file awaken_offline.h.

int AwakenOffline::record_loops_
private

Definition at line 99 of file awaken_offline.h.

const char* AwakenOffline::session_id_ = NULL
private

Definition at line 92 of file awaken_offline.h.


The documentation for this class was generated from the following files:


xbot_talker
Author(s): wangxiaoyun
autogenerated on Sat Oct 10 2020 03:27:54