SmartAudio/package/libs/libneteasevoice/lib/include/srcapi.h

87 lines
2.3 KiB
C

#ifndef _SRCAPI_H_
#define _SRCAPI_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _SRCParam
{
const char* URL;
const char* appKey;
const char* appSecret;
const char* cuid;
const char* severVadThresh1;
const char* severVadThresh2;
const char* timeOutResponseInMsec;
const char* timeOutSpeechInMsec;
const char* speakerId;
const char* userId;
const char* useClientVad;
} SRCParam;
enum SRC_ERROR
{
SRC_SUCCESS = 0,
SRC_HTTP_ERROR = 1,
SRC_SERVER_ERROR = 2,
SRC_SESSION_BEGIN_ERROR = 3,
};
enum VAD_STATUS
{
SRC_VAD_LOOKING_FOR_SPEECH = 0,
SRC_VAD_IN_SPEECH = 1,
SRC_VAD_END_SPEECH = 2,
SRC_VAD_TIMEOUT_RESPONSE = 3,
SRC_VAD_TIMEOUT_SPEECH = 4,
};
enum REC_STATUS
{
SRC_REC_SENT_AUDIO_SUCCESS = 1000,
SRC_REC_SENT_AUDIO_FAILED = 1001,
SRC_REC_SENT_AUDIO_END_DETECTED = 1002,
SRC_REC_SILENCE_TIME_OUT = 1010,
SRC_REC_SPEECH_TIME_OUT = 1011,
SRC_REC_RESULT_COMPLETE = 2000,
SRC_REC_TIMEOUT_SERVICE_CLOSING = 2001,
SRC_REC_TIMEOUT_SERVICE_CLOSED = 2002,
SRC_REC_RESULT_NOT_COMPLETE = 2003,
SRC_REC_NLU_SUCCESS = 3100,
SRC_REC_NLU_FAILED = 3101,
SRC_REC_RESULT_PARAM_NULL = 4001,
SRC_REC_MISS_AUTHEN_PARAM = 4002,
SRC_REC_AUTHEN_FAILURE = 4003,
SRC_REC_MISS_IDX_OR_ILLEGAL = 4004,
SRC_REC_MISS_CUID = 4005,
SRC_REC_MISS_CHANNEL = 4006,
SRC_REC_MISS_PTC_OR_ILLEGAL = 4007,
SRC_REC_MISS_RATE_OR_ILLEGAL = 4008,
SRC_REC_MISS_SESSIONID = 4009,
};
typedef void(*LogCallBackFunc)(int logLevel, const char* log, void *userData);
void SRCSetUPParam(const char* strKey, const char* strValue);
void SRCSetSPParam(const char* strKey, const char* strValue);
const char* SRCSessionBegin(SRCParam srcParam, int *error, LogCallBackFunc func, void *userData);
int SRCAudioWrite(const char* session_id, const short *audioData, unsigned int audioLen, int *vadStat, int *recStat);
const char* SRCGetResult(const char* session_id, int *server_ret);
int SRCSessionEnd(const char* session_id);
const char* SRCGetVersion();
#ifdef __cplusplus
};
#endif
#endif // _SRCAPI_H_