init driver

This commit is contained in:
hehe
2025-10-11 16:26:08 +08:00
parent 190595fb51
commit 71a49410df
684 changed files with 934817 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
cmake_minimum_required(VERSION 3.16)
project(voice_control)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# 寻找依赖包
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
# 科大讯飞SDK路径配置 - 关键修改
set(XUNFEI_SDK_LIB_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/libs
)
# 添加头文件路径
include_directories(
include
${CMAKE_CURRENT_SOURCE_DIR}/include
)
# 添加库文件路径
link_directories(
${XUNFEI_SDK_LIB_DIRS}
)
# 打印库路径用于调试
message(STATUS "寻找libmsc.so的路径: ${XUNFEI_SDK_LIB_DIRS}")
# 检查libmsc.so是否存在
foreach(LIB_DIR ${XUNFEI_SDK_LIB_DIRS})
if(EXISTS "${LIB_DIR}/libmsc.so")
message(STATUS "找到libmsc.so: ${LIB_DIR}/libmsc.so")
endif()
endforeach()
add_executable(iat_publish
src/iat_publish.cpp
src/speech_recognizer.c
src/linuxrec.c
)
ament_target_dependencies(iat_publish
rclcpp
std_msgs
)
# 链接库
target_link_libraries(iat_publish
-L${XUNFEI_SDK_LIB_DIRS} # 显式指定库路径
msc # 科大讯飞主库
dl pthread m rt asound
)
# 安装可执行文件
install(TARGETS
iat_publish
DESTINATION lib/${PROJECT_NAME}
)
# 安装SDK库文件到系统能找到的地方
install(DIRECTORY ${XUNFEI_SDK_LIB_DIRS}/
DESTINATION lib
FILES_MATCHING PATTERN "*.so*"
)
install(DIRECTORY include/
DESTINATION include
)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config)
install(DIRECTORY config/
DESTINATION share/${PROJECT_NAME}/config
)
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/launch)
install(DIRECTORY launch/
DESTINATION share/${PROJECT_NAME}/launch
)
endif()
ament_export_include_directories(include)
ament_export_dependencies(rclcpp std_msgs)
ament_package()

202
voice_control/LICENSE Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,17 @@
#ifndef FORMATS_H_160601_TT
#define FORMATS_H_160601_TT 1
#ifndef WAVE_FORMAT_PCM
#define WAVE_FORMAT_PCM 1
typedef struct tWAVEFORMATEX {
unsigned short wFormatTag;
unsigned short nChannels;
unsigned int nSamplesPerSec;
unsigned int nAvgBytesPerSec;
unsigned short nBlockAlign;
unsigned short wBitsPerSample;
unsigned short cbSize;
} WAVEFORMATEX;
#endif
#endif

View File

@@ -0,0 +1,156 @@
/*
* @file
* @brief a record demo in linux
*
* a simple record code. using alsa-lib APIs.
* keep the function same as winrec.h
*
* Common steps:
* create_recorder,
* open_recorder,
* start_record,
* stop_record,
* close_recorder,
* destroy_recorder
*
* @author taozhang9
* @date 2016/06/01
*/
#ifndef __IFLY_WINREC_H__
#define __IFLY_WINREC_H__
#include "formats.h"
/* error code */
enum {
RECORD_ERR_BASE = 0,
RECORD_ERR_GENERAL,
RECORD_ERR_MEMFAIL,
RECORD_ERR_INVAL,
RECORD_ERR_NOT_READY
};
typedef struct {
union {
char * name;
int index;
void * resv;
}u;
}record_dev_id;
/* recorder object. */
struct recorder {
void (*on_data_ind)(char *data, unsigned long len, void *user_para);
void * user_cb_para;
volatile int state; /* internal record state */
void * wavein_hdl;
/* thread id may be a struct. by implementation
* void * will not be ported!! */
pthread_t rec_thread;
/*void * rec_thread_hdl;*/
void * bufheader;
unsigned int bufcount;
char *audiobuf;
int bits_per_frame;
unsigned int buffer_time;
unsigned int period_time;
size_t period_frames;
size_t buffer_frames;
};
#ifdef __cplusplus
extern "C" {
#endif /* C++ */
/**
* @fn
* @brief Get the default input device ID
*
* @return returns "default" in linux.
*
*/
record_dev_id get_default_input_dev();
/**
* @fn
* @brief Get the total number of active input devices.
* @return
*/
int get_input_dev_num();
/**
* @fn
* @brief Create a recorder object.
*
* Never call the close_recorder in the callback function. as close
* action will wait for the callback thread to quit.
*
* @return int - Return 0 in success, otherwise return error code.
* @param out_rec - [out] recorder object holder
* @param on_data_ind - [in] callback. called when data coming.
* @param user_cb_para - [in] user params for the callback.
* @see
*/
int create_recorder(struct recorder ** out_rec,
void (*on_data_ind)(char *data, unsigned long len, void *user_para),
void* user_cb_para);
/**
* @fn
* @brief Destroy recorder object. free memory.
* @param rec - [in]recorder object
*/
void destroy_recorder(struct recorder *rec);
/**
* @fn
* @brief open the device.
* @return int - Return 0 in success, otherwise return error code.
* @param rec - [in] recorder object
* @param dev - [in] device id, from 0.
* @param fmt - [in] record format.
* @see
* get_default_input_dev()
*/
int open_recorder(struct recorder * rec, record_dev_id dev, WAVEFORMATEX * fmt);
/**
* @fn
* @brief close the device.
* @param rec - [in] recorder object
*/
void close_recorder(struct recorder *rec);
/**
* @fn
* @brief start record.
* @return int - Return 0 in success, otherwise return error code.
* @param rec - [in] recorder object
*/
int start_record(struct recorder * rec);
/**
* @fn
* @brief stop record.
* @return int - Return 0 in success, otherwise return error code.
* @param rec - [in] recorder object
*/
int stop_record(struct recorder * rec);
/**
* @fn
* @brief test if the recording has been stopped.
* @return int - 1: stopped. 0 : recording.
* @param rec - [in] recorder object
*/
int is_record_stopped(struct recorder *rec);
#ifdef __cplusplus
} /* extern "C" */
#endif /* C++ */
#endif

View File

@@ -0,0 +1,282 @@
/**
* @file msp_cmn.h
* @brief Mobile Speech Platform Common Interface Header File
*
* This file contains the quick common programming interface (API) declarations
* of MSP. Developer can include this file in your project to build applications.
* For more information, please read the developer guide.
* Use of this software is subject to certain restrictions and limitations set
* forth in a license agreement entered into between iFLYTEK, Co,LTD.
* and the licensee of this software. Please refer to the license
* agreement for license use rights and restrictions.
*
* Copyright (C) 1999 - 2012 by ANHUI USTC iFLYTEK, Co,LTD.
* All rights reserved.
*
* @author Speech Dept. iFLYTEK.
* @version 1.0
* @date 2012/09/01
*
* @see
*
* History:
* index version date author notes
* 0 1.0 2012/09/01 MSC40 Create this file
*/
#ifndef __MSP_CMN_H__
#define __MSP_CMN_H__
#include "msp_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* C++ */
//#ifdef MSP_WCHAR_SUPPORT
/**
* @fn Wchar2Mbytes
* @brief wchar to mbytes
*
* User login.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const wchar_t* wcstr - [in] Null-terminated source string(wchar_t *).
* @param char* mbstr - [in] Destination string(char *).
* @param int len - [in] The maximum number of bytes that can be stored in the multibyte output string.
* @see
*/
char *Wchar2Mbytes(const wchar_t* wcstr);
/**
* @fn Mbytes2Wchar
* @brief mbytes to wchar
*
* User login.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* mbstr - [in] Null-terminated source string(char *).
* @param wchar_t* wcstr - [in] Destination string(wchar_t *).
* @param int wlen - [in] The maximum number of multibyte characters to convert.
* @see
*/
wchar_t *Mbytes2Wchar(const char *mbstr);
//#endif /*MSP_WCHAR_SUPPORT*/
/**
* @fn MSPLogin
* @brief user login interface
*
* User login.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* usr - [in] user name.
* @param const char* pwd - [in] password.
* @param const char* params - [in] parameters when user login.
* @see
*/
int MSPAPI MSPLogin(const char* usr, const char* pwd, const char* params);
typedef int (MSPAPI *Proc_MSPLogin)(const char* usr, const char* pwd, const char* params);
//#ifdef MSP_WCHAR_SUPPORT
int MSPAPI MSPLoginW(const wchar_t* usr, const wchar_t* pwd, const wchar_t* params);
typedef int (MSPAPI *Proc_MSPLoginW)(const wchar_t* usr, const wchar_t* pwd, const wchar_t* params);
//#endif/*MSP_WCHAR_SUPPORT*/
/**
* @fn MSPLogout
* @brief user logout interface
*
* User logout
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @see
*/
int MSPAPI MSPLogout();
typedef int (MSPAPI *Proc_MSPLogout)();
//#ifdef MSP_WCHAR_SUPPORT
int MSPAPI MSPLogoutW();
typedef int (MSPAPI *Proc_MSPLogoutW)();
//#endif/*MSP_WCHAR_SUPPORT*/
/**
* @fn MSPUpload
* @brief Upload User Specific Data
*
* Upload data such as user config, custom grammar, etc.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* dataName - [in] data name, should be unique to diff other data.
* @param const char* params - [in] parameters about uploading data.
* @param const char* dataID - [in] id of the data to be operated.
* @see
*/
int MSPAPI MSPUpload( const char* dataName, const char* params, const char* dataID);
typedef int (MSPAPI* Proc_MSPUpload)( const char* dataName, const char* params, const char* dataID);
/**
* @fn MSPDownload
* @brief Download User Specific Data
*
* Download data such as user config, etc.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* params - [in] parameters about data to be downloaded.
* @see
*/
typedef int (*DownloadStatusCB)(int errorCode, long param1, const void *param2, void *userData);
typedef int (*DownloadResultCB)(const void *data, long dataLen, void *userData);
int MSPAPI MSPDownload(const char* dataName, const char* params, DownloadStatusCB statusCb, DownloadResultCB resultCb, void*userData);
typedef int (MSPAPI* Proc_MSPDownload)(const char* dataName, const char* params, DownloadStatusCB statusCb, DownloadResultCB resultCb, void*userData);
int MSPAPI MSPDownloadW(const wchar_t* wdataName, const wchar_t* wparams, DownloadStatusCB statusCb, DownloadResultCB resultCb, void*userData);
typedef int (MSPAPI* Proc_MSPDownloadW) (const wchar_t* wdataName, const wchar_t* wparams, DownloadStatusCB statusCb, DownloadResultCB resultCb, void*userData);
/**
* @fn MSPAppendData
* @brief Append Data.
*
* Write data to msc, such as data to be uploaded, searching text, etc.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param void* data - [in] the data buffer pointer, data could be binary.
* @param unsigned int dataLen - [in] length of data.
* @param unsigned int dataStatus - [in] data status, 2: first or continuous, 4: last.
* @see
*/
int MSPAPI MSPAppendData(void* data, unsigned int dataLen, unsigned int dataStatus);
typedef int (MSPAPI* Proc_MSPAppendData)(void* data, unsigned int dataLen, unsigned int dataStatus);
/**
* @fn MSPGetResult
* @brief Get Result
*
* Get result of uploading, downloading or searching, etc.
*
* @return const char* MSPAPI - Return result of uploading, downloading or searching, etc.
* @param int* rsltLen - [out] Length of result returned.
* @param int* rsltStatus - [out] Status of result returned.
* @param int* errorCode - [out] Return 0 in success, otherwise return error code.
* @see
*/
const char* MSPAPI MSPGetResult(unsigned int* rsltLen, int* rsltStatus, int *errorCode);
typedef const char * (MSPAPI *Proc_MSPGetResult)(unsigned int* rsltLen, int* rsltStatus, int *errorCode);
/**
* @fn MSPSetParam
* @brief set params of msc
*
* set param of msc
*
* @return int - Return 0 if success, otherwise return errcode.
* @param const char* paramName - [in] param name.
* @param const char* paramValue - [in] param value
* @see
*/
int MSPAPI MSPSetParam( const char* paramName, const char* paramValue );
typedef int (MSPAPI *Proc_MSPSetParam)(const char* paramName, const char* paramValue);
/**
* @fn MSPGetParam
* @brief get params of msc
*
* get param of msc
*
* @return int - Return 0 if success, otherwise return errcode.
* @param const char* paramName - [in] param name.
* @param const char* paramValue - [out] param value
* @param const char* valueLen - [in/out] param value (buffer) length
* @see
*/
int MSPAPI MSPGetParam( const char *paramName, char *paramValue, unsigned int *valueLen );
typedef int (MSPAPI *Proc_MSPGetParam)( const char *paramName, char *paramValue, unsigned int *valueLen );
/**
* @fn MSPUploadData
* @brief Upload User Specific Data
*
* Upload data such as user config, custom grammar, etc.
*
* @return const char* MSPAPI - data id returned by Server, used for special command.
* @param const char* dataName - [in] data name, should be unique to diff other data.
* @param void* data - [in] the data buffer pointer, data could be binary.
* @param unsigned int dataLen - [in] length of data.
* @param const char* params - [in] parameters about uploading data.
* @param int* errorCode - [out] Return 0 in success, otherwise return error code.
* @see
*/
const char* MSPAPI MSPUploadData(const char* dataName, void* data, unsigned int dataLen, const char* params, int* errorCode);
typedef const char* (MSPAPI* Proc_MSPUploadData)(const char* dataName, void* data, unsigned int dataLen, const char* params, int* errorCode);
/**
* @fn MSPDownloadData
* @brief Download User Specific Data
*
* Download data such as user config, etc.
*
* @return const void* MSPAPI - received data buffer pointer, data could be binary, NULL if failed or data does not exsit.
* @param const char* params - [in] parameters about data to be downloaded.
* @param unsigned int* dataLen - [out] length of received data.
* @param int* errorCode - [out] Return 0 in success, otherwise return error code.
* @see
*/
const void* MSPAPI MSPDownloadData(const char* params, unsigned int* dataLen, int* errorCode);
typedef const void* (MSPAPI* Proc_MSPDownloadData)(const char* params, unsigned int* dataLen, int* errorCode);
//#ifdef MSP_WCHAR_SUPPORT
const void* MSPAPI MSPDownloadDataW(const wchar_t* params, unsigned int* dataLen, int* errorCode);
typedef const void* (MSPAPI* Proc_MSPDownloadDataW)(const wchar_t* params, unsigned int* dataLen, int* errorCode);
//#endif/*MSP_WCHAR_SUPPORT*/
/**
* @fn MSPSearch
* @brief Search text for result
*
* Search text content, and got text result
*
* @return const void* MSPAPI - received data buffer pointer, data could be binary, NULL if failed or data does not exsit.
* @param const char* params - [in] parameters about data to be downloaded.
* @param unsigned int* dataLen - [out] length of received data.
* @param int* errorCode - [out] Return 0 in success, otherwise return error code.
* @see
*/
const char* MSPAPI MSPSearch(const char* params, const char* text, unsigned int* dataLen, int* errorCode);
typedef const char* (MSPAPI* Proc_MSPSearch)(const char* params, const char* text, unsigned int* dataLen, int* errorCode);
typedef int (*NLPSearchCB)(const char *sessionID, int errorCode, int status, const void* result, long rsltLen, void *userData);
const char* MSPAPI MSPNlpSearch(const char* params, const char* text, unsigned int textLen, int *errorCode, NLPSearchCB callback, void *userData);
typedef const char* (MSPAPI* Proc_MSPNlpSearch)(const char* params, const char* text, unsigned int textLen, int *errorCode, NLPSearchCB callback, void *userData);
int MSPAPI MSPNlpSchCancel(const char *sessionID, const char *hints);
/**
* @fn MSPRegisterNotify
* @brief Register a Callback
*
* Register a Callback
*
* @return int -
* @param msp_status_ntf_handler statusCb - [in] notify handler
* @param void *userData - [in] userData
* @see
*/
typedef void ( *msp_status_ntf_handler)( int type, int status, int param1, const void *param2, void *userData );
int MSPAPI MSPRegisterNotify( msp_status_ntf_handler statusCb, void *userData );
typedef const char* (MSPAPI* Proc_MSPRegisterNotify)( msp_status_ntf_handler statusCb, void *userData );
/**
* @fn MSPGetVersion
* @brief Get version of MSC or Local Engine
*
* Get version of MSC or Local Engine
*
* @return const char * MSPAPI - Return version value if success, NULL if fail.
* @param const char *verName - [in] version name, could be "msc", "aitalk", "aisound", "ivw".
* @param int *errorCode - [out] Return 0 in success, otherwise return error code.
* @see
*/
const char* MSPAPI MSPGetVersion(const char *verName, int *errorCode);
typedef const char* (MSPAPI * Proc_MSPGetVersion)(const char *verName, int *errorCode);
#ifdef __cplusplus
} /* extern "C" */
#endif /* C++ */
#endif /* __MSP_CMN_H__ */

View File

@@ -0,0 +1,563 @@
#ifndef __MSP_ERRORS_H__
#define __MSP_ERRORS_H__
#define MSP_HTTP_ERROR(x) ((x) + MSP_ERROR_HTTP_BASE )
enum
{
MSP_SUCCESS = 0,
MSP_ERROR_FAIL = -1,
MSP_ERROR_EXCEPTION = -2,
/* General errors 10100(0x2774) */
MSP_ERROR_GENERAL = 10100, /* 0x2774 */
MSP_ERROR_OUT_OF_MEMORY = 10101, /* 0x2775 */
MSP_ERROR_FILE_NOT_FOUND = 10102, /* 0x2776 */
MSP_ERROR_NOT_SUPPORT = 10103, /* 0x2777 */
MSP_ERROR_NOT_IMPLEMENT = 10104, /* 0x2778 */
MSP_ERROR_ACCESS = 10105, /* 0x2779 */
MSP_ERROR_INVALID_PARA = 10106, /* 0x277A */ /* ȱ<>ٲ<EFBFBD><D9B2><EFBFBD> */
MSP_ERROR_INVALID_PARA_VALUE = 10107, /* 0x277B */ /* <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>ֵ */
MSP_ERROR_INVALID_HANDLE = 10108, /* 0x277C */
MSP_ERROR_INVALID_DATA = 10109, /* 0x277D */
MSP_ERROR_NO_LICENSE = 10110, /* 0x277E */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD> */
MSP_ERROR_NOT_INIT = 10111, /* 0x277F */ /* <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ʼ<EFBFBD><CABC>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_NULL_HANDLE = 10112, /* 0x2780 */
MSP_ERROR_OVERFLOW = 10113, /* 0x2781 */ /* <20><><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(10<31><30>), */
/* ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ʱ<EFBFBD><CAB1>һ<EFBFBD><D2BB><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>ע<EFBFBD><D7A2> */
MSP_ERROR_TIME_OUT = 10114, /* 0x2782 */ /* <20><>ʱ */
MSP_ERROR_OPEN_FILE = 10115, /* 0x2783 */
MSP_ERROR_NOT_FOUND = 10116, /* 0x2784 */ /* <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>ģ<EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_NO_ENOUGH_BUFFER = 10117, /* 0x2785 */
MSP_ERROR_NO_DATA = 10118, /* 0x2786 */ /* <20>ӿͻ<D3BF><CDBB>˶<EFBFBD><CBB6><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_NO_MORE_DATA = 10119, /* 0x2787 */
MSP_ERROR_NO_RESPONSE_DATA = 10120, /* 0x2788 */
MSP_ERROR_ALREADY_EXIST = 10121, /* 0x2789 */ /* <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD> */
MSP_ERROR_LOAD_MODULE = 10122, /* 0x278A */
MSP_ERROR_BUSY = 10123, /* 0x278B */
MSP_ERROR_INVALID_CONFIG = 10124, /* 0x278C */
MSP_ERROR_VERSION_CHECK = 10125, /* 0x278D */
MSP_ERROR_CANCELED = 10126, /* 0x278E */
MSP_ERROR_INVALID_MEDIA_TYPE = 10127, /* 0x278F */
MSP_ERROR_CONFIG_INITIALIZE = 10128, /* 0x2790 */
MSP_ERROR_CREATE_HANDLE = 10129, /* 0x2791 */
MSP_ERROR_CODING_LIB_NOT_LOAD = 10130, /* 0x2792 */
MSP_ERROR_USER_CANCELLED = 10131, /* 0x2793 */
MSP_ERROR_INVALID_OPERATION = 10132, /* 0x2794 */
MSP_ERROR_MESSAGE_NOT_COMPLETE = 10133, /* 0x2795 */ /* flash */
MSP_ERROR_NO_EID = 10134, /* 0x2795 */
MSP_ERROE_OVER_REQ = 10135, /* 0x2797 */ /* client Redundancy request */
MSP_ERROR_USER_ACTIVE_ABORT = 10136, /* 0x2798 */ /* user abort */
MSP_ERROR_BUSY_GRMBUILDING = 10137, /* 0x2799 */
MSP_ERROR_BUSY_LEXUPDATING = 10138, /* 0x279A */
MSP_ERROR_SESSION_RESET = 10139, /* 0x279B */ /* msc<73><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD><E1BBB0>׼<EFBFBD><D7BC><EFBFBD>ش<EFBFBD> */
MSP_ERROR_BOS_TIMEOUT = 10140, /* 0x279C */ /* VADǰ<44>˵㳬ʱ */
MSP_ERROR_STREAM_FILTER = 10141, /* 0X279D */ /* AIUI<55><49>ǰStream<61><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_STREAM_CLEAR = 10142, /* 0X279E */ /* AIUI<55><49>ǰStream<61><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
/* Error codes of network 10200(0x27D8)*/
MSP_ERROR_NET_GENERAL = 10200, /* 0x27D8 */
MSP_ERROR_NET_OPENSOCK = 10201, /* 0x27D9 */ /* Open socket */
MSP_ERROR_NET_CONNECTSOCK = 10202, /* 0x27DA */ /* Connect socket */
MSP_ERROR_NET_ACCEPTSOCK = 10203, /* 0x27DB */ /* Accept socket */
MSP_ERROR_NET_SENDSOCK = 10204, /* 0x27DC */ /* Send socket data */
MSP_ERROR_NET_RECVSOCK = 10205, /* 0x27DD */ /* Recv socket data */
MSP_ERROR_NET_INVALIDSOCK = 10206, /* 0x27DE */ /* Invalid socket handle */
MSP_ERROR_NET_BADADDRESS = 10207, /* 0x27EF */ /* Bad network address */
MSP_ERROR_NET_BINDSEQUENCE = 10208, /* 0x27E0 */ /* Bind after listen/connect */
MSP_ERROR_NET_NOTOPENSOCK = 10209, /* 0x27E1 */ /* Socket is not opened */
MSP_ERROR_NET_NOTBIND = 10210, /* 0x27E2 */ /* Socket is not bind to an address */
MSP_ERROR_NET_NOTLISTEN = 10211, /* 0x27E3 */ /* Socket is not listening */
MSP_ERROR_NET_CONNECTCLOSE = 10212, /* 0x27E4 */ /* The other side of connection is closed */
MSP_ERROR_NET_NOTDGRAMSOCK = 10213, /* 0x27E5 */ /* The socket is not datagram type */
MSP_ERROR_NET_DNS = 10214, /* 0x27E6 */ /* domain name is invalid or dns server does not function well */
MSP_ERROR_NET_INIT = 10215, /* 0x27E7 */ /* ssl ctx create failed */
/*nfl error*/
MSP_ERROR_NFL_INNER_ERROR = 10216, /* NFL inner error */
MSP_ERROR_MSS_TIME_OUT = 10217, /* MSS TIMEOUT */
MSP_ERROT_CLIENT_TIME_OUT = 10218, /* CLIENT TIMEOUT */
MSP_ERROR_CLIENT_CLOSE = 10219, /* CLIENT CLOSED CONNECTION */
MSP_ERROR_CLIENT_AREA_CHANGE = 10220,
MSP_ERROR_NET_SSL_HANDSHAKE = 10221,
MSP_ERROR_NET_INVALID_ROOT_CERT = 10222,
MSP_ERROR_NET_INVALID_CLIENT_CERT = 10223,
MSP_ERROR_NET_INVALID_SERVER_CERT = 10224,
MSP_ERROR_NET_INVALID_KEY = 10225,
MSP_ERROR_NET_CERT_VERIFY_FAILED = 10226,
MSP_ERROR_NET_WOULDBLOCK = 10227,
MSP_ERROR_NET_NOTBLOCK = 10228,
/* Error codes of mssp message 10300(0x283C) */
MSP_ERROR_MSG_GENERAL = 10300, /* 0x283C */
MSP_ERROR_MSG_PARSE_ERROR = 10301, /* 0x283D */
MSP_ERROR_MSG_BUILD_ERROR = 10302, /* 0x283E */
MSP_ERROR_MSG_PARAM_ERROR = 10303, /* 0x283F */
MSP_ERROR_MSG_CONTENT_EMPTY = 10304, /* 0x2840 */
MSP_ERROR_MSG_INVALID_CONTENT_TYPE = 10305, /* 0x2841 */
MSP_ERROR_MSG_INVALID_CONTENT_LENGTH = 10306, /* 0x2842 */
MSP_ERROR_MSG_INVALID_CONTENT_ENCODE = 10307, /* 0x2843 */
MSP_ERROR_MSG_INVALID_KEY = 10308, /* 0x2844 */
MSP_ERROR_MSG_KEY_EMPTY = 10309, /* 0x2845 */
MSP_ERROR_MSG_SESSION_ID_EMPTY = 10310, /* 0x2846 */ /* <20>ỰIDΪ<44><CEAA> */
MSP_ERROR_MSG_LOGIN_ID_EMPTY = 10311, /* 0x2847 */ /* <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>IDΪ<44><CEAA> */
MSP_ERROR_MSG_SYNC_ID_EMPTY = 10312, /* 0x2848 */
MSP_ERROR_MSG_APP_ID_EMPTY = 10313, /* 0x2849 */
MSP_ERROR_MSG_EXTERN_ID_EMPTY = 10314, /* 0x284A */
MSP_ERROR_MSG_INVALID_CMD = 10315, /* 0x284B */
MSP_ERROR_MSG_INVALID_SUBJECT = 10316, /* 0x284C */
MSP_ERROR_MSG_INVALID_VERSION = 10317, /* 0x284D */
MSP_ERROR_MSG_NO_CMD = 10318, /* 0x284E */
MSP_ERROR_MSG_NO_SUBJECT = 10319, /* 0x284F */
MSP_ERROR_MSG_NO_VERSION = 10320, /* 0x2850 */
MSP_ERROR_MSG_MSSP_EMPTY = 10321, /* 0x2851 */
MSP_ERROR_MSG_NEW_RESPONSE = 10322, /* 0x2852 */
MSP_ERROR_MSG_NEW_CONTENT = 10323, /* 0x2853 */
MSP_ERROR_MSG_INVALID_SESSION_ID = 10324, /* 0x2854 */ /* <20><>Ч<EFBFBD>ĻỰID(sid) */
MSP_ERROR_MSG_INVALID_CONTENT = 10325, /* 0x2855 */
/* Error codes of DataBase 10400(0x28A0)*/
MSP_ERROR_DB_GENERAL = 10400, /* 0x28A0 */ /* <20><><EFBFBD>ݿ<EFBFBD><DDBF>쳣 */
MSP_ERROR_DB_EXCEPTION = 10401, /* 0x28A1 */
MSP_ERROR_DB_NO_RESULT = 10402, /* 0x28A2 */ /* redis<69><73>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD><D2B5>ỰID(sid) */
MSP_ERROR_DB_INVALID_USER = 10403, /* 0x28A3 */
MSP_ERROR_DB_INVALID_PWD = 10404, /* 0x28A4 */
MSP_ERROR_DB_CONNECT = 10405, /* 0x28A5 */
MSP_ERROR_DB_INVALID_SQL = 10406, /* 0x28A6 */
MSP_ERROR_DB_INVALID_APPID = 10407, /* 0x28A7 */
MSP_ERROR_DB_NO_UID = 10408,
/* Error codes of Resource 10500(0x2904)*/
MSP_ERROR_RES_GENERAL = 10500, /* 0x2904 */
MSP_ERROR_RES_LOAD = 10501, /* 0x2905 */ /* Load resource */
MSP_ERROR_RES_FREE = 10502, /* 0x2906 */ /* Free resource */
MSP_ERROR_RES_MISSING = 10503, /* 0x2907 */ /* Resource File Missing */
MSP_ERROR_RES_INVALID_NAME = 10504, /* 0x2908 */ /* Invalid resource file name */
MSP_ERROR_RES_INVALID_ID = 10505, /* 0x2909 */ /* Invalid resource ID */
MSP_ERROR_RES_INVALID_IMG = 10506, /* 0x290A */ /* Invalid resource image pointer */
MSP_ERROR_RES_WRITE = 10507, /* 0x290B */ /* Write read-only resource */
MSP_ERROR_RES_LEAK = 10508, /* 0x290C */ /* Resource leak out */
MSP_ERROR_RES_HEAD = 10509, /* 0x290D */ /* Resource head currupt */
MSP_ERROR_RES_DATA = 10510, /* 0x290E */ /* Resource data currupt */
MSP_ERROR_RES_SKIP = 10511, /* 0x290F */ /* Resource file skipped */
/* Error codes of TTS 10600(0x2968)*/
MSP_ERROR_TTS_GENERAL = 10600, /* 0x2968 */
MSP_ERROR_TTS_TEXTEND = 10601, /* 0x2969 */ /* Meet text end */
MSP_ERROR_TTS_TEXT_EMPTY = 10602, /* 0x296A */ /* no synth text */
MSP_ERROR_TTS_LTTS_ERROR = 10603, /* 0x296B */
/* Error codes of Recognizer 10700(0x29CC) */
MSP_ERROR_REC_GENERAL = 10700, /* 0x29CC */ /* <20><><EFBFBD><EFBFBD><EFBFBD>쳣 */
MSP_ERROR_REC_INACTIVE = 10701, /* 0x29CD */
MSP_ERROR_REC_GRAMMAR_ERROR = 10702, /* 0x29CE */
MSP_ERROR_REC_NO_ACTIVE_GRAMMARS = 10703, /* 0x29CF */
MSP_ERROR_REC_DUPLICATE_GRAMMAR = 10704, /* 0x29D0 */
MSP_ERROR_REC_INVALID_MEDIA_TYPE = 10705, /* 0x29D1 */
MSP_ERROR_REC_INVALID_LANGUAGE = 10706, /* 0x29D2 */
MSP_ERROR_REC_URI_NOT_FOUND = 10707, /* 0x29D3 */
MSP_ERROR_REC_URI_TIMEOUT = 10708, /* 0x29D4 */
MSP_ERROR_REC_URI_FETCH_ERROR = 10709, /* 0x29D5 */
MSP_ERROR_REC_PROC_MOD = 10710, /* 0x29D6 */
/* Error codes of Speech Detector 10800(0x2A30) */
MSP_ERROR_EP_GENERAL = 10800, /* 0x2A30 */
MSP_ERROR_EP_NO_SESSION_NAME = 10801, /* 0x2A31 */
MSP_ERROR_EP_INACTIVE = 10802, /* 0x2A32 */
MSP_ERROR_EP_INITIALIZED = 10803, /* 0x2A33 */
/* Error codes of TUV */
MSP_ERROR_TUV_GENERAL = 10900, /* 0x2A94 */
MSP_ERROR_TUV_GETHIDPARAM = 10901, /* 0x2A95 */ /* Get Busin Param huanid*/
MSP_ERROR_TUV_TOKEN = 10902, /* 0x2A96 */ /* Get Token */
MSP_ERROR_TUV_CFGFILE = 10903, /* 0x2A97 */ /* Open cfg file */
MSP_ERROR_TUV_RECV_CONTENT = 10904, /* 0x2A98 */ /* received content is error */
MSP_ERROR_TUV_VERFAIL = 10905, /* 0x2A99 */ /* Verify failure */
/* Error codes of IMTV */
MSP_ERROR_LOGIN_SUCCESS = 11000, /* 0x2AF8 */ /* <20>ɹ<EFBFBD> */
MSP_ERROR_LOGIN_NO_LICENSE = 11001, /* 0x2AF9 */ /* <20><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD> */
MSP_ERROR_LOGIN_SESSIONID_INVALID = 11002, /* 0x2AFA */ /* SessionIdʧЧ<CAA7><D0A7><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>µ<EFBFBD>¼ͨ<C2BC><CDA8>֤ */
MSP_ERROR_LOGIN_SESSIONID_ERROR = 11003, /* 0x2AFB */ /* SessionIdΪ<64>գ<EFBFBD><D5A3><EFBFBD><EFBFBD>߷Ƿ<DFB7> */
MSP_ERROR_LOGIN_UNLOGIN = 11004, /* 0x2AFC */ /* δ<><CEB4>¼ͨ<C2BC><CDA8>֤ */
MSP_ERROR_LOGIN_INVALID_USER = 11005, /* 0x2AFD */ /* <20>û<EFBFBD>ID<49><44>Ч */
MSP_ERROR_LOGIN_INVALID_PWD = 11006, /* 0x2AFE */ /* <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч */
MSP_ERROR_LOGIN_SYSTEM_ERROR = 11099, /* 0x2B5B */ /* ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD> */
/* Error codes of HCR */
MSP_ERROR_HCR_GENERAL = 11100,
MSP_ERROR_HCR_RESOURCE_NOT_EXIST = 11101,
MSP_ERROR_HCR_CREATE = 11102,
MSP_ERROR_HCR_DESTROY = 11103,
MSP_ERROR_HCR_START = 11104,
MSP_ERROR_HCR_APPEND_STROKES = 11105,
MSP_ERROR_HCR_INIT = 11106,
MSP_ERROR_HCR_POINT_DECODE = 11107,
MSP_ERROR_HCR_DISPATCH = 11108,
MSP_ERROR_HCR_GETRESULT = 11109,
MSP_ERROR_HCR_RESOURCE = 11110,
/* Error Codes using in local engine */
MSP_ERROR_AUTH_NO_LICENSE = 11200, /* 0x2BC0 */ /* <20><><EFBFBD><EFBFBD>Ȩ */
MSP_ERROR_AUTH_NO_ENOUGH_LICENSE = 11201, /* 0x2BC1 */ /* <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD> */
MSP_ERROR_AUTH_INVALID_LICENSE = 11202, /* 0x2BC2 */ /* <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>Ȩ */
MSP_ERROR_AUTH_LICENSE_EXPIRED = 11203, /* 0x2BC3 */ /* <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD> */
MSP_ERROR_AUTH_NEED_MORE_DATA = 11204, /* 0x2BC4 */ /* <20><><EFBFBD><EFBFBD><E8B1B8>Ϣ */
MSP_ERROR_AUTH_LICENSE_TO_BE_EXPIRED = 11205, /* 0x2BC5 */ /* <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_AUTH_INVALID_MACHINE_ID = 11206, /* 0x2BC6 */ /* <20><>Ч<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_AUTH_LOCAL_ASR_FORBIDDEN = 11207, /* 0x2BC7 */ /* <20><>ֹʹ<D6B9>ñ<EFBFBD><C3B1><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_AUTH_LOCAL_TTS_FORBIDDEN = 11208, /* 0x2BC8 */ /* <20><>ֹʹ<D6B9>ñ<EFBFBD><C3B1>غϳ<D8BA><CFB3><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_AUTH_LOCAL_IVW_FORBIDDEN = 11209, /* 0x2BC9 */ /* <20><>ֹʹ<D6B9>ñ<EFBFBD><C3B1>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_AUTH_APPID_NOT_MATCH = 11210, /* 0x2BCA */ /* <20><>Դappid<69><64>Ӧ<EFBFBD><D3A6>appid<69><64>ƥ<EFBFBD><C6A5> */
MSP_ERROR_AUTH_UID_NOT_MATCH = 11211, /* 0x2BCB */ /* <20><>Դuid<69>͵<EFBFBD>¼<EFBFBD>û<EFBFBD>uid<69><64>ƥ<EFBFBD><C6A5> */
MSP_ERROR_AUTH_TRIAL_EXPIRED = 11212, /* 0x2BCC */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD> */
MSP_ERROR_AUTH_LOCAL_IFD_FORBIDDEN = 11213, /* 0x2BC9 */ /* <20><>ֹʹ<D6B9>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_AIUI_NO_ENOUGH_LICENSE = 11216, /* 0x2BD0 */ /* AIUI<55><49>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD> */
/*Error Codes of Authorization*/
MSP_ERROR_AUTH_DVC_NO_LICENSE = 11300,
MSP_ERROR_AUTH_DVC_NO_ENOUGH_LICENSE = 11301,
MSP_ERROR_AUTH_DVC_INVALID_LICENSE = 11302,
MSP_ERROR_AUTH_DVC_LICENSE_EXPIRED = 11303,
MSP_ERROR_AUTH_DVC_NEED_MORE_DATA = 11304,
MSP_ERROR_AUTH_DVC_LICENSE_TO_BE_EXPIRED = 11305,
MSP_ERROR_AUTH_DVC_EXCEED_LICENSE = 11306,
/* Error codes of Ise */
MSP_ERROR_ASE_EXCEP_SILENCE = 11401,
MSP_ERROR_ASE_EXCEP_SNRATIO = 11402,
MSP_ERROR_ASE_EXCEP_PAPERDATA = 11403,
MSP_ERROR_ASE_EXCEP_PAPERCONTENTS = 11404,
MSP_ERROR_ASE_EXCEP_NOTMONO = 11405,
MSP_ERROR_ASE_EXCEP_OTHERS = 11406,
MSP_ERROR_ASE_EXCEP_PAPERFMT = 11407,
MSP_ERROR_ASE_EXCEP_ULISTWORD = 11408,
/* Error codes of Iot */
MSP_ERROR_IOT_BASE = 11500,
MSP_ERROR_IOT_PARAM_ERROR = 11501, // param error
MSP_ERROR_IOT_INVALID_SERVICE = 11502, // invalid service for iot ProTranServer
MSP_ERROR_IOT_INVALID_PRODUCTID = 11503, // invalid productid for ProTranServer
MSP_EEROR_IOT_INVALID_ATTR = 11504, // invalid attr value for one product in ProTranServer
MSP_ERROR_IOT_INVALID_PLATFORM = 11505, // invalid platform for ProTranServer
MSP_ERROR_IOT_DID_NOT_FOUND = 11506, // not found device id in semantic
/* Error codes of IVP */
MSP_ERROR_IVP_GENERAL = 11600, // <20>ں<EFBFBD><DABA>
MSP_ERROR_IVP_EXTRA_RGN_SOPPORT = 11601, // ע<><D7A2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(9<><39>)
MSP_ERROR_IVP_TRUNCATED = 11602, // <20><>Ƶ<EFBFBD>ط<EFBFBD>(<28><><EFBFBD>źŲ<C5BA><C5B2>εķ<CEB5><C4B7><EFBFBD>̫<EFBFBD>󣬶<EFBFBD><F3A3ACB6><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD>Χ)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ
MSP_ERROR_IVP_MUCH_NOISE = 11603, // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD>ȹ<EFBFBD><C8B9><EFBFBD>
MSP_ERROR_IVP_TOO_LOW = 11604, // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MSP_ERROR_IVP_ZERO_AUDIO = 11605, // <20><><EFBFBD><EFBFBD>Ƶ
MSP_ERROR_IVP_UTTER_TOO_SHORT = 11606, // <20><>Ƶ̫<C6B5><CCAB>
MSP_ERROR_IVP_TEXT_NOT_MATCH = 11607, // 1.<2E><>Ƶ<EFBFBD><C6B5><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ƥ<EFBFBD><EFBFBD><E4A3AC><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>1.<2E><><EFBFBD><EFBFBD>(<28>ڰ<EFBFBD><DAB0><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0>)
// 2.¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3.ȷʵ<C8B7><CAB5>ƥ<EFBFBD><C6A5>"
MSP_ERROR_IVP_NO_ENOUGH_AUDIO = 11608, // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><E1B1A8><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ
MSP_ERROR_IVP_MODEL_NOT_FOUND_IN_HBASE = 11610, // ģ<><C4A3><EFBFBD><EFBFBD>hbase<73><65>û<EFBFBD>ҵ<EFBFBD>
/* Error codes of Face */
MSP_ERROR_IFR_NOT_FACE_IMAGE = 11700, // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20200 <20><>
MSP_ERROR_FACE_IMAGE_FULL_LEFT = 11701, // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣬶<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20201<30><31>
MSP_ERROR_FACE_IMAGE_FULL_RIGHT = 11702, // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ң<EFBFBD><D2A3><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20202<30><32>
MSP_ERROR_IMAGE_CLOCKWISE_WHIRL = 11703, // <09><>˳ʱ<CBB3><CAB1><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20203<30><33>
MSP_ERROR_IMAGE_COUNTET_CLOCKWISE_WHIRL = 11704, // <09><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20204<30><34>
MSP_ERROR_VALID_IMAGE_SIZE = 11705, // <09><>ͼƬ<CDBC><C6AC>С<EFBFBD><20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20205<30><35>
MSP_ERROR_ILLUMINATION = 11706, // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20206<30><36>
MSP_ERROR_FACE_OCCULTATION = 11707, // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20207<30><37>
MSP_ERROR_FACE_INVALID_MODEL = 11708, // <09><><EFBFBD>Ƿ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20208<30><38>
MSP_ERROR_FUSION_INVALID_INPUT_TYPE = 11709, // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷǷ<CDB7><C7B7><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20300<30><30>
MSP_ERROR_FUSION_NO_ENOUGH_DATA = 11710, // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20301<30><31>
MSP_ERROR_FUSION_ENOUGH_DATA = 11711, // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݹ<EFBFBD><DDB9><EFBFBD><E0A3AC>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20302<30><32>
/*Error Codes of AIUI*/
MSP_ERROR_AIUI_CID_EXPIRED = 11800,
/*Error Codes of Encoder*/
MSP_ERROR_ICT_ENCODER = 11900,
/* Error codes of http 12000(0x2EE0) */
MSP_ERROR_HTTP_BASE = 12000, /* 0x2EE0 */
MSP_ERROR_HTTP_400 = 12400,
MSP_ERROR_HTTP_401 = 12401,
MSP_ERROR_HTTP_402 = 12402,
MSP_ERROR_HTTP_403 = 12403,
MSP_ERROR_HTTP_404 = 12404,
MSP_ERROR_HTTP_405 = 12405,
MSP_ERROR_HTTP_406 = 12406,
MSP_ERROR_HTTP_407 = 12407,
MSP_ERROR_HTTP_408 = 12408,
MSP_ERROR_HTTP_409 = 12409,
MSP_ERROR_HTTP_410 = 12410,
MSP_ERROR_HTTP_411 = 12411,
MSP_ERROR_HTTP_412 = 12412,
MSP_ERROR_HTTP_413 = 12413,
MSP_ERROR_HTTP_414 = 12414,
MSP_ERROR_HTTP_415 = 12415,
MSP_ERROR_HTTP_416 = 12416,
MSP_ERROR_HTTP_417 = 12417,
MSP_ERROR_HTTP_500 = 12500,
MSP_ERROR_HTTP_501 = 12501,
MSP_ERROR_HTTP_502 = 12502,
MSP_ERROR_HTTP_503 = 12503,
MSP_ERROR_HTTP_504 = 12504,
MSP_ERROR_HTTP_505 = 12505,
/*Error codes of ISV */
MSP_ERROR_ISV_NO_USER = 13000, /* 32C8 */ /* the user doesn't exist */
/* Error codes of Lua scripts */
MSP_ERROR_LUA_BASE = 14000, /* 0x36B0 */
MSP_ERROR_LUA_YIELD = 14001, /* 0x36B1 */
MSP_ERROR_LUA_ERRRUN = 14002, /* 0x36B2 */
MSP_ERROR_LUA_ERRSYNTAX = 14003, /* 0x36B3 */
MSP_ERROR_LUA_ERRMEM = 14004, /* 0x36B4 */
MSP_ERROR_LUA_ERRERR = 14005, /* 0x36B5 */
MSP_ERROR_LUA_INVALID_PARAM = 14006, /* 0x36B6 */
/* Error codes of MMP */
MSP_ERROR_MMP_BASE = 15000, /* 0x3A98 */
MSP_ERROR_MMP_MYSQL_INITFAIL = 15001, /* 0x3A99 */
MSP_ERROR_MMP_REDIS_INITFAIL = 15002, /* 0x3A9A */
MSP_ERROR_MMP_NETDSS_INITFAIL = 15003, /* 0x3A9B */
MSP_ERROR_MMP_TAIR_INITFAIL = 15004, /* 0x3A9C */
MSP_ERROR_MMP_MAIL_SESSION_FAIL = 15006, /* 0x3A9E */ /* <20>ʼ<EFBFBD><CABC><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><E1BBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
MSP_ERROR_MMP_MAIL_LOGON_FAIL = 15007, /* 0x3A9F */ /* <20>ʼ<EFBFBD><CABC><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ܾ<EFBFBD><DCBE><EFBFBD>½<EFBFBD><C2BD>*/
MSP_ERROR_MMP_MAIL_USER_ILLEGAL = 15008, /* 0x3AA0 */ /* <20>ʼ<EFBFBD><CABC><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>*/
MSP_ERROR_MMP_MAIL_PWD_ERR = 15009, /* 0x3AA1 */ /* <20>ʼ<EFBFBD><CABC><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
MSP_ERROR_MMP_MAIL_SOCKET_ERR = 15010, /* 0x3AA2 */ /* <20>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>͹<EFBFBD><CDB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><D7BD>ִ<EFBFBD><D6B4><EFBFBD>*/
MSP_ERROR_MMP_MAIL_INIT_FAIL = 15011, /* 0x3AA3 */ /* <20>ʼ<EFBFBD><CABC><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
MSP_ERROR_MMP_STORE_MNR_NO_INIT = 15012, /* 0x3AA4 */ /* store_managerδ<72><CEB4>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ʧ<EFBFBD><CAA7>*/
MSP_ERROR_MMP_STORE_MNR_POOL_FULL = 15013, /* 0x3AA5 */ /* store_manager<65><72><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD>*/
MSP_ERROR_MMP_STRATGY_PARAM_ILLEGAL = 15014, /* 0x3AA6 */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ʽ<EFBFBD>Ƿ<EFBFBD>*/
MSP_ERROR_MMP_STRATGY_PARAM_TOOLOOG = 15015, /* 0x3AA7 */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ʽ̫<CABD><CCAB>*/
MSP_ERROR_MMP_PARAM_NULL = 15016, /* 0x3AA8 */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>*/
MSP_ERROR_MMP_ERR_MORE_TOTAL = 15017, /* 0x3AA9 */ /* pms<6D><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> > <20>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>*/
MSP_ERROR_MMP_PROC_THRESHOLD = 15018, /* 0x3AAA */ /* <20><><EFBFBD>̼<EFBFBD><CCBC>ط<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>*/
MSP_ERROR_MMP_SERVER_THRESHOLD = 15019, /* 0x3AAB */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>*/
MSP_ERROR_MMP_PYTHON_NO_EXIST = 15020, /* 0x3AAC */ /* python<6F>ű<EFBFBD><C5B1>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_MMP_PYTHON_IMPORT_FAILED = 15021, /* 0x3AAD */ /* python<6F>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_MMP_PYTHON_BAD_FUNC = 15022, /* 0x3AAE */ /* python<6F>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> */
MSP_ERROR_MMP_DB_DATA_ILLEGAL = 15023, /* 0x3AAF */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݸ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> */
MSP_ERROR_MMP_REDIS_NOT_CONN = 15024, /* 0x3AB0 */ /* redisû<73><C3BB><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_MMP_PMA_NOT_FOUND_STRATEGY = 15025, /* 0x3AB1 */ /* û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MSP_ERROR_MMP_TAIR_CONNECT = 15026, /* 0x3AB2 */ /* <20><><EFBFBD><EFBFBD>tair<69><72>Ⱥʧ<C8BA><CAA7> */
MSP_ERROR_MMP_PMC_SERVINFO_INVALID = 15027, /* Ox3AB3 */ /* <20><>pmc<6D>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD>Ч */
MSP_ERROR_MMP_ALARM_GROUP_NULL = 15028, /* Ox3AB4 */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA> */
MSP_ERROR_MMP_ALARM_CONTXT_NULL = 15029, /* Ox3AB5 */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA> */
/* Error codes of MSC(lmod loader) */
MSP_ERROR_LMOD_BASE = 16000, /* 0x3E80 */
MSP_ERROR_LMOD_NOT_FOUND = 16001, /* 0x3E81 */ /* û<>ҵ<EFBFBD>lmod<6F>ļ<EFBFBD> */
MSP_ERROR_LMOD_UNEXPECTED_BIN = 16002, /* 0x3E82 */ /* <20><>Ч<EFBFBD><D0A7>lmod */
MSP_ERROR_LMOD_LOADCODE = 16003, /* 0x3E83 */ /* <20><><EFBFBD><EFBFBD>lmodָ<64><D6B8>ʧ<EFBFBD><CAA7> */
MSP_ERROR_LMOD_PRECALL = 16004, /* 0x3E84 */ /* <20><>ʼ<EFBFBD><CABC>lmodʧ<64><CAA7> */
MSP_ERROR_LMOD_RUNTIME_EXCEPTION = 16005, /* 0x3E85 */ /* lmod<6F><64><EFBFBD><EFBFBD>ʱ<EFBFBD>쳣 */
MSP_ERROR_LMOD_ALREADY_LOADED = 16006, /* 0x3E86 */ /* lmod<6F>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD> */
// Error code of Third Business
MSP_ERROR_BIZ_BASE = 17000, /* 0x4268 */ /* <20><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
//Error of Nginx errlog file increase exception
MSP_ERROR_NGX_LOG_MORE_TOTEL_SIZE = 18000, /*nginx<6E><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><D6BE>С<EFBFBD>쳣*/
//Error of Flash client when network checking
MSP_ERROR_FLASH_NETWORK_CONNECT_FIALED = 19000, /*flash<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>*/
MSP_ERROR_FLASH_NETWORK_CHECK_FIALED = 19001, /*flash<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><ECB3A3>Ϣ*/
MSP_ERROR_FLASH_NETWORK_CHECK_TIMEOUT = 19002, /*flash<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>糬ʱ*/
MSP_ERROR_FLASH_NETWORK_CLOSED_EXCEPTION = 19003, /*flash<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>*/
/*Error Code Of Speech plus*/
SPEECH_ERROR_NO_NETWORK = 20001, /* <20><><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
SPEECH_ERROR_NETWORK_TIMEOUT = 20002, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD>ʱ*/
SPEECH_ERROR_NET_EXPECTION = 20003, /* <20><><EFBFBD><EFBFBD><EFBFBD>쳣*/
SPEECH_ERROR_INVALID_RESULT = 20004, /* <20><><EFBFBD><EFBFBD>Ч<EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>*/
SPEECH_ERROR_NO_MATCH = 20005, /* <20><>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
SPEECH_ERROR_AUDIO_RECORD = 20006, /* ¼<><C2BC>ʧ<EFBFBD><CAA7> */
SPEECH_ERROR_NO_SPPECH = 20007, /* δ<><CEB4><EFBFBD><EFBFBD><E2B5BD><EFBFBD><EFBFBD>*/
SPEECH_ERROR_SPEECH_TIMEOUT = 20008, /* <20><>Ƶ<EFBFBD><C6B5><EFBFBD>볬ʱ*/
SPEECH_ERROR_EMPTY_UTTERANCE = 20009, /* <20><>Ч<EFBFBD><D0A7><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD> */
SPEECH_ERROR_FILE_ACCESS = 20010, /* <20>ļ<EFBFBD><C4BC><EFBFBD>дʧ<D0B4><CAA7> */
SPEECH_ERROR_PLAY_MEDIA = 20011, /* <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> */
SPEECH_ERROR_INVALID_PARAM = 20012, /* <20><>Ч<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>*/
SPEECH_ERROR_TEXT_OVERFLOW = 20013, /* <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD> */
SPEECH_ERROR_INVALID_DATA = 20014, /* <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD> */
SPEECH_ERROR_LOGIN = 20015, /* <20>û<EFBFBD>δ<EFBFBD><CEB4>½*/
SPEECH_ERROR_PERMISSION_DENIED = 20016, /* <20><>Ч<EFBFBD><D0A7>Ȩ */
SPEECH_ERROR_INTERRUPT = 20017, /* <20><><EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD> */
SPEECH_ERROR_VERSION_LOWER = 20018, /* <20><EFBFBD><E6B1BE><EFBFBD><EFBFBD> */
SPEECH_CLIENT_ERROR_ISUSING = 20019, /* ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC>(iOSƽ̨) */
SPEECH_ERROR_SYSTEM_PREINSTALL = 20020, /* ϵͳԤ<CDB3>ð汾 */
SPEECH_ERROR_UNSATISFIED_LINK = 20021, /* δʵ<CEB4>ֵ<EFBFBD>Native<76><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
SPEECH_ERROR_UNKNOWN = 20999, /* δ֪<CEB4><D6AA><EFBFBD><EFBFBD> */
SPEECH_ERROR_COMPONENT_NOT_INSTALLED = 21001, /* û<>а<EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
SPEECH_ERROR_ENGINE_NOT_SUPPORTED = 21002, /* <20><><EFBFBD>治֧<E6B2BB><D6A7> */
SPEECH_ERROR_ENGINE_INIT_FAIL = 21003, /* <20><>ʼ<EFBFBD><CABC>ʧ<EFBFBD><CAA7> */
SPEECH_ERROR_ENGINE_CALL_FAIL = 21004, /* <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> */
SPEECH_ERROR_ENGINE_BUSY = 21005, /* <20><><EFBFBD>深æ */
SPEECH_ERROR_LOCAL_NO_INIT = 22001, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ʼ<EFBFBD><CABC> */
SPEECH_ERROR_LOCAL_RESOURCE = 22002, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ */
SPEECH_ERROR_LOCAL_ENGINE = 22003, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD> */
SPEECH_ERROR_IVW_INTERRUPT = 22004, /* <20><><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD> */
/*Error Code Of Local iflytek Engines*/
/*Error Code Of AiTalk*/
/*Error Code Of AiTalk Operation*/
SPEECH_SUCCESS = 0 , // ivErr_OK = 0 /*<2A>ɹ<EFBFBD>״̬*/
SPEECH_ERROR_ASR_CLIENT = 23000, /*<2A>ͻ<EFBFBD><CDBB><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*///?????????
SPEECH_ERROR_ASR_INVALID_PARA = 23001, /*<2A><>Ч<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>*/
SPEECH_ERROR_ASR_INVALID_PARA_VALUE = 23002, /*<2A><>Ч<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ֵ*/
SPEECH_ERROR_ASR_OUT_OF_MEMORY = 23003, /*<2A>ڴ<EFBFBD><DAB4>ľ<EFBFBD>*/
SPEECH_ERROR_ASR_CREATE_HANDLE_FAILED = 23004, /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>*/
SPEECH_ERROR_ASR_ENGINE_INIT_FAILED = 23005, /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ʧ<EFBFBD><CAA7>*/
SPEECH_ERROR_ASR_ENGINE_STARTED = 23006, /*<2A><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>*/
SPEECH_ERROR_ASR_ENGINE_UNINIT = 23007, /*<2A><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ʼ<EFBFBD><CABC>*/
SPEECH_ERROR_ASR_SPEECH_TIMEOUT = 23008, /*ʶ<><CAB6><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>VADû<44><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>м<EFBFBD><D0BC><EFBFBD><E2B5BD><EFBFBD>˵㣩*/
SPEECH_ERROR_ASR_NO_RECOGNIZED_RESULT = 23009, /*<2A><>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
SPEECH_ERROR_ASR_INVALID_HANDLE = 23010, /*<2A><>Ч<EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>*/
SPEECH_ERROR_ASR_FILE_ACCESS = 23011, /*<2A><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><CAA7>*/
/*Error Code Of AiTalk Engine*/
SPEECH_ERROR_AITALK_FALSE = 23100, // ivErr_FALSE = 1
/* For license check */
SPEECH_ERROR_AITALK_PERMISSION_DENIED = 23101, // ivErr_InvSN = 2
/* General */
SPEECH_ERROR_AITALK_INVALID_PARA = 23102, // ivErr_InvArg = 3
SPEECH_ERROR_AITALK_BUFFER_OVERFLOW = 23103, // ivErr_BufferFull = 4 /*<2A><>Ƶ<EFBFBD><C6B5><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
SPEECH_ERROR_AITALK_FAILED = 23104, // ivErr_Failed = 5
SPEECH_ERROR_AITALK_NOT_SUPPORTED = 23105, // ivErr_NotSupport = 6 /*<2A><><EFBFBD>治֧<E6B2BB><D6A7>*/
SPEECH_ERROR_AITALK_OUT_OF_MEMORY = 23106, // ivErr_OutOfMemory = 7
SPEECH_ERROR_AITALK_INVALID_RESOURCE = 23107, // ivErr_InvResource = 8 /*<2A><>Դ<EFBFBD><D4B4>Ч*/
SPEECH_ERROR_AITALK_NOT_FOUND = 23108, // ivErr_NotFound = 9 /*<2A><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><CAA7>*/
SPEECH_ERROR_AITALK_INVALID_GRAMMAR = 23109, // ivErr_InvGrmr = 10 /*ʶ<><CAB6><EFBFBD><EFBFBD><EFB7A8><EFBFBD><EFBFBD>*/
/* For object status */
SPEECH_ERROR_AITALK_INVALID_CALL = 23110, // ivErr_InvCall = 11 /*<2A><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>*/
/* For ASR Input */
SPEECH_ERROR_AITALK_SYNTAX_ERROR = 23111, // ivErr_InvCall = 12
/* For Message Call Back */
SPEECH_ERROR_AITALK_RESET = 23112, // ivErr_Reset = 13
SPEECH_ERROR_AITALK_ENDED = 23113, // ivErr_Ended = 14
SPEECH_ERROR_AITALK_IDLE = 23114, // ivErr_Idle = 15
SPEECH_ERROR_AITALK_CANNOT_SAVE_FILE = 23115, // ivErr_CanNotSaveFile = 16
/* For Lexicon name */
SPEECH_ERROR_AITALK_INVALID_GRAMMAR_NAME = 23116, // ivErr_InvName = 17 /*<2A>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>ƷǷ<C6B7>*/
SPEECH_ERROR_AITALK_BUFFER_EMPTY = 23117, // ivErr_BufferEmpty = 18
SPEECH_ERROR_AITALK_GET_RESULT = 23118, // ivErr_GetResult = 19
SPEECH_ERROR_AITALK_REACT_OUT_TIME = 23119, // ivErr_ReactOutTime = 20 /*<2A><>Ӧ<EFBFBD><D3A6>ʱ*/
SPEECH_ERROR_AITALK_SPEECH_OUT_TIME = 23120, // ivErr_SpeechOutTime = 21 /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ*/
SPEECH_ERROR_AITALK_AUDIO_CUT = 23121, // ivErr_CUT = 22 /*¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
SPEECH_ERROR_AITALK_AUDIO_LOWER = 23122, // ivErr_LOWER = 23 /*¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
SPEECH_ERROR_AITALK_INSUFFICIENT_PERMISSIONS = 23123, // ivErr_Limitted = 24 /*<2A><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>*/
SPEECH_ERROR_AITALK_RESULT_ERROR = 23124, // ivErr_ResultError = 25 /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Wfst<73><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB>cmd<6D><64><EFBFBD><EFBFBD>*/
SPEECH_ERROR_AITALK_SHORT_PAUSE = 23125, // ivErr_ShortPause = 26
SPEECH_ERROR_AITALK_BUSY = 23126, // ivErr_Busy = 27
SPEECH_ERROR_AITALK_GRM_NOT_UPDATE = 23127, // ivErr_GrmNotUpdate = 28 /*<2A>﷨δ<EFB7A8><CEB4><EFBFBD><EFBFBD>*/
SPEECH_ERROR_AITALK_STARTED = 23128, // ivErr_Started = 29
SPEECH_ERROR_AITALK_STOPPED = 23129, // ivErr_Stopped = 30
SPEECH_ERROR_AITALK_ALREADY_STARTED = 23130, // ivErr_AlreadyStarted = 31
SPEECH_ERROR_AITALK_ALREADY_STOPPED = 23131, // ivErr_AlreadyStopped = 32
SPEECH_ERROR_AITALK_TOO_MANY_COMMAND = 23132, // ivErr_TooManyCmd = 33
SPEECH_ERROR_AITALK_WAIT = 23133, // ivErr_Wait = 34 /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һЩ<D2BB><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ҫ<EFBFBD>ȴ<EFBFBD>*/
SPEECH_ERROR_AITALK_MAE_RIGHT = 23134, // ivErr_MAERight = 35
SPEECH_ERROR_AITALK_MAE_WRONG = 23135, // ivErr_MAEWrong = 36
SPEECH_ERROR_AITALK_GRM_ERR = 23300, // <20><EFBFBD><EFB7A8><EFBFBD><EFBFBD>
/*Error Code Of AiSound*/
/*Error Code Of AiSound Operation*/
SPEECH_ERROR_TTS_INVALID_PARA = 24000, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
SPEECH_ERROR_TTS_INVALID_PARA_VALUE = 24001, /* <20><>Ч<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ֵ*/
SPEECH_ERROR_TTS_OUT_OF_MEMORY = 24002, /* <20>ڴ治<DAB4><E6B2BB>*/
SPEECH_ERROR_TTS_INVALID_HANDLE = 24003, /* <20><>Ч<EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>*/
SPEECH_ERROR_TTS_CREATE_HANDLE_FAILED = 24004, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>*/
SPEECH_ERROR_TTS_INVALID_RESOURCE = 24005, /* <20><>Ч<EFBFBD><D0A7>Դ */
SPEECH_ERROR_TTS_INVALID_VOICE_NAME = 24006, /* <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
SPEECH_ERROR_TTS_ENGINE_UNINIT = 24007, /* <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ʼ<EFBFBD><CABC> */
SPEECH_ERROR_TTS_ENGINE_INIT_FAILED = 24008, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ʧ<EFBFBD><CAA7> */
SPEECH_ERROR_TTS_ENGINE_BUSY = 24009, /* <20><><EFBFBD><EFBFBD>æ */
/*Error Code Of AiSound Engine*/
SPEECH_ERROR_AISOUND_BASE = 24100,
SPEECH_ERROR_AISOUND_UNIMPEMENTED = 24100, /* unimplemented function */
SPEECH_ERROR_AISOUND_UNSUPPORTED = 24101, /* unsupported on this platform */
SPEECH_ERROR_AISOUND_INVALID_HANDLE = 24102, /* invalid handle */
SPEECH_ERROR_AISOUND_INVALID_PARA = 24103, /* invalid parameter(s) */
SPEECH_ERROR_AISOUND_INSUFFICIENT_HEAP = 24104, /* insufficient heap size */
SPEECH_ERROR_AISOUND_STATE_REFUSE = 24105, /* refuse to do in current state */
SPEECH_ERROR_AISOUND_INVALID_PARA_ID = 24106, /* invalid parameter ID */
SPEECH_ERROR_AISOUND_INVALID_PARA_VALUE = 24107, /* invalid parameter value */
SPEECH_ERROR_AISOUND_RESOURCE = 24108, /* Resource is error */
SPEECH_ERROR_AISOUND_RESOURCE_READ = 24109, /* read resource error */
SPEECH_ERROR_AISOUND_LBENDIAN = 24110, /* the Endian of SDK is error */
SPEECH_ERROR_AISOUND_HEADFILE = 24111, /* the HeadFile is different of the SDK */
SPEECH_ERROR_AISOUND_BUFFER_OVERFLOW = 24112, /* get data size exceed the data buffer */
SPEECH_ERROR_AISOUND_INVALID_ISAMPA = 24113, /* !Invalid iSampa format or input iSampa text contain invalid alphabet*/
SPEECH_ERROR_AISOUND_INVALID_CSSML = 24114, /* !Invalid cssml format */
/*Error Code Of ivw*/
/*Error Code Of ivw Operation*/
SPEECH_ERROR_IVW_ENGINE_UNINI = 25000, /* <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ʼ<EFBFBD><CABC> */
SPEECH_ERROR_IVW_RESVER_NOMATCH = 25001, /* <20><>Դ<EFBFBD><EFBFBD><E6B1BE>ƥ<EFBFBD><C6A5> */
SPEECH_ERROR_IVW_BUFFERED_AUDIOD_LITTLE = 25002, /* <20><><EFBFBD>Ѽ<EFBFBD>ʶ<EFBFBD>𻺴<EFBFBD><F0BBBAB4><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD> */
SPEECH_ERROR_IVW_INVALID_RESTYPE = 25003, /* <20><><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD> */
SPEECH_ERROR_IVW_INVALID_RESHEADVER = 25004, /* <20><><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>Դͷ<D4B4><CDB7><EFBFBD><EFBFBD><E6B1BE> */
/*Error Code Of ivw Engine*/
SPEECH_ERROR_IVW_INVALID_CALL = 25101, // IvwErr_InvCal = 1
SPEECH_ERROR_IVW_INVALID_ARG = 25102, // IvwErr_InvArg = 2
SPEECH_ERROR_IVW_TELL_SIZE = 25103, // IvwErr_TellSize = 3
SPEECH_ERROR_IVW_OUT_OF_MEMORY = 25104, // IvwErr_OutOfMemory = 4
SPEECH_ERROR_IVW_OUT_BUFFER_FULL = 25105, // IvwErr_BufferFull = 5
SPEECH_ERROR_IVW_OUT_BUFFER_EMPTY = 25106, // IvwErr_BufferEmpty = 6
SPEECH_ERROR_IVW_INVALID_RESOURCE = 25107, // IvwErr_InvRes = 7
SPEECH_ERROR_IVW_REPETITIOPN_ENTER = 25108, // IvwErr_ReEnter = 8
SPEECH_ERROR_IVW_NOT_SUPPORT = 25109, // IvwErr_NotSupport = 9
SPEECH_ERROR_IVW_NOT_FOUND = 25110, // IvwErr_NotFound = 10
SPEECH_ERROR_IVW_INVALID_SN = 25111, // IvwErr_InvSN = 11
SPEECH_ERROR_IVW_LIMITTED = 25112, // IvwErr_Limitted = 12
SPEECH_ERROR_IVW_TIME_OUT = 25113, // IvwErr_TimeOut = 13
SPEECH_ERROR_IVW_ENROLL1_SUCESS = 25114, // IvwErr_Enroll1_Success = 14
SPEECH_ERROR_IVW_ENROLL1_FAILED = 25115, // IvwErr_Enroll1_Failed = 15
SPEECH_ERROR_IVW_ENROLL2_SUCESS = 25116, // IvwErr_Enroll2_Success = 16
SPEECH_ERROR_IVW_ENROLL2_FAILED = 25117, // IvwErr_Enroll2_Failed = 17
SPEECH_ERROR_IVW_ENROLL3_SUCESS = 25118, // IvwErr_Enroll3_Success = 18
SPEECH_ERROR_IVW_ENROLL3_FAILED = 25119, // IvwErr_Enroll3_Failed = 19
SPEECH_ERROR_IVW_SPEECH_TOO_SHORT = 25120, // IvwErr_SpeechTooShort = 20
SPEECH_ERROR_IVW_SPEECH_STOP = 25121, // IvwErr_SpeechStop = 21
/* <20><>ʵʱתд<D7AA><D0B4><EFBFBD><EFBFBD><EFBFBD>룺26000~26999 */
SPEECH_ERROR_LFASR_BASE = 26000, /* <20><>ʵʱתд<D7AA><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
};
#endif /* __MSP_ERRORS_H__ */

View File

@@ -0,0 +1,123 @@
#ifndef __MSP_TYPES_H__
#define __MSP_TYPES_H__
#if !defined(MSPAPI)
#if defined(WIN32) || defined(WINPHONE8) || defined(WIN8)
#define MSPAPI __stdcall
#else
#define MSPAPI
#endif /* WIN32 */
#endif /* MSPAPI */
/**
* MSPSampleStatus indicates how the sample buffer should be handled
* MSP_AUDIO_SAMPLE_FIRST - The sample buffer is the start of audio
* If recognizer was already recognizing, it will discard
* audio received to date and re-start the recognition
* MSP_AUDIO_SAMPLE_CONTINUE - The sample buffer is continuing audio
* MSP_AUDIO_SAMPLE_LAST - The sample buffer is the end of audio
* The recognizer will cease processing audio and
* return results
* Note that sample statii can be combined; for example, for file-based input
* the entire file can be written with SAMPLE_FIRST | SAMPLE_LAST as the
* status.
* Other flags may be added in future to indicate other special audio
* conditions such as the presence of AGC
*/
enum
{
MSP_AUDIO_SAMPLE_INIT = 0x00,
MSP_AUDIO_SAMPLE_FIRST = 0x01,
MSP_AUDIO_SAMPLE_CONTINUE = 0x02,
MSP_AUDIO_SAMPLE_LAST = 0x04,
};
/*
* The enumeration MSPRecognizerStatus contains the recognition status
* MSP_REC_STATUS_SUCCESS - successful recognition with partial results
* MSP_REC_STATUS_NO_MATCH - recognition rejected
* MSP_REC_STATUS_INCOMPLETE - recognizer needs more time to compute results
* MSP_REC_STATUS_NON_SPEECH_DETECTED - discard status, no more in use
* MSP_REC_STATUS_SPEECH_DETECTED - recognizer has detected audio, this is delayed status
* MSP_REC_STATUS_COMPLETE - recognizer has return all result
* MSP_REC_STATUS_MAX_CPU_TIME - CPU time limit exceeded
* MSP_REC_STATUS_MAX_SPEECH - maximum speech length exceeded, partial results may be returned
* MSP_REC_STATUS_STOPPED - recognition was stopped
* MSP_REC_STATUS_REJECTED - recognizer rejected due to low confidence
* MSP_REC_STATUS_NO_SPEECH_FOUND - recognizer still found no audio, this is delayed status
*/
enum
{
MSP_REC_STATUS_SUCCESS = 0,
MSP_REC_STATUS_NO_MATCH = 1,
MSP_REC_STATUS_INCOMPLETE = 2,
MSP_REC_STATUS_NON_SPEECH_DETECTED = 3,
MSP_REC_STATUS_SPEECH_DETECTED = 4,
MSP_REC_STATUS_COMPLETE = 5,
MSP_REC_STATUS_MAX_CPU_TIME = 6,
MSP_REC_STATUS_MAX_SPEECH = 7,
MSP_REC_STATUS_STOPPED = 8,
MSP_REC_STATUS_REJECTED = 9,
MSP_REC_STATUS_NO_SPEECH_FOUND = 10,
MSP_REC_STATUS_FAILURE = MSP_REC_STATUS_NO_MATCH,
};
/**
* The enumeration MSPepState contains the current endpointer state
* MSP_EP_LOOKING_FOR_SPEECH - Have not yet found the beginning of speech
* MSP_EP_IN_SPEECH - Have found the beginning, but not the end of speech
* MSP_EP_AFTER_SPEECH - Have found the beginning and end of speech
* MSP_EP_TIMEOUT - Have not found any audio till timeout
* MSP_EP_ERROR - The endpointer has encountered a serious error
* MSP_EP_MAX_SPEECH - Have arrive the max size of speech
*/
enum
{
MSP_EP_LOOKING_FOR_SPEECH = 0,
MSP_EP_IN_SPEECH = 1,
MSP_EP_AFTER_SPEECH = 3,
MSP_EP_TIMEOUT = 4,
MSP_EP_ERROR = 5,
MSP_EP_MAX_SPEECH = 6,
MSP_EP_IDLE = 7 // internal state after stop and before start
};
/* Synthesizing process flags */
enum
{
MSP_TTS_FLAG_STILL_HAVE_DATA = 1,
MSP_TTS_FLAG_DATA_END = 2,
MSP_TTS_FLAG_CMD_CANCELED = 4,
};
/* Handwriting process flags */
enum
{
MSP_HCR_DATA_FIRST = 1,
MSP_HCR_DATA_CONTINUE = 2,
MSP_HCR_DATA_END = 4,
};
/*ivw message type */
enum
{
MSP_IVW_MSG_WAKEUP = 1,
MSP_IVW_MSG_ERROR = 2,
MSP_IVW_MSG_ISR_RESULT = 3,
MSP_IVW_MSG_ISR_EPS = 4,
MSP_IVW_MSG_VOLUME = 5,
MSP_IVW_MSG_ENROLL = 6,
MSP_IVW_MSG_RESET = 7
};
/* Upload data process flags */
enum
{
MSP_DATA_SAMPLE_INIT = 0x00,
MSP_DATA_SAMPLE_FIRST = 0x01,
MSP_DATA_SAMPLE_CONTINUE = 0x02,
MSP_DATA_SAMPLE_LAST = 0x04,
};
#endif /* __MSP_TYPES_H__ */

View File

@@ -0,0 +1,223 @@
/**
* @file qise.h
* @brief iFLY Speech Evaluation Header File
*
* This file contains the quick application programming interface (API) declarations
* of evaluation. Developer can include this file in your project to build applications.
* For more information, please read the developer guide.
* Use of this software is subject to certain restrictions and limitations set
* forth in a license agreement entered into between iFLYTEK, Co,LTD.
* and the licensee of this software. Please refer to the license
* agreement for license use rights and restrictions.
*
* Copyright (C) 1999 - 2012 by ANHUI USTC iFLYTEK, Co,LTD.
* All rights reserved.
*
* @author Speech Dept. iFLYTEK.
* @version 1.0
* @date 2012/4/16
*
* @see
*
* <b>History:</b><br>
* <table>
* <tr> <th>Version <th>Date <th>Author <th>Notes</tr>
* <tr> <td>1.0 <td>2012/4/16 <td>MSP40 <td>Create this file</tr>
* </table>
*
*/
#ifndef __MSP_ISE_H__
#define __MSP_ISE_H__
#ifdef __cplusplus
extern "C" {
#endif /* C++ */
#include "msp_types.h"
/**
* @fn QISEInit
* @brief Initialize API
*
* Load API module with specified configurations.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* configs - [in] Configurations to initialize.
* @see
*/
/*int MSPAPI QISEInit(const char* configs);
typedef int (MSPAPI *Proc_QISEInit)(const char* configs);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISEInitW(const wchar_t* configs);
typedef int (MSPAPI *Proc_QISEInitW)(const wchar_t* configs);
#endif*/
/**
* @fn QISESessionBegin
* @brief Begin a Evaluation Session
*
* Create a evaluation session to evaluate audio data
*
* @return const char* MSPAPI - Return the new session id in success, otherwise return NULL.
* @param const char* params - [in] Parameters to create session.
* @param const char* userModelId - [in] user model id.
* @param int *errorCode - [out] Return 0 in success, otherwise return error code.
* @see
*/
const char* MSPAPI QISESessionBegin(const char* params, const char* userModelId, int* errorCode);
typedef const char* (MSPAPI *Proc_QISESessionBegin)(const char* params, const char* userModelID, int *errorCode);
#ifdef MSP_WCHAR_SUPPORT
const wchar_t* MSPAPI QISESessionBeginW(const wchar_t* params, const wchar_t* userModelID, int *errorCode);
typedef const wchar_t* (MSPAPI *Proc_QISESessionBeginW)(const wchar_t* params, const wchar_t* userModelID, int *errorCode);
#endif
/**
* @fn QISEPaperCheck
* @brief Paper Check
*
* Checking the papaer .
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param void *data - [in] Text buffer.
* @param unsigned int* dataLen - [in] Text length in bytes,[out] Length of result returned
* @param const char* params - [in] Parameters describing the text.
* @see
*/
const char* MSPAPI QISEPaperCheck(void *data, unsigned int * dataLen, const char *params, int *errorCode );
/**
* @fn QISETextPut
* @brief Put Text
*
* Writing text string to evaluator.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] The session id returned by QISESessionBegin.
* @param const char* textString - [in] Text buffer.
* @param unsigned int textLen - [in] Text length in bytes.
* @param const char* params - [in] Parameters describing the text.
* @see
*/
int MSPAPI QISETextPut(const char* sessionID, const char* textString, unsigned int textLen, const char* params);
typedef int (MSPAPI *Proc_QISETextPut)(const char* sessionID, const char* textString, unsigned int textLen, const char* params);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISETextPutW(const wchar_t* sessionID, const wchar_t* textString, unsigned int textLen, const wchar_t* params);
typedef int (MSPAPI *Proc_QISETextPutW)(const wchar_t* sessionID, const wchar_t* textString, unsigned int textLen, const wchar_t* params);
#endif
/**
* @fn QISEAudioWrite
* @brief Write Audio
*
* Writing binary audio data to evaluator.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] The session id returned by QISESessionBegin.
* @param const void* waveData - [in] Audio data to write.
* @param unsigned int waveLen - [in] Audio length in bytes.
* @param int audioStatus - [in] Audio status.
* @param int *epStatus - [out] EP or vad status.
* @param int *evlStatus - [out] Status of evaluation result, 0: success, 1: no match, 2: incomplete, 5:speech complete.
* @see
*/
int MSPAPI QISEAudioWrite(const char* sessionID, const void* waveData, unsigned int waveLen, int audioStatus, int *epStatus, int *Status);
typedef int (MSPAPI *Proc_QISEAudioWrite)(const char* sessionID, const void* waveData, unsigned int waveLen, int audioStatus, int *epStatus, int *recogStatus);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISEAudioWriteW(const wchar_t* sessionID, const void* waveData, unsigned int waveLen, int audioStatus, int *epStatus, int *evlStatus);
typedef int (MSPAPI *Proc_QISEAudioWriteW)(const wchar_t* sessionID, const void* waveData, unsigned int waveLen, int audioStatus, int *epStatus, int *evlStatus);
#endif
/**
* @fn QISEGetResult
* @brief Get Evaluation Result
*
* Get evaluation result.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] The session id returned by QISESessionBegin.
* @param int* rsltLen - [out] Length of result returned.
* @param int* rsltStatus - [out] Status of evaluation result returned.
* @param int* errorCode - [out] Return 0 in success, otherwise return error code.
* @see
*/
const char * MSPAPI QISEGetResult(const char* sessionID, unsigned int* rsltLen, int* rsltStatus, int *errorCode);
typedef const char * (MSPAPI *Proc_QISEGetResult)(const char* sessionID, unsigned int* rsltLen, int* rsltStatus, int *errorCode);
#ifdef MSP_WCHAR_SUPPORT
const wchar_t* MSPAPI QISEGetResultW(const wchar_t* sessionID, int* rsltLen, unsigned int* rsltStatus, int *errorCode);
typedef const wchar_t* (MSPAPI *Proc_QISEGetResultW)(const wchar_t* sessionID, unsigned int* rsltLen, int* rsltStatus, int *errorCode);
#endif
/**
* @fn QISEResultInfo
* @brief Get Result Info
*
* Get info of evaluation result.
*
* @return const char * - The session id returned by QISESessionBegin.
* @param const char* sessionID - [in] session id returned by QISESessionBegin.
* @see
*/
const char* MSPAPI QISEResultInfo(const char* sessionID, int *errorCode);
typedef const char* (MSPAPI *Proc_QISEResultInfo)(const char* sessionID, int *errorCode);
#ifdef MSP_WCHAR_SUPPORT
const wchar_t* MSPAPI QISEResultInfoW(const wchar_t* sessionID, int *errorCode);
typedef const wchar_t* (MSPAPI *Proc_QISEResultInfoW)(const wchar_t* sessionID, int *errorCode);
#endif
/**
* @fn QISESessionEnd
* @brief End a ISR Session
*
* End a evaluation session, release all resource.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] The session id returned by QISESessionBegin.
* @param const char* hints - [in] Reason to end current session.
* @see
*/
int MSPAPI QISESessionEnd(const char* sessionID, const char* hints);
typedef int (MSPAPI *Proc_QISESessionEnd)(const char* sessionID, const char* hints);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISESessionEndW(const wchar_t* sessionID, const wchar_t* hints);
typedef int (MSPAPI *Proc_QISESessionEndW)(const wchar_t* sessionID, const wchar_t* hints);
#endif
/**
* @fn QISEGetParam
* @brief get params related with msc
*
* the params could be local or server param, we only support netflow params "upflow" & "downflow" now
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] session id of related param, set NULL to got global param
* @param const char* paramName - [in] param name,could pass more than one param splited by ',' ';' or '\n'.
* @param const char* paramValue - [in] param value buffer, malloced by user.
* @param int *valueLen - [in, out] in: length of value buffer, out: length of value string.
* @see
*/
int MSPAPI QISEGetParam(const char* sessionID, const char* paramName, char* paramValue, unsigned int* valueLen);
typedef int (MSPAPI *Proc_QISEGetParam)(const char* sessionID, const char* paramName, char* paramValue, unsigned int* valueLen);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISEGetParamW(const wchar_t* sessionID, const wchar_t* paramName, wchar_t* paramValue, unsigned int* valueLen);
typedef int (MSPAPI *Proc_QISEGetParamW)(const wchar_t* sessionID, const wchar_t* paramName, wchar_t* paramValue, unsigned int* valueLen);
#endif
/*
//
// typedef void ( MSPAPI *recog_result_ntf_handler)( const char *sessionID, const char *result, int resultLen, int resultStatus, void *userData );
// typedef void ( MSPAPI *status_ntf_handler)( const char *sessionID, int type, int status, const void *param1, const void *param2, void *userData);
// typedef void ( MSPAPI *error_ntf_handler)(const char *sessionID, int errorCode, const char *detail, void *userData);
// int MSPAPI QISRRegisterNotify(const char *sessionID, recog_result_ntf_handler rsltCb, status_ntf_handler statusCb, error_ntf_handler errCb, void *userData);
*/
#ifdef __cplusplus
} /* extern "C" */
#endif /* C++ */
#endif /* __MSP_ISE_H__ */

View File

@@ -0,0 +1,203 @@
/**
* @file qisr.h
* @brief iFLY Speech Recognizer Header File
*
* This file contains the quick application programming interface (API) declarations
* of ISR. Developer can include this file in your project to build applications.
* For more information, please read the developer guide.
* Use of this software is subject to certain restrictions and limitations set
* forth in a license agreement entered into between iFLYTEK, Co,LTD.
* and the licensee of this software. Please refer to the license
* agreement for license use rights and restrictions.
*
* Copyright (C) 1999 - 2007 by ANHUI USTC iFLYTEK, Co,LTD.
* All rights reserved.
*
* @author Speech Dept. iFLYTEK.
* @version 1.0
* @date 2008/12/12
*
* @see
*
* History:
* index version date author notes
* 0 1.0 2008/12/12 Speech Create this file
*/
#ifndef __QISR_H__
#define __QISR_H__
#ifdef __cplusplus
extern "C" {
#endif /* C++ */
#include "msp_types.h"
/**
* @fn QISRSessionBegin
* @brief Begin a Recognizer Session
*
* Create a recognizer session to recognize audio data
*
* @return return sessionID of current session, NULL is failed.
* @param const char* grammarList - [in] grammars list, inline grammar support only one.
* @param const char* params - [in] parameters when the session created.
* @param int *errorCode - [out] return 0 on success, otherwise return error code.
* @see
*/
const char* MSPAPI QISRSessionBegin(const char* grammarList, const char* params, int* errorCode);
typedef const char* (MSPAPI *Proc_QISRSessionBegin)(const char* grammarList, const char* params, int *result);
#ifdef MSP_WCHAR_SUPPORT
const wchar_t* MSPAPI QISRSessionBeginW(const wchar_t* grammarList, const wchar_t* params, int *result);
typedef const wchar_t* (MSPAPI *Proc_QISRSessionBeginW)(const wchar_t* grammarList, const wchar_t* params, int *result);
#endif
/**
* @fn QISRAudioWrite
* @brief Write Audio Data to Recognizer Session
*
* Writing binary audio data to recognizer.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] The session id returned by recog_begin
* @param const void* waveData - [in] Binary data of waveform
* @param unsigned int waveLen - [in] Waveform data size in bytes
* @param int audioStatus - [in] Audio status, can be
* @param int *epStatus - [out] ISRepState
* @param int *recogStatus - [out] ISRrecRecognizerStatus, see isr_rec.h
* @see
*/
int MSPAPI QISRAudioWrite(const char* sessionID, const void* waveData, unsigned int waveLen, int audioStatus, int *epStatus, int *recogStatus);
typedef int (MSPAPI *Proc_QISRAudioWrite)(const char* sessionID, const void* waveData, unsigned int waveLen, int audioStatus, int *epStatus, int *recogStatus);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISRAudioWriteW(const wchar_t* sessionID, const void* waveData, unsigned int waveLen, int audioStatus, int *epStatus, int *recogStatus);
typedef int (MSPAPI *Proc_QISRAudioWriteW)(const wchar_t* sessionID, const void* waveData, unsigned int waveLen, int audioStatus, int *epStatus, int *recogStatus);
#endif
/**
* @fn QISRGetResult
* @brief Get Recognize Result in Specified Format
*
* Get recognize result in Specified format.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] session id returned by session begin
* @param int* rsltStatus - [out] status of recognition result, 0: success, 1: no match, 2: incomplete, 5:speech complete
* @param int *errorCode - [out] return 0 on success, otherwise return error code.
* @see
*/
const char * MSPAPI QISRGetResult(const char* sessionID, int* rsltStatus, int waitTime, int *errorCode);
typedef const char * (MSPAPI *Proc_QISRGetResult)(const char* sessionID, int* rsltStatus, int waitTime, int *errorCode);
#ifdef MSP_WCHAR_SUPPORT
const wchar_t* MSPAPI QISRGetResultW(const wchar_t* sessionID, int* rsltStatus, int waitTime, int *errorCode);
typedef const wchar_t* (MSPAPI *Proc_QISRGetResultW)(const wchar_t* sessionID, int* rsltStatus, int waitTime, int *errorCode);
#endif
/**
* @fn QISRGetBinaryResult
* @brief Get Recognize Result in Specified Format
*
* Get recognize result in Specified format.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] session id returned by session begin
* @param int* rsltStatus - [out] status of recognition result, 0: success, 1: no match, 2: incomplete, 5:speech complete
* @param int *errorCode - [out] return 0 on success, otherwise return error code.
* @see
*/
const char * MSPAPI QISRGetBinaryResult(const char* sessionID, unsigned int* rsltLen,int* rsltStatus, int waitTime, int *errorCode);
typedef const char * (MSPAPI *Proc_QISRGetBinaryResult)(const char* sessionID, unsigned int* rsltLen, int* rsltStatus, int waitTime, int *errorCode);
#ifdef MSP_WCHAR_SUPPORT
const wchar_t* MSPAPI QISRGetBinaryResultW(const wchar_t* sessionID, unsigned int* rsltLen, int* rsltStatus, int waitTime, int *errorCode);
typedef const wchar_t* (MSPAPI *Proc_QISRGetBinaryResultW)(const wchar_t* sessionID, unsigned int* rsltLen, int* rsltStatus, int waitTime, int *errorCode);
#endif
/**
* @fn QISRSessionEnd
* @brief End a Recognizer Session
*
* End the recognizer session, release all resource.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] session id string to end
* @param const char* hints - [in] user hints to end session, hints will be logged to CallLog
* @see
*/
int MSPAPI QISRSessionEnd(const char* sessionID, const char* hints);
typedef int (MSPAPI *Proc_QISRSessionEnd)(const char* sessionID, const char* hints);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISRSessionEndW(const wchar_t* sessionID, const wchar_t* hints);
typedef int (MSPAPI *Proc_QISRSessionEndW)(const wchar_t* sessionID, const wchar_t* hints);
#endif
/**
* @fn QISRGetParam
* @brief get params related with msc
*
* the params could be local or server param, we only support netflow params "upflow" & "downflow" now
*
* @return int - Return 0 if success, otherwise return errcode.
* @param const char* sessionID - [in] session id of related param, set NULL to got global param
* @param const char* paramName - [in] param name,could pass more than one param split by ','';'or'\n'
* @param const char* paramValue - [in] param value buffer, malloced by user
* @param int *valueLen - [in, out] pass in length of value buffer, and return length of value string
* @see
*/
int MSPAPI QISRGetParam(const char* sessionID, const char* paramName, char* paramValue, unsigned int* valueLen);
typedef int (MSPAPI *Proc_QISRGetParam)(const char* sessionID, const char* paramName, char* paramValue, unsigned int* valueLen);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISRGetParamW(const wchar_t* sessionID, const wchar_t* paramName, wchar_t* paramValue, unsigned int* valueLen);
typedef int (MSPAPI *Proc_QISRGetParamW)(const wchar_t* sessionID, const wchar_t* paramName, wchar_t* paramValue, unsigned int* valueLen);
#endif
/**
* @fn QISRSetParam
* @brief get params related with msc
*
* the params could be local or server param, we only support netflow params "upflow" & "downflow" now
*
* @return int - Return 0 if success, otherwise return errcode.
* @param const char* sessionID - [in] session id of related param, set NULL to got global param
* @param const char* paramName - [in] param name,could pass more than one param split by ','';'or'\n'
* @param const char* paramValue - [in] param value buffer, malloced by user
* @param int *valueLen - [in, out] pass in length of value buffer, and return length of value string
* @see
*/
int MSPAPI QISRSetParam(const char* sessionID, const char* paramName, const char* paramValue);
typedef int (MSPAPI *Proc_QISRSetParam)(const char* sessionID, const char* paramName, const char* paramValue);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISRSetParamW(const wchar_t* sessionID, const wchar_t* paramName, const wchar_t* paramValue);
typedef int (MSPAPI *Proc_QISRSetParamW)(const wchar_t* sessionID, const wchar_t* paramName, const wchar_t* paramValue);
#endif
typedef void ( *recog_result_ntf_handler)( const char *sessionID, const char *result, int resultLen, int resultStatus, void *userData );
typedef void ( *recog_status_ntf_handler)( const char *sessionID, int type, int status, int param1, const void *param2, void *userData);
typedef void ( *recog_error_ntf_handler)(const char *sessionID, int errorCode, const char *detail, void *userData);
int MSPAPI QISRRegisterNotify(const char *sessionID, recog_result_ntf_handler rsltCb, recog_status_ntf_handler statusCb, recog_error_ntf_handler errCb, void *userData);
typedef int ( *UserCallBack)( int, const char*, void*);
typedef int ( *GrammarCallBack)( int, const char*, void*);
typedef int ( *LexiconCallBack)( int, const char*, void*);
int MSPAPI QISRBuildGrammar(const char *grammarType, const char *grammarContent, unsigned int grammarLength, const char *params, GrammarCallBack callback, void *userData);
typedef int (MSPAPI *Proc_QISRBuildGrammar)(const char *grammarType, const char *grammarContent, unsigned int grammarLength, const char *params, GrammarCallBack callback, void *userData);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISRBuildGrammarW(const wchar_t *grmmarType, const wchar_t *grammarContent, unsigned int grammarLength, const wchar_t *params, GrammarCallBack callback, void *userData);
typedef int (MSPAPI *Proc_QISRBuildGrammarW)(const wchar_t *grmmarType, const wchar_t *grammarContent, unsigned int grammarLength, const wchar_t *params, GrammarCallBack callback, void *userData);
#endif
int MSPAPI QISRUpdateLexicon(const char *lexiconName, const char *lexiconContent, unsigned int lexiconLength, const char *params, LexiconCallBack callback, void *userData);
typedef int (MSPAPI *Proc_QISRUpdataLexicon)(const char *lexiconName, const char *lexiconContent, unsigned int lexiconLength, const char *params, LexiconCallBack callback, void *userData);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QISRUpdateLexiconW(const wchar_t *lexiconName, const wchar_t *lexiconContent, unsigned int lexiconLength, const wchar_t *params, LexiconCallBack callback, void *userData);
typedef int (MSPAPI Proc_QISRUpdateLexiconW)(const wchar_t *lexiconName, const wchar_t *lexiconContent, unsigned int lexiconLength, const wchar_t *params, LexiconCallBack callback, void *userData);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif /* C++ */
#endif /* __QISR_H__ */

View File

@@ -0,0 +1,187 @@
/**
* @file qtts.h
* @brief iFLY Speech Synthesizer Header File
*
* This file contains the quick application programming interface (API) declarations
* of TTS. Developer can include this file in your project to build applications.
* For more information, please read the developer guide.
* Use of this software is subject to certain restrictions and limitations set
* forth in a license agreement entered into between iFLYTEK, Co,LTD.
* and the licensee of this software. Please refer to the license
* agreement for license use rights and restrictions.
*
* Copyright (C) 1999 - 2009 by ANHUI USTC iFLYTEK, Co,LTD.
* All rights reserved.
*
* @author Speech Dept.
* @version 1.0
* @date 2009/11/26
*
* @see
*
* <b>History:</b><br>
* <table>
* <tr> <th>Version <th>Date <th>Author <th>Notes</tr>
* <tr> <td>1.0 <td>2009/11/26 <td>Speech <td>Create this file</tr>
* </table>
*
*/
#ifndef __QTTS_H__
#define __QTTS_H__
#if !defined(MSPAPI)
#if defined(WIN32)
#define MSPAPI __stdcall
#else
#define MSPAPI
#endif /* WIN32 */
#endif /* MSPAPI */
#ifdef __cplusplus
extern "C" {
#endif /* C++ */
#include "msp_types.h"
/**
* @fn QTTSSessionBegin
* @brief Begin a TTS Session
*
* Create a tts session to synthesize data.
*
* @return const char* - Return the new session id in success, otherwise return NULL, error code.
* @param const char* params - [in] parameters when the session created.
* @param const char** sessionID - [out] return a string to this session.
* @see
*/
const char* MSPAPI QTTSSessionBegin(const char* params, int* errorCode);
typedef const char* (MSPAPI *Proc_QTTSSessionBegin)(const char* params, int* errorCode);
#ifdef MSP_WCHAR_SUPPORT
const wchar_t* MSPAPI QTTSSessionBeginW(const wchar_t* params, int* errorCode);
typedef const wchar_t* (MSPAPI *Proc_QTTSSessionBeginW)(const wchar_t* params, int* errorCode);
#endif
/**
* @fn QTTSTextPut
* @brief Put Text Buffer to TTS Session
*
* Writing text string to synthesizer.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* sessionID - [in] The session id returned by sesson begin
* @param const char* textString - [in] text buffer
* @param unsigned int textLen - [in] text size in bytes
* @see
*/
int MSPAPI QTTSTextPut(const char* sessionID, const char* textString, unsigned int textLen, const char* params);
typedef int (MSPAPI *Proc_QTTSTextPut)(const char* sessionID, const char* textString, unsigned int textLen, const char* params);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QTTSTextPutW(const wchar_t* sessionID, const wchar_t* textString, unsigned int textLen, const wchar_t* params);
typedef int (MSPAPI *Proc_QTTSTextPutW)(const wchar_t* sessionID, const wchar_t* textString, unsigned int textLen, const wchar_t* params);
#endif
/**
* @fn QTTSAudioGet
* @brief Synthesize text to audio
*
* Synthesize text to audio, and return audio information.
*
* @return const void* - Return current synthesized audio data buffer, size returned by QTTSTextSynth.
* @param const char* sessionID - [in] session id returned by session begin
* @param unsigned int* audioLen - [out] synthesized audio size in bytes
* @param int* synthStatus - [out] synthesizing status
* @param int* errorCode - [out] error code if failed, 0 to success.
* @see
*/
const void* MSPAPI QTTSAudioGet(const char* sessionID, unsigned int* audioLen, int* synthStatus, int* errorCode);
typedef const void* (MSPAPI *Proc_QTTSAudioGet)(const char* sessionID, unsigned int* audioLen, int* synthStatus, int* errorCode);
#ifdef MSP_WCHAR_SUPPORT
const void* MSPAPI QTTSAudioGetW(const wchar_t* sessionID, unsigned int* audioLen, int* synthStatus, int* errorCode);
typedef const void* (MSPAPI *Proc_QTTSAudioGetW)(const wchar_t* sessionID, unsigned int* audioLen, int* synthStatus, int* errorCode);
#endif
/**
* @fn QTTSAudioInfo
* @brief Get Synthesized Audio information
*
* Get synthesized audio data information.
*
* @return const char * - Return audio info string.
* @param const char* sessionID - [in] session id returned by session begin
* @see
*/
const char* MSPAPI QTTSAudioInfo(const char* sessionID);
typedef const char* (MSPAPI *Proc_QTTSAudioInfo)(const char* sessionID);
#ifdef MSP_WCHAR_SUPPORT
const wchar_t* MSPAPI QTTSAudioInfoW(const wchar_t* sessionID);
typedef const wchar_t* (MSPAPI *Proc_QTTSAudioInfoW)(const wchar_t* sessionID);
#endif
/**
* @fn QTTSSessionEnd
* @brief End a Recognizer Session
*
* End the recognizer session, release all resource.
*
* @return int MSPAPI - Return 0 in success, otherwise return error code.
* @param const char* session_id - [in] session id string to end
* @param const char* hints - [in] user hints to end session, hints will be logged to CallLog
* @see
*/
int MSPAPI QTTSSessionEnd(const char* sessionID, const char* hints);
typedef int (MSPAPI *Proc_QTTSSessionEnd)(const char* sessionID, const char* hints);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QTTSSessionEndW(const wchar_t* sessionID, const wchar_t* hints);
typedef int (MSPAPI *Proc_QTTSSessionEndW)(const wchar_t* sessionID, const wchar_t* hints);
#endif
/**
* @fn QTTSGetParam
* @brief get params related with msc
*
* the params could be local or server param, we only support netflow params "upflow" & "downflow" now
*
* @return int - Return 0 if success, otherwise return errcode.
* @param const char* sessionID - [in] session id of related param, set NULL to got global param
* @param const char* paramName - [in] param name,could pass more than one param split by ','';'or'\n'
* @param const char* paramValue - [in] param value buffer, malloced by user
* @param int *valueLen - [in, out] pass in length of value buffer, and return length of value string
* @see
*/
int MSPAPI QTTSGetParam(const char* sessionID, const char* paramName, char* paramValue, unsigned int* valueLen);
typedef int (MSPAPI *Proc_QTTSGetParam)(const char* sessionID, const char* paramName, char* paramValue, unsigned int* valueLen);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QTTSGetParamW(const wchar_t* sessionID, const wchar_t* paramName, wchar_t* paramValue, unsigned int* valueLen);
typedef int (MSPAPI *Proc_QTTSGetParamW)(const wchar_t* sessionID, const wchar_t* paramName, wchar_t* paramValue, unsigned int* valueLen);
#endif
/**
* @fn QTTSSetParam
* @brief set params related with msc
*
* the params could be local or server param, we only support netflow params "upflow" & "downflow" now
*
* @return int - Return 0 if success, otherwise return errcode.
* @param const char* sessionID - [in] session id of related param, set NULL to got global param
* @param const char* paramName - [in] param name,could pass more than one param split by ','';'or'\n'
* @param const char* paramValue - [in] param value buffer, malloced by user
* @see
*/
int MSPAPI QTTSSetParam(const char *sessionID, const char *paramName, const char *paramValue);
typedef int (MSPAPI *Proc_QTTSSetParam)(const char* sessionID, const char* paramName, char* paramValue);
#ifdef MSP_WCHAR_SUPPORT
int MSPAPI QTTSSetParamW(const wchar_t* sessionID, const wchar_t* paramName, wchar_t* paramValue);
typedef int (MSPAPI *Proc_QTTSSetParamW)(const wchar_t* sessionID, const wchar_t* paramName, wchar_t* paramValue);
#endif
typedef void ( *tts_result_ntf_handler)( const char *sessionID, const char *audio, int audioLen, int synthStatus, int ced, const char *audioInfo, int audioInfoLen, void *userData );
typedef void ( *tts_status_ntf_handler)( const char *sessionID, int type, int status, int param1, const void *param2, void *userData);
typedef void ( *tts_error_ntf_handler)(const char *sessionID, int errorCode, const char *detail, void *userData);
int MSPAPI QTTSRegisterNotify(const char *sessionID, tts_result_ntf_handler rsltCb, tts_status_ntf_handler statusCb, tts_error_ntf_handler errCb, void *userData);
#ifdef __cplusplus
} /* extern "C" */
#endif /* C++ */
#endif /* __QTTS_H__ */

View File

@@ -0,0 +1,63 @@
/*
@file
@brief <20><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ӿں<D3BF>Ѷ<EFBFBD><D1B6>MSC<53>ӿڷ<D3BF>װһ<D7B0><D2BB>MIC¼<43><C2BC>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
@author taozhang9
@date 2016/05/27
*/
enum sr_audsrc
{
SR_MIC, /* write data from mic */
SR_USER /* write data from user by calling API */
};
//#define DEFAULT_INPUT_DEVID (-1)
#define E_SR_NOACTIVEDEVICE 1
#define E_SR_NOMEM 2
#define E_SR_INVAL 3
#define E_SR_RECORDFAIL 4
#define E_SR_ALREADY 5
struct speech_rec_notifier {
void (*on_result)(const char *result, char is_last);
void (*on_speech_begin)();
void (*on_speech_end)(int reason); /* 0 if VAD. others, error : see E_SR_xxx and msp_errors.h */
};
#define END_REASON_VAD_DETECT 0 /* detected speech done */
struct speech_rec {
enum sr_audsrc aud_src; /* from mic or manual stream write */
struct speech_rec_notifier notif;
const char * session_id;
int ep_stat;
int rec_stat;
int audio_status;
struct recorder *recorder;
volatile int state;
char * session_begin_params;
};
#ifdef __cplusplus
extern "C" {
#endif
/* must init before start . is aud_src is SR_MIC, the default capture device
* will be used. see sr_init_ex */
int sr_init(struct speech_rec * sr, const char * session_begin_params, enum sr_audsrc aud_src, struct speech_rec_notifier * notifier);
int sr_start_listening(struct speech_rec *sr);
int sr_stop_listening(struct speech_rec *sr);
/* only used for the manual write way. */
int sr_write_audio_data(struct speech_rec *sr, char *data, unsigned int len);
/* must call uninit after you don't use it */
void sr_uninit(struct speech_rec * sr);
#ifdef __cplusplus
} /* extern "C" */
#endif /* C++ */

View File

@@ -0,0 +1,13 @@
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package='voice_control',
executable='iat_publish',
name='iat_publish',
output='screen'
)
])

Binary file not shown.

23
voice_control/package.xml Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>voice_control</name>
<version>0.0.0</version>
<description>语音控制功能包</description>
<maintainer email="your@email.com">Your Name</maintainer>
<license>Apache-2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<!-- 核心依赖项 -->
<depend>rclcpp</depend>
<depend>std_msgs</depend>
<!-- 根据你的需求添加其他依赖 -->
<build_depend>ament_cmake</build_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>

View File

@@ -0,0 +1,154 @@
/*
* 语音听写(iFly Auto Transform)技术能够实时地将语音转换成对应的文字。
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "voice_control/qisr.h"
#include "voice_control/msp_cmn.h"
#include "voice_control/msp_errors.h"
#include "voice_control/speech_recognizer.h"
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
// 全局标志和结果变量
std::atomic<bool> resultFlag(false);
std::string g_result;
// 科大讯飞语音识别回调函数
void on_result(const char *result, char is_last)
{
if (result != nullptr) {
g_result += result;
resultFlag = true;
RCLCPP_INFO(rclcpp::get_logger("voice_recognition"), "识别结果:%s",result);
}
}
void on_speech_begin()
{
RCLCPP_INFO(rclcpp::get_logger("voice_recognition"), "开始说话...");
}
void on_speech_end(int reason)
{
if (reason == END_REASON_VAD_DETECT) {
RCLCPP_INFO(rclcpp::get_logger("voice_recognition"), "说话结束");
} else {
RCLCPP_WARN(rclcpp::get_logger("voice_recognition"), "说话结束,原因: %d", reason);
}
}
/* demo recognize the audio from microphone */
static void demo_mic(const char* session_begin_params)
{
int errcode;
int i = 0;
struct speech_rec iat;
struct speech_rec_notifier recnotifier = {
on_result,
on_speech_begin,
on_speech_end
};
errcode = sr_init(&iat, session_begin_params, SR_MIC, &recnotifier);
if (errcode) {
printf("speech recognizer init failed\n");
return;
}
errcode = sr_start_listening(&iat);
if (errcode) {
printf("start listen failed %d\n", errcode);
}
/* demo 8 seconds recording */
while(i++ < 8)
sleep(1);
errcode = sr_stop_listening(&iat);
if (errcode) {
printf("stop listening failed %d\n", errcode);
}
sr_uninit(&iat);
}
void WakeUp(const std_msgs::msg::String::ConstPtr& msg)
{
printf("waking up\r\n");
usleep(700*1000);
}
/* main thread: start/stop record ; query the result of recgonization.
* record thread: record callback(data write)
* helper thread: ui(keystroke detection)
*/
int main(int argc, char* argv[])
{
// 初始化ROS 2
rclcpp::init(argc, argv);
auto node = rclcpp::Node::make_shared("voice_recognition");
// 设置循环频率
rclcpp::Rate loop_rate(10);
// 发布语音识别结果
auto voiceWordsPub = node->create_publisher<std_msgs::msg::String>("mic_msg", 1000);
RCLCPP_INFO(node->get_logger(), "Sleeping...");
int ret = MSP_SUCCESS;
/* login params, please do keep the appid correct */
const char* login_params = "appid = 4d9c997f, work_dir = .";
int aud_src = 0; /* from mic or file */
/*
* See "iFlytek MSC Reference Manual"
*/
const char* session_begin_params =
"sub = iat, domain = iat, language = zh_cn, "
"accent = mandarin, sample_rate = 16000, "
"result_type = plain, result_encoding = utf8";
/* Login first. the 1st arg is username, the 2nd arg is password
* just set them as NULL. the 3rd arg is login paramertes
* */
ret = MSPLogin(NULL, NULL, login_params);
if (MSP_SUCCESS != ret) {
printf("MSPLogin failed , Error code %d.\n",ret);
return -1; // 登录失败,退出程序
}
while (rclcpp::ok())
{
// 语音识别唤醒
RCLCPP_INFO(node->get_logger(), "开始从麦克风识别语音");
RCLCPP_INFO(node->get_logger(), "8秒内请说话...");
demo_mic(session_begin_params);
RCLCPP_INFO(node->get_logger(), "8秒已过");
// 语音识别完成,发布结果
if (resultFlag) {
resultFlag = false;
auto msg = std_msgs::msg::String();
msg.data = g_result;
voiceWordsPub->publish(msg);
RCLCPP_INFO(node->get_logger(), "发布识别结果: %s", msg.data.c_str());
g_result.clear(); // 清空结果,准备下一次识别
}
rclcpp::spin_some(node);
loop_rate.sleep();
}
// 退出时清理
MSPLogout();
rclcpp::shutdown();
return 0;
}

View File

@@ -0,0 +1,707 @@
/*
@file
@brief record demo for linux
@author taozhang9
@date 2016/05/27
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <alsa/asoundlib.h>
#include <signal.h>
#include <sys/stat.h>
#include <pthread.h>
#include "voice_control/formats.h"
#include "voice_control/linuxrec.h"
#define DBG_ON 1
#if DBG_ON
#define dbg printf
#else
#define dbg
#endif
/* Do not change the sequence */
enum {
RECORD_STATE_CREATED, /* Init */
RECORD_STATE_CLOSING,
RECORD_STATE_READY, /* Opened */
RECORD_STATE_STOPPING, /* During Stop */
RECORD_STATE_RECORDING, /* Started */
};
#define SAMPLE_RATE 16000
#define SAMPLE_BIT_SIZE 16
#define FRAME_CNT 10
//#define BUF_COUNT 1
#define DEF_BUFF_TIME 500000
#define DEF_PERIOD_TIME 100000
#define DEFAULT_FORMAT \
{\
WAVE_FORMAT_PCM, \
1, \
16000, \
32000, \
2, \
16, \
sizeof(WAVEFORMATEX) \
}
#if 0
struct bufinfo {
char *data;
unsigned int bufsize;
};
#endif
static int show_xrun = 1;
static int start_record_internal(snd_pcm_t *pcm)
{
return snd_pcm_start(pcm);
}
static int stop_record_internal(snd_pcm_t *pcm)
{
return snd_pcm_drop(pcm);
}
static int is_stopped_internal(struct recorder *rec)
{
snd_pcm_state_t state;
state = snd_pcm_state((snd_pcm_t *)rec->wavein_hdl);
switch (state) {
case SND_PCM_STATE_RUNNING:
case SND_PCM_STATE_DRAINING:
return 0;
default: break;
}
return 1;
}
static int format_ms_to_alsa(const WAVEFORMATEX * wavfmt,
snd_pcm_format_t * format)
{
snd_pcm_format_t tmp;
tmp = snd_pcm_build_linear_format(wavfmt->wBitsPerSample,
wavfmt->wBitsPerSample, wavfmt->wBitsPerSample == 8 ? 1 : 0, 0);
if ( tmp == SND_PCM_FORMAT_UNKNOWN )
return -EINVAL;
*format = tmp;
return 0;
}
/* set hardware and software params */
static int set_hwparams(struct recorder * rec, const WAVEFORMATEX *wavfmt,
unsigned int buffertime, unsigned int periodtime)
{
snd_pcm_hw_params_t *params;
int err;
unsigned int rate;
snd_pcm_format_t format;
snd_pcm_uframes_t size;
snd_pcm_t *handle = (snd_pcm_t *)rec->wavein_hdl;
rec->buffer_time = buffertime;
rec->period_time = periodtime;
snd_pcm_hw_params_alloca(&params);
err = snd_pcm_hw_params_any(handle, params);
if (err < 0) {
dbg("Broken configuration for this PCM");
return err;
}
err = snd_pcm_hw_params_set_access(handle, params,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
dbg("Access type not available");
return err;
}
err = format_ms_to_alsa(wavfmt, &format);
if (err) {
dbg("Invalid format");
return - EINVAL;
}
err = snd_pcm_hw_params_set_format(handle, params, format);
if (err < 0) {
dbg("Sample format non available");
return err;
}
err = snd_pcm_hw_params_set_channels(handle, params, wavfmt->nChannels);
if (err < 0) {
dbg("Channels count non available");
return err;
}
rate = wavfmt->nSamplesPerSec;
err = snd_pcm_hw_params_set_rate_near(handle, params, &rate, 0);
if (err < 0) {
dbg("Set rate failed");
return err;
}
if(rate != wavfmt->nSamplesPerSec) {
dbg("Rate mismatch");
return -EINVAL;
}
if (rec->buffer_time == 0 || rec->period_time == 0) {
err = snd_pcm_hw_params_get_buffer_time_max(params,
&rec->buffer_time, 0);
assert(err >= 0);
if (rec->buffer_time > 500000)
rec->buffer_time = 500000;
rec->period_time = rec->buffer_time / 4;
}
err = snd_pcm_hw_params_set_period_time_near(handle, params,
&rec->period_time, 0);
if (err < 0) {
dbg("set period time fail");
return err;
}
err = snd_pcm_hw_params_set_buffer_time_near(handle, params,
&rec->buffer_time, 0);
if (err < 0) {
dbg("set buffer time failed");
return err;
}
err = snd_pcm_hw_params_get_period_size(params, &size, 0);
if (err < 0) {
dbg("get period size fail");
return err;
}
rec->period_frames = size;
err = snd_pcm_hw_params_get_buffer_size(params, &size);
if (size == rec->period_frames) {
dbg("Can't use period equal to buffer size (%lu == %lu)",
size, rec->period_frames);
return -EINVAL;
}
rec->buffer_frames = size;
rec->bits_per_frame = wavfmt->wBitsPerSample;
/* set to driver */
err = snd_pcm_hw_params(handle, params);
if (err < 0) {
dbg("Unable to install hw params:");
return err;
}
return 0;
}
static int set_swparams(struct recorder * rec)
{
int err;
snd_pcm_sw_params_t *swparams;
snd_pcm_t * handle = (snd_pcm_t*)(rec->wavein_hdl);
/* sw para */
snd_pcm_sw_params_alloca(&swparams);
err = snd_pcm_sw_params_current(handle, swparams);
if (err < 0) {
dbg("get current sw para fail");
return err;
}
err = snd_pcm_sw_params_set_avail_min(handle, swparams,
rec->period_frames);
if (err < 0) {
dbg("set avail min failed");
return err;
}
/* set a value bigger than the buffer frames to prevent the auto start.
* we use the snd_pcm_start to explicit start the pcm */
err = snd_pcm_sw_params_set_start_threshold(handle, swparams,
rec->buffer_frames * 2);
if (err < 0) {
dbg("set start threshold fail");
return err;
}
if ( (err = snd_pcm_sw_params(handle, swparams)) < 0) {
dbg("unable to install sw params:");
return err;
}
return 0;
}
static int set_params(struct recorder *rec, WAVEFORMATEX *fmt,
unsigned int buffertime, unsigned int periodtime)
{
int err;
WAVEFORMATEX defmt = DEFAULT_FORMAT;
if (fmt == NULL) {
fmt = &defmt;
}
err = set_hwparams(rec, fmt, buffertime, periodtime);
if (err)
return err;
err = set_swparams(rec);
if (err)
return err;
return 0;
}
/*
* Underrun and suspend recovery
*/
static int xrun_recovery(snd_pcm_t *handle, int err)
{
if (err == -EPIPE) { /* over-run */
if (show_xrun)
printf("!!!!!!overrun happend!!!!!!");
err = snd_pcm_prepare(handle);
if (err < 0) {
if (show_xrun)
printf("Can't recovery from overrun,"
"prepare failed: %s\n", snd_strerror(err));
return err;
}
return 0;
} else if (err == -ESTRPIPE) {
while ((err = snd_pcm_resume(handle)) == -EAGAIN)
usleep(200000); /* wait until the suspend flag is released */
if (err < 0) {
err = snd_pcm_prepare(handle);
if (err < 0) {
if (show_xrun)
printf("Can't recovery from suspend,"
"prepare failed: %s\n", snd_strerror(err));
return err;
}
}
return 0;
}
return err;
}
static ssize_t pcm_read(struct recorder *rec, size_t rcount)
{
ssize_t r;
size_t count = rcount;
char *data;
snd_pcm_t *handle = (snd_pcm_t *)rec->wavein_hdl;
if(!handle)
return -EINVAL;
data = rec->audiobuf;
while (count > 0) {
r = snd_pcm_readi(handle, data, count);
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
snd_pcm_wait(handle, 100);
} else if (r < 0) {
if(xrun_recovery(handle, r) < 0) {
return -1;
}
}
if (r > 0) {
count -= r;
data += r * rec->bits_per_frame / 8;
}
}
return rcount;
}
static void * record_thread_proc(void * para)
{
struct recorder * rec = (struct recorder *) para;
size_t frames, bytes;
sigset_t mask, oldmask;
sigemptyset(&mask);
sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGTERM);
pthread_sigmask(SIG_BLOCK, &mask, &oldmask);
while(1) {
frames = rec->period_frames;
bytes = frames * rec->bits_per_frame / 8;
/* closing, exit the thread */
if (rec->state == RECORD_STATE_CLOSING)
break;
if(rec->state < RECORD_STATE_RECORDING)
usleep(100000);
if (pcm_read(rec, frames) != frames) {
return NULL;
}
if (rec->on_data_ind)
rec->on_data_ind(rec->audiobuf, bytes,
rec->user_cb_para);
}
return rec;
}
static int create_record_thread(void * para, pthread_t * tidp)
{
int err;
err = pthread_create(tidp, NULL, record_thread_proc, (void *)para);
if (err != 0)
return err;
return 0;
}
#if 0 /* don't use it now... cuz only one buffer supported */
static void free_rec_buffer(struct recorder * rec)
{
if (rec->bufheader) {
unsigned int i;
struct bufinfo *info = (struct bufinfo *) rec->bufheader;
assert(rec->bufcount > 0);
for (i = 0; i < rec->bufcount; ++i) {
if (info->data) {
free(info->data);
info->data = NULL;
info->bufsize = 0;
info->audio_bytes = 0;
}
info++;
}
free(rec->bufheader);
rec->bufheader = NULL;
}
rec->bufcount = 0;
}
static int prepare_rec_buffer(struct recorder * rec )
{
struct bufinfo *buffers;
unsigned int i;
int err;
size_t sz;
/* the read and QISRWrite is blocked, currently only support one buffer,
* if overrun too much, need more buffer and another new thread
* to write the audio to network */
rec->bufcount = 1;
sz = sizeof(struct bufinfo)*rec->bufcount;
buffers=(struct bufinfo*)malloc(sz);
if (!buffers) {
rec->bufcount = 0;
goto fail;
}
memset(buffers, 0, sz);
rec->bufheader = buffers;
for (i = 0; i < rec->bufcount; ++i) {
buffers[i].bufsize =
(rec->period_frames * rec->bits_per_frame / 8);
buffers[i].data = (char *)malloc(buffers[i].bufsize);
if (!buffers[i].data) {
buffers[i].bufsize = 0;
goto fail;
}
buffers[i].audio_bytes = 0;
}
return 0;
fail:
free_rec_buffer(rec);
return -ENOMEM;
}
#else
static void free_rec_buffer(struct recorder * rec)
{
if (rec->audiobuf) {
free(rec->audiobuf);
rec->audiobuf = NULL;
}
}
static int prepare_rec_buffer(struct recorder * rec )
{
/* the read and QISRWrite is blocked, currently only support one buffer,
* if overrun too much, need more buffer and another new thread
* to write the audio to network */
size_t sz = (rec->period_frames * rec->bits_per_frame / 8);
rec->audiobuf = (char *)malloc(sz);
if(!rec->audiobuf)
return -ENOMEM;
return 0;
}
#endif
static int open_recorder_internal(struct recorder * rec,
record_dev_id dev, WAVEFORMATEX * fmt)
{
int err = 0;
err = snd_pcm_open((snd_pcm_t **)&rec->wavein_hdl, dev.u.name,
SND_PCM_STREAM_CAPTURE, 0);
if(err < 0)
goto fail;
err = set_params(rec, fmt, DEF_BUFF_TIME, DEF_PERIOD_TIME);
if(err)
goto fail;
assert(rec->bufheader == NULL);
err = prepare_rec_buffer(rec);
if(err)
goto fail;
err = create_record_thread((void*)rec,
&rec->rec_thread);
if(err)
goto fail;
return 0;
fail:
if(rec->wavein_hdl)
snd_pcm_close((snd_pcm_t *) rec->wavein_hdl);
rec->wavein_hdl = NULL;
free_rec_buffer(rec);
return err;
}
static void close_recorder_internal(struct recorder *rec)
{
snd_pcm_t * handle;
handle = (snd_pcm_t *) rec->wavein_hdl;
/* may be the thread is blocked at read, cancel it */
pthread_cancel(rec->rec_thread);
/* wait for the pcm thread quit first */
pthread_join(rec->rec_thread, NULL);
if(handle) {
snd_pcm_close(handle);
rec->wavein_hdl = NULL;
}
free_rec_buffer(rec);
}
/* return the count of pcm device */
/* list all cards */
static int get_pcm_device_cnt(snd_pcm_stream_t stream)
{
void **hints, **n;
char *io, *filter, *name;
int cnt = 0;
if (snd_device_name_hint(-1, "pcm", &hints) < 0)
return 0;
n = hints;
filter = stream == SND_PCM_STREAM_CAPTURE ? "Input" : "Output";
while (*n != NULL) {
io = snd_device_name_get_hint(*n, "IOID");
name = snd_device_name_get_hint(*n, "NAME");
if (name && (io == NULL || strcmp(io, filter) == 0))
cnt ++;
if (io != NULL)
free(io);
if (name != NULL)
free(name);
n++;
}
snd_device_name_free_hint(hints);
return cnt;
}
static void free_name_desc(char **name_or_desc)
{
char **ss;
ss = name_or_desc;
if(NULL == name_or_desc)
return;
while(*name_or_desc) {
free(*name_or_desc);
*name_or_desc = NULL;
name_or_desc++;
}
free(ss);
}
/* return success: total count, need free the name and desc buffer
* fail: -1 , *name_out and *desc_out will be NULL */
static int list_pcm(snd_pcm_stream_t stream, char**name_out,
char ** desc_out)
{
void **hints, **n;
char **name, **descr;
char *io;
const char *filter;
int cnt = 0;
int i = 0;
if (snd_device_name_hint(-1, "pcm", &hints) < 0)
return 0;
n = hints;
cnt = get_pcm_device_cnt(stream);
if(!cnt) {
goto fail;
}
*name_out = calloc(sizeof(char *) , (1+cnt));
if (*name_out == NULL)
goto fail;
*desc_out = calloc(sizeof(char *) , (1 + cnt));
if (*desc_out == NULL)
goto fail;
/* the last one is a flag, NULL */
name_out[cnt] = NULL;
desc_out[cnt] = NULL;
name = name_out;
descr = desc_out;
filter = stream == SND_PCM_STREAM_CAPTURE ? "Input" : "Output";
while (*n != NULL && i < cnt) {
*name = snd_device_name_get_hint(*n, "NAME");
*descr = snd_device_name_get_hint(*n, "DESC");
io = snd_device_name_get_hint(*n, "IOID");
if (name == NULL ||
(io != NULL && strcmp(io, filter) != 0) ){
if (*name) free(*name);
if (*descr) free(*descr);
} else {
if (*descr == NULL) {
*descr = malloc(4);
memset(*descr, 0, 4);
}
name++;
descr++;
i++;
}
if (io != NULL)
free(io);
n++;
}
snd_device_name_free_hint(hints);
return cnt;
fail:
free_name_desc(name_out);
free_name_desc(desc_out);
snd_device_name_free_hint(hints);
return -1;
}
/* -------------------------------------
* Interfaces
--------------------------------------*/
/* the device id is a pcm string name in linux */
record_dev_id get_default_input_dev()
{
record_dev_id id;
id.u.name = "default";
return id;
}
record_dev_id * list_input_device()
{
// TODO: unimplemented
return NULL;
}
int get_input_dev_num()
{
return get_pcm_device_cnt(SND_PCM_STREAM_CAPTURE);
}
/* callback will be run on a new thread */
int create_recorder(struct recorder ** out_rec,
void (*on_data_ind)(char *data, unsigned long len, void *user_cb_para),
void* user_cb_para)
{
struct recorder * myrec;
myrec = (struct recorder *)malloc(sizeof(struct recorder));
if(!myrec)
return -RECORD_ERR_MEMFAIL;
memset(myrec, 0, sizeof(struct recorder));
myrec->on_data_ind = on_data_ind;
myrec->user_cb_para = user_cb_para;
myrec->state = RECORD_STATE_CREATED;
*out_rec = myrec;
return 0;
}
void destroy_recorder(struct recorder *rec)
{
if(!rec)
return;
free(rec);
}
int open_recorder(struct recorder * rec, record_dev_id dev, WAVEFORMATEX * fmt)
{
int ret = 0;
if(!rec )
return -RECORD_ERR_INVAL;
if(rec->state >= RECORD_STATE_READY)
return 0;
ret = open_recorder_internal(rec, dev, fmt);
if(ret == 0)
rec->state = RECORD_STATE_READY;
return 0;
}
void close_recorder(struct recorder *rec)
{
if(rec == NULL || rec->state < RECORD_STATE_READY)
return;
if(rec->state == RECORD_STATE_RECORDING)
stop_record(rec);
rec->state = RECORD_STATE_CLOSING;
close_recorder_internal(rec);
rec->state = RECORD_STATE_CREATED;
}
int start_record(struct recorder * rec)
{
int ret;
if(rec == NULL)
return -RECORD_ERR_INVAL;
if( rec->state < RECORD_STATE_READY)
return -RECORD_ERR_NOT_READY;
if( rec->state == RECORD_STATE_RECORDING)
return 0;
ret = start_record_internal((snd_pcm_t *)rec->wavein_hdl);
if(ret == 0)
rec->state = RECORD_STATE_RECORDING;
return ret;
}
int stop_record(struct recorder * rec)
{
int ret;
if(rec == NULL)
return -RECORD_ERR_INVAL;
if( rec->state < RECORD_STATE_RECORDING)
return 0;
rec->state = RECORD_STATE_STOPPING;
ret = stop_record_internal((snd_pcm_t *)rec->wavein_hdl);
if(ret == 0) {
rec->state = RECORD_STATE_READY;
}
return ret;
}
int is_record_stopped(struct recorder *rec)
{
if(rec->state == RECORD_STATE_RECORDING)
return 0;
return is_stopped_internal(rec);
}

View File

@@ -0,0 +1,374 @@
/*
@file
@brief a simple demo to recognize speech from microphone
@author taozhang9
@date 2016/05/27
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "voice_control/speech_recognizer.h"
#include "voice_control/qisr.h"
#include "voice_control/msp_cmn.h"
#include "voice_control/msp_errors.h"
#include "voice_control/linuxrec.h"
#define SR_DBGON 1
#if SR_DBGON == 1
# define sr_dbg printf
#else
# define sr_dbg
#endif
#define DEFAULT_SESSION_PARA \
"sub = iat, domain = iat, language = zh_cn, accent = mandarin, sample_rate = 16000, result_type = plain, result_encoding = utf8"
#define DEFAULT_FORMAT \
{\
WAVE_FORMAT_PCM, \
1, \
16000, \
32000, \
2, \
16, \
sizeof(WAVEFORMATEX) \
}
/* internal state */
enum {
SR_STATE_INIT,
SR_STATE_STARTED
};
#define SR_MALLOC malloc
#define SR_MFREE free
#define SR_MEMSET memset
static void Sleep(size_t ms)
{
usleep(ms*1000);
}
static void end_sr_on_error(struct speech_rec *sr, int errcode)
{
if(sr->aud_src == SR_MIC)
stop_record(sr->recorder);
if (sr->session_id) {
if (sr->notif.on_speech_end)
sr->notif.on_speech_end(errcode);
QISRSessionEnd(sr->session_id, "err");
sr->session_id = NULL;
}
sr->state = SR_STATE_INIT;
}
static void end_sr_on_vad(struct speech_rec *sr)
{
int errcode;
const char *rslt;
if (sr->aud_src == SR_MIC)
stop_record(sr->recorder);
while(sr->rec_stat != MSP_REC_STATUS_COMPLETE ){
rslt = QISRGetResult(sr->session_id, &sr->rec_stat, 0, &errcode);
if (rslt && sr->notif.on_result)
sr->notif.on_result(rslt, sr->rec_stat == MSP_REC_STATUS_COMPLETE ? 1 : 0);
Sleep(100); /* for cpu occupy, should sleep here */
}
if (sr->session_id) {
if (sr->notif.on_speech_end)
sr->notif.on_speech_end(END_REASON_VAD_DETECT);
QISRSessionEnd(sr->session_id, "VAD Normal");
sr->session_id = NULL;
}
sr->state = SR_STATE_INIT;
}
/* the record call back */
static void iat_cb(char *data, unsigned long len, void *user_para)
{
int errcode;
struct speech_rec *sr;
if(len == 0 || data == NULL)
return;
sr = (struct speech_rec *)user_para;
if(sr == NULL || sr->ep_stat >= MSP_EP_AFTER_SPEECH)
return;
if (sr->state < SR_STATE_STARTED)
return; /* ignore the data if error/vad happened */
errcode = sr_write_audio_data(sr, data, len);
if (errcode) {
end_sr_on_error(sr, errcode);
return;
}
}
static char * skip_space(char *s)
{
while (s && *s != ' ' && *s != '\0')
s++;
return s;
}
static int update_format_from_sessionparam(const char * session_para, WAVEFORMATEX *wavefmt)
{
char *s;
if ((s = strstr(session_para, "sample_rate"))) {
s = strstr(s, "=");
if (s && *s) {
s = skip_space(s);
if (s && *s) {
wavefmt->nSamplesPerSec = atoi(s);
wavefmt->nAvgBytesPerSec = wavefmt->nBlockAlign * wavefmt->nSamplesPerSec;
}
}
else
return -1;
}
else {
return -1;
}
return 0;
}
/* devid will be ignored if aud_src is not SR_MIC ; use get_default_dev_id
* to use the default input device. Currently the device list function is
* not provided yet.
*/
int sr_init_ex(struct speech_rec * sr, const char * session_begin_params,
enum sr_audsrc aud_src, record_dev_id devid,
struct speech_rec_notifier * notify)
{
int errcode;
size_t param_size;
WAVEFORMATEX wavfmt = DEFAULT_FORMAT;
if (aud_src == SR_MIC && get_input_dev_num() == 0) {
return -E_SR_NOACTIVEDEVICE;
}
if (!sr)
return -E_SR_INVAL;
if (session_begin_params == NULL) {
session_begin_params = DEFAULT_SESSION_PARA;
}
SR_MEMSET(sr, 0, sizeof(struct speech_rec));
sr->state = SR_STATE_INIT;
sr->aud_src = aud_src;
sr->ep_stat = MSP_EP_LOOKING_FOR_SPEECH;
sr->rec_stat = MSP_REC_STATUS_SUCCESS;
sr->audio_status = MSP_AUDIO_SAMPLE_FIRST;
param_size = strlen(session_begin_params) + 1;
sr->session_begin_params = (char*)SR_MALLOC(param_size);
if (sr->session_begin_params == NULL) {
sr_dbg("mem alloc failed\n");
return -E_SR_NOMEM;
}
strncpy(sr->session_begin_params, session_begin_params, param_size);
sr->notif = *notify;
if (aud_src == SR_MIC) {
errcode = create_recorder(&sr->recorder, iat_cb, (void*)sr);
if (sr->recorder == NULL || errcode != 0) {
sr_dbg("create recorder failed: %d\n", errcode);
errcode = -E_SR_RECORDFAIL;
goto fail;
}
update_format_from_sessionparam(session_begin_params, &wavfmt);
errcode = open_recorder(sr->recorder, devid, &wavfmt);
if (errcode != 0) {
sr_dbg("recorder open failed: %d\n", errcode);
errcode = -E_SR_RECORDFAIL;
goto fail;
}
}
return 0;
fail:
if (sr->recorder) {
destroy_recorder(sr->recorder);
sr->recorder = NULL;
}
if (sr->session_begin_params) {
SR_MFREE(sr->session_begin_params);
sr->session_begin_params = NULL;
}
SR_MEMSET(&sr->notif, 0, sizeof(sr->notif));
return errcode;
}
/* use the default input device to capture the audio. see sr_init_ex */
int sr_init(struct speech_rec * sr, const char * session_begin_params,
enum sr_audsrc aud_src, struct speech_rec_notifier * notify)
{
return sr_init_ex(sr, session_begin_params, aud_src,
get_default_input_dev(), notify);
}
int sr_start_listening(struct speech_rec *sr)
{
int ret;
const char* session_id = NULL;
int errcode = MSP_SUCCESS;
if (sr->state >= SR_STATE_STARTED) {
sr_dbg("already STARTED.\n");
return -E_SR_ALREADY;
}
session_id = QISRSessionBegin(NULL, sr->session_begin_params, &errcode); //<2F><>д<EFBFBD><D0B4><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFB7A8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪNULL
if (MSP_SUCCESS != errcode)
{
sr_dbg("\nQISRSessionBegin failed! error code:%d\n", errcode);
return errcode;
}
sr->session_id = session_id;
sr->ep_stat = MSP_EP_LOOKING_FOR_SPEECH;
sr->rec_stat = MSP_REC_STATUS_SUCCESS;
sr->audio_status = MSP_AUDIO_SAMPLE_FIRST;
if (sr->aud_src == SR_MIC) {
ret = start_record(sr->recorder);
if (ret != 0) {
sr_dbg("start record failed: %d\n", ret);
QISRSessionEnd(session_id, "start record fail");
sr->session_id = NULL;
return -E_SR_RECORDFAIL;
}
}
sr->state = SR_STATE_STARTED;
if (sr->notif.on_speech_begin)
sr->notif.on_speech_begin();
return 0;
}
/* after stop_record, there are still some data callbacks */
static void wait_for_rec_stop(struct recorder *rec, unsigned int timeout_ms)
{
while (!is_record_stopped(rec)) {
Sleep(1);
if (timeout_ms != (unsigned int)-1)
if (0 == timeout_ms--)
break;
}
}
int sr_stop_listening(struct speech_rec *sr)
{
int ret = 0;
const char * rslt = NULL;
if (sr->state < SR_STATE_STARTED) {
sr_dbg("Not started or already stopped.\n");
return 0;
}
if (sr->aud_src == SR_MIC) {
ret = stop_record(sr->recorder);
if (ret != 0) {
sr_dbg("Stop failed! \n");
return -E_SR_RECORDFAIL;
}
wait_for_rec_stop(sr->recorder, (unsigned int)-1);
}
sr->state = SR_STATE_INIT;
ret = QISRAudioWrite(sr->session_id, NULL, 0, MSP_AUDIO_SAMPLE_LAST, &sr->ep_stat, &sr->rec_stat);
if (ret != 0) {
sr_dbg("write LAST_SAMPLE failed: %d\n", ret);
QISRSessionEnd(sr->session_id, "write err");
return ret;
}
while (sr->rec_stat != MSP_REC_STATUS_COMPLETE) {
rslt = QISRGetResult(sr->session_id, &sr->rec_stat, 0, &ret);
if (MSP_SUCCESS != ret) {
sr_dbg("\nQISRGetResult failed! error code: %d\n", ret);
end_sr_on_error(sr, ret);
return ret;
}
if (NULL != rslt && sr->notif.on_result)
sr->notif.on_result(rslt, sr->rec_stat == MSP_REC_STATUS_COMPLETE ? 1 : 0);
Sleep(100);
}
QISRSessionEnd(sr->session_id, "normal");
sr->session_id = NULL;
return 0;
}
int sr_write_audio_data(struct speech_rec *sr, char *data, unsigned int len)
{
const char *rslt = NULL;
int ret = 0;
if (!sr )
return -E_SR_INVAL;
if (!data || !len)
return 0;
ret = QISRAudioWrite(sr->session_id, data, len, sr->audio_status, &sr->ep_stat, &sr->rec_stat);
if (ret) {
end_sr_on_error(sr, ret);
return ret;
}
sr->audio_status = MSP_AUDIO_SAMPLE_CONTINUE;
if (MSP_REC_STATUS_SUCCESS == sr->rec_stat) { //<2F>Ѿ<EFBFBD><D1BE>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>
rslt = QISRGetResult(sr->session_id, &sr->rec_stat, 0, &ret);
if (MSP_SUCCESS != ret) {
sr_dbg("\nQISRGetResult failed! error code: %d\n", ret);
end_sr_on_error(sr, ret);
return ret;
}
if (NULL != rslt && sr->notif.on_result)
sr->notif.on_result(rslt, sr->rec_stat == MSP_REC_STATUS_COMPLETE ? 1 : 0);
}
if (MSP_EP_AFTER_SPEECH == sr->ep_stat)
end_sr_on_vad(sr);
return 0;
}
void sr_uninit(struct speech_rec * sr)
{
if (sr->recorder) {
if(!is_record_stopped(sr->recorder))
stop_record(sr->recorder);
close_recorder(sr->recorder);
destroy_recorder(sr->recorder);
sr->recorder = NULL;
}
if (sr->session_begin_params) {
SR_MFREE(sr->session_begin_params);
sr->session_begin_params = NULL;
}
}