Java通过jna调用实现语音识别功能

开发 后端
java调用.dll获取.so一般通过JNI,但是JNI的使用比较复杂,需要用C另写一个共享库进行适配。而JNA是一个自动适配工具,通过它调用.dll只需要一个借口即可。

语音识别技术

语音识别就是让机器通过识别和理解过程把语音信号转变为相应的文本或命令。语音识别技术主要包括特征提取技术、模式匹配准则及模型训练技术三个方面。说实话其中的技术比较多,要独立开发新的基本上不现实。所以自然把目光放到开源项目或者其他公司的API上面了。开源项目我尝试了SpeakRight和sphinx4,但是效果都是一般。AT&T的API老是申请不上,最后把目光放在科大讯飞上了。试用了一下,效果还行,但是它提供的Windows平台的API是C/C++的,我只懂点皮毛,所以稍微研究了一下通过Java调用它的语音云SDK。

JNA

java调用.dll获取.so一般通过JNI,但是JNI的使用比较复杂,需要用C另写一个共享库进行适配。而JNA是一个自动适配工具,通过它调用.dll只需要一个借口即可。

官网:https://github.com/twall/jna/。下载jna.jar即可。

编写接口

科大讯飞语音云主要提供语音合成和语音识别两个方面的东西,我主要使用语音识别这块的功能。

建立接口QTSR,继承Library。

将msc.dll等文件复制到项目根目录。

jna-yuyinshibie-01

加载msc.dll

  1. QTSR INSTANCE = (QTSR) Native.loadLibrary("msc", QTSR.class); 

然后来看一下msc.dll公开了哪些方法。首先是QISRInit,这是一个全局初始化函数。

jna-yuyinshibie-02 

它的返回值为int,参数是const char*。int还是java的int,但是char*就对应的是java的String了。

所以在QTSR中添加方法:

  1. public int QISRInit(String configs); 

返回值在msp_errors.h中定义,等一下我们还是要弄在java里面去。

继续看QISRInit函数,在官方文档中有调用示例:

  1. const char* configs=“server_url=dev.voicecloud.cn, timeout=10000, vad_enable=true”;     
  2. int   ret = QISRInit( configs );     
  3. if(MSP_SUCCESS != ret )     
  4. {     
  5.         printf( “QISRInit failed, error code is: %d”, ret );     

对应的在java中的调用代码如下:

  1. String config = "server_url=dev.voicecloud.cn, timeout=10000, vad_enable=true";   
  2. int code = QTSR.INSTANCE.QISRInit(config);   
  3. if (code != 0) {   
  4.   System.out.println("QISRInit failed, error code is:" + code);   

我们在看一个函数:QISRSessionBegin,这个开始一路ISR会话。

jna-yuyinshibie-03 

还是刚才的思路,char*对应java的String,但是注意一下int *errorCode。这个函数其实传入两个参数,传出两个参数。即本身返回的sessionId,还有errorCode。

这里的int*对应的是jna的IntByReference。所以添加方法:

  1. public String QISRSessionBegin(String grammarList, String params,IntByReference errorCode); 

同样看看官方示例:

  1. /* vad_timeout和vad_speech_tail两个参数只有在打开VAD功能时才生效 */ 
  2. const char*      params=     
  3. “ssm=1,sub=iat,aue=speex-wb;7,auf=audio/L16;rate=16000,ent=sms16k,rst=plain,vad_timeout=1000,vad_speech_tail=1000”;   
  4. int ret = MSP_SUCCESS;     
  5. const char*     session_id = QISRSessionBegin( NULL, params, &ret );     
  6. if(MSP_SUCCESS != ret )     
  7. {     
  8.         printf( “QISRSessionBegin failed, error code is: %d”, ret );     

在java这样写:

  1. String params = "ssm=1,sub=iat,aue=speex-wb;7,auf=audio/L16;rate=16000,ent=sms16k,rst=plain,vad_timeout=1000,vad_speech_tail=1000";   
  2. IntByReference errorCode = new IntByReference();   
  3. String sessionId = QTSR.INSTANCE.QISRSessionBegin(null, params,errorCode);   

运行效果:

 

jna-yuyinshibie-04

其他的函数处理方式大致相同,这里贴上一个c和java在jna中的类型对应表:

其中Unsigned类型和signed在java中对应是一样的。

.h文件和常量处理

在SDK的include目录有4个.h文件,定义了一些常量,比如上面一节中的0其实是msp_errors.h中MSP_SUCCESS。

我以msp_errors.h为例,建立一个接口Msp_errors,继承StdCallLibrary。

照着msp_errors.h中的定义在Msp_errors中进行定义。

  1. public static final int MSP_SUCCESS = 0;   
  2. public static final int ERROR_FAIL  = -1;   
  3. public static final int ERROR_EXCEPTION= -2;   
  4. public static final int ERROR_GENERAL= 10100;      
  5. public static final int ERROR_OUT_OF_MEMORY= 10101;        
  6. public static final int ERROR_FILE_NOT_FOUND= 10102;       
  7. public static final int ERROR_NOT_SUPPORT= 10103;     

使用很简单的,比如MSP_SUCCESS 就是Msp_errors.MSP_SUCCESS。

#p#

完整代码和文件

这个只是语音识别部分的,语音合成的话我记得有人做过jni接口的。

*QTSR.java

  1. package com.cnblogs.htynkn;  
  2.    
  3. import com.sun.jna.Library;  
  4. import com.sun.jna.Native;  
  5. import com.sun.jna.Pointer;  
  6. import com.sun.jna.ptr.IntByReference;  
  7.    
  8. /**  
  9.  * @author 夜明的孤行灯  
  10.  * @date 2012-7-5  
  11.  */ 
  12.    
  13. public interface QTSR extends Library {  
  14.     QTSR INSTANCE = (QTSR) Native.loadLibrary("msc", QTSR.class);  
  15.    
  16.     /**  
  17.      * 初始化MSC的ISR部分  
  18.      *  
  19.      * @param configs  
  20.      *            初始化时传入的字符串,以指定合成用到的一些配置参数,各个参数以“参数名=参数值”的形式出现,大小写不敏感,不同的参数之间以“  
  21.      *            ,”或“\n”隔开,不设置任何值时可以传入NULL或空串:  
  22.      * @return 如果函数调用成功返回MSP_SUCCESS,否则返回错误代码,错误代码参见msp_errors  
  23.      */ 
  24.     public int QISRInit(String configs);  
  25.    
  26.     /**  
  27.      * 开始一个ISR会话  
  28.      *  
  29.      * @param grammarList  
  30.      *            uri-list格式的语法,可以是一个语法文件的URL或者一个引擎内置语法列表。可以同时指定多个语法,不同的语法之间以“,”  
  31.      *            隔开。进行语音听写时不需要语法,此参数设定为NULL或空串即可;进行语音识别时则需要语法,语法可以在此参数中指定,  
  32.      *            也可以随后调用QISRGrammarActivate指定识别所用的语法。  
  33.      * @param params  
  34.      *            本路ISR会话使用的参数,可设置的参数及其取值范围请参考《可设置参数列表_MSP20.xls》,各个参数以“参数名=参数值”  
  35.      *            的形式出现,不同的参数之间以“,”或者“\n”隔开。  
  36.      * @param errorCode  
  37.      *            如果函数调用成功则其值为MSP_SUCCESS,否则返回错误代码,错误代码参见msp_errors。几个主要的返回值:  
  38.      *            MSP_ERROR_NOT_INIT 未初始化 MSP_ERROR_INVALID_PARA 无效的参数  
  39.      *            MSP_ERROR_NO_LICENSE 开始一路会话失败  
  40.      * @return MSC为本路会话建立的ID,用来唯一的标识本路会话,供以后调用其他函数时使用。函数调用失败则会返回NULL。  
  41.      */ 
  42.     public String QISRSessionBegin(String grammarList, String params,  
  43.             IntByReference errorCode);  
  44.    
  45.     /**  
  46.      * 传入语法  
  47.      *  
  48.      * @param sessionID  
  49.      *            由QISRSessionBegin返回过来的会话ID。  
  50.      * @param grammar  
  51.      *            语法字符串  
  52.      * @param type  
  53.      *            语法类型,可以是uri-list、abnf、xml等  
  54.      * @param weight  
  55.      *            本次传入语法的权重,本参数在MSP 2.0中会被忽略。  
  56.      * @return 如果函数调用成功返回MSP_SUCCESS,否则返回错误代码,错误代码参见msp_errors  
  57.      */ 
  58.     public int QISRGrammarActivate(String sessionID, String grammar,  
  59.             String type, int weight);  
  60.    
  61.     /**  
  62.      * 写入用来识别的语音  
  63.      *  
  64.      * @param sessionID  
  65.      *            由QISRSessionBegin返回过来的会话ID。  
  66.      * @param waveData  
  67.      *            音频数据缓冲区起始地址  
  68.      * @param waveLen  
  69.      *            音频数据长度,其大小不能超过设定的max_audio_size  
  70.      * @param audioStatus  
  71.      *            用来指明用户本次识别的音频是否发送完毕,可能值如下:  
  72.      *            MSP_AUDIO_SAMPLE_FIRST = 1 第一块音频  
  73.      *            MSP_AUDIO_SAMPLE_CONTINUE = 2 还有后继音频  
  74.      *            MSP_AUDIO_SAMPLE_LAST = 4 最后一块音频  
  75.      * @param epStatus  
  76.      *            端点检测(End-point detected)器所处的状态,可能的值如下:  
  77.      *            MSP _EP_LOOKING_FOR_SPEECH = 0 还没有检测到音频的前端点。  
  78.      *            MSP _EP_IN_SPEECH = 1 已经检测到了音频前端点,正在进行正常的音频处理。  
  79.      *            MSP _EP_AFTER_SPEECH = 3 检测到音频的后端点,后继的音频会被MSC忽略。  
  80.      *            MSP _EP_TIMEOUT = 4 超时。  
  81.      *            MSP _EP_ERROR= 5 出现错误。  
  82.      *            MSP _EP_MAX_SPEECH = 6 音频过大。  
  83.      * @param recogStatus  
  84.      *            识别器所处的状态  
  85.      * @return  
  86.      */ 
  87.     public int QISRAudioWrite(String sessionID, Pointer waveData, int waveLen,  
  88.             int audioStatus, IntByReference epStatus, IntByReference recogStatus);  
  89.    
  90.     /**  
  91.      * 获取识别结果  
  92.      *  
  93.      * @param sessionID 由QISRSessionBegin返回过来的会话ID。  
  94.      * @param rsltStatus 识别结果的状态,其取值范围和含义请参考QISRAudioWrite的参数recogStatus  
  95.      * @param waitTime 与服务器交互的间隔时间,可以控制和服务器的交互频度。单位为ms,建议取值为5000。  
  96.      * @param errorCode 如果函数调用成功返回MSP_SUCCESS,否则返回错误代码,错误代码参见msp_errors  
  97.      * @return 函数执行成功并且获取到识别结果时返回识别结果,函数执行成功没有获取到识别结果时返回NULL  
  98.      */ 
  99.     public String QISRGetResult(String sessionID, IntByReference rsltStatus,  
  100.             int waitTime, IntByReference errorCode);  
  101.    
  102.     /**  
  103.      * 结束一路会话  
  104.      *  
  105.      * @param sessionID 由QISRSessionBegin返回过来的会话ID。  
  106.      * @param hints 结束本次会话的原因描述,用于记录日志,便于用户查阅或者跟踪某些问题。  
  107.      * @return  
  108.      */ 
  109.     public int QISRSessionEnd(String sessionID, String hints);  
  110.    
  111.     /**  
  112.      * 获取与识别交互相关的参数  
  113.      *  
  114.      * @param sessionID 由QISRSessionBegin返回过来的会话ID。  
  115.      * @param paramName 要获取的参数名称;支持同时查询多个参数,查询多个参数时,参数名称按“,” 或“\n”分隔开来。  
  116.      * @param paramValue 获取的参数值,以字符串形式返回;查询多个参数时,参数值之间以“;”分开,不支持的参数将返回空的值。  
  117.      * @param valueLen 参数值的长度。  
  118.      * @return  
  119.      */ 
  120.     public int QISRGetParam(String sessionID, String paramName,  
  121.             String paramValue, IntByReference valueLen);  
  122.    
  123.     /**  
  124.      * 逆初始化MSC的ISR部分  
  125.      *  
  126.      * @return  
  127.      */ 
  128.     public int QISRFini();  
  129. }  
  130.  
  131. *Msp_errors  
  132. ?  
  133. package com.cnblogs.htynkn;  
  134.    
  135. import com.sun.jna.win32.StdCallLibrary;  
  136.    
  137. /**  
  138.  * @author 夜明的孤行灯  
  139.  * @date 2012-7-5  
  140.  */ 
  141.    
  142. public interface Msp_errors extends StdCallLibrary {  
  143.     public static final int MSP_SUCCESS = 0;  
  144.     public static final int ERROR_FAIL  = -1;  
  145.     public static final int ERROR_EXCEPTION= -2;  
  146.     public static final int ERROR_GENERAL= 10100;   /* 0x2774 */ 
  147.     public static final int ERROR_OUT_OF_MEMORY= 10101;     /* 0x2775 */ 
  148.     public static final int ERROR_FILE_NOT_FOUND= 10102;    /* 0x2776 */ 
  149.     public static final int ERROR_NOT_SUPPORT= 10103;   /* 0x2777 */ 
  150.     public static final int ERROR_NOT_IMPLEMENT= 10104;     /* 0x2778 */ 
  151.     public static final int ERROR_ACCESS= 10105;    /* 0x2779 */ 
  152.     public static final int ERROR_INVALID_PARA= 10106;  /* 0x277A */ 
  153.     public static final int ERROR_INVALID_PARA_VALUE= 10107;    /* 0x277B */ 
  154.     public static final int ERROR_INVALID_HANDLE= 10108;    /* 0x277C */ 
  155.     public static final int ERROR_INVALID_DATA= 10109;  /* 0x277D */ 
  156.     public static final int ERROR_NO_LICENSE= 10110;    /* 0x277E */ 
  157.     public static final int ERROR_NOT_INIT= 10111;  /* 0x277F */ 
  158.     public static final int ERROR_NULL_HANDLE= 10112;   /* 0x2780 */ 
  159.     public static final int ERROR_OVERFLOW= 10113;  /* 0x2781 */ 
  160.     public static final int ERROR_TIME_OUT= 10114;  /* 0x2782 */ 
  161.     public static final int ERROR_OPEN_FILE= 10115;     /* 0x2783 */ 
  162.     public static final int ERROR_NOT_FOUND= 10116;     /* 0x2784 */ 
  163.     public static final int ERROR_NO_ENOUGH_BUFFER= 10117;  /* 0x2785 */ 
  164.     public static final int ERROR_NO_DATA= 10118;   /* 0x2786 */ 
  165.     public static final int ERROR_NO_MORE_DATA= 10119;  /* 0x2787 */ 
  166.     public static final int ERROR_NO_RESPONSE_DATA= 10120;  /* 0x2788 */ 
  167.     public static final int ERROR_ALREADY_EXIST= 10121;     /* 0x2789 */ 
  168.     public static final int ERROR_LOAD_MODULE= 10122;   /* 0x278A */ 
  169.     public static final int ERROR_BUSY  = 10123;    /* 0x278B */ 
  170.     public static final int ERROR_INVALID_CONFIG= 10124;    /* 0x278C */ 
  171.     public static final int ERROR_VERSION_CHECK= 10125;     /* 0x278D */ 
  172.     public static final int ERROR_CANCELED= 10126;  /* 0x278E */ 
  173.     public static final int ERROR_INVALID_MEDIA_TYPE= 10127;    /* 0x278F */ 
  174.     public static final int ERROR_CONFIG_INITIALIZE= 10128;     /* 0x2790 */ 
  175.     public static final int ERROR_CREATE_HANDLE= 10129;     /* 0x2791 */ 
  176.     public static final int ERROR_CODING_LIB_NOT_LOAD= 10130;   /* 0x2792 */ 
  177.    
  178. /* Error codes of network 10200(0x27D8)*/ 
  179.     public static final int ERROR_NET_GENERAL= 10200;   /* 0x27D8 */ 
  180.     public static final int ERROR_NET_OPENSOCK= 10201;  /* 0x27D9 */   /* Open socket */ 
  181.     public static final int ERROR_NET_CONNECTSOCK= 10202;   /* 0x27DA */   /* Connect socket */ 
  182.     public static final int ERROR_NET_ACCEPTSOCK = 10203;   /* 0x27DB */   /* Accept socket */ 
  183.     public static final int ERROR_NET_SENDSOCK= 10204;  /* 0x27DC */   /* Send socket data */ 
  184.     public static final int ERROR_NET_RECVSOCK= 10205;  /* 0x27DD */   /* Recv socket data */ 
  185.     public static final int ERROR_NET_INVALIDSOCK= 10206;   /* 0x27DE */   /* Invalid socket handle */ 
  186.     public static final int ERROR_NET_BADADDRESS = 10207;   /* 0x27EF */   /* Bad network address */ 
  187.     public static final int ERROR_NET_BINDSEQUENCE= 10208;  /* 0x27E0 */   /* Bind after listen/connect */ 
  188.     public static final int ERROR_NET_NOTOPENSOCK= 10209;   /* 0x27E1 */   /* Socket is not opened */ 
  189.     public static final int ERROR_NET_NOTBIND= 10210;   /* 0x27E2 */   /* Socket is not bind to an address */ 
  190.     public static final int ERROR_NET_NOTLISTEN  = 10211;   /* 0x27E3 */   /* Socket is not listening */ 
  191.     public static final int ERROR_NET_CONNECTCLOSE= 10212;  /* 0x27E4 */   /* The other side of connection is closed */ 
  192.     public static final int ERROR_NET_NOTDGRAMSOCK= 10213;  /* 0x27E5 */   /* The socket is not datagram type */ 
  193.     public static final int ERROR_NET_DNS= 10214;   /* 0x27E6 */   /* domain name is invalid or dns server does not function well */ 
  194.    
  195. /* Error codes of mssp message 10300(0x283C) */ 
  196.     public static final int ERROR_MSG_GENERAL= 10300;   /* 0x283C */ 
  197.     public static final int ERROR_MSG_PARSE_ERROR= 10301;   /* 0x283D */ 
  198.     public static final int ERROR_MSG_BUILD_ERROR= 10302;   /* 0x283E */ 
  199.     public static final int ERROR_MSG_PARAM_ERROR= 10303;   /* 0x283F */ 
  200.     public static final int ERROR_MSG_CONTENT_EMPTY= 10304;     /* 0x2840 */ 
  201.     public static final int ERROR_MSG_INVALID_CONTENT_TYPE      = 10305;    /* 0x2841 */ 
  202.     public static final int ERROR_MSG_INVALID_CONTENT_LENGTH    = 10306;    /* 0x2842 */ 
  203.     public static final int ERROR_MSG_INVALID_CONTENT_ENCODE    = 10307;    /* 0x2843 */ 
  204.     public static final int ERROR_MSG_INVALID_KEY= 10308;   /* 0x2844 */ 
  205.     public static final int ERROR_MSG_KEY_EMPTY= 10309;     /* 0x2845 */ 
  206.     public static final int ERROR_MSG_SESSION_ID_EMPTY= 10310;  /* 0x2846 */ 
  207.     public static final int ERROR_MSG_LOGIN_ID_EMPTY= 10311;    /* 0x2847 */ 
  208.     public static final int ERROR_MSG_SYNC_ID_EMPTY= 10312;     /* 0x2848 */ 
  209.     public static final int ERROR_MSG_APP_ID_EMPTY= 10313;  /* 0x2849 */ 
  210.     public static final int ERROR_MSG_EXTERN_ID_EMPTY= 10314;   /* 0x284A */ 
  211.     public static final int ERROR_MSG_INVALID_CMD= 10315;   /* 0x284B */ 
  212.     public static final int ERROR_MSG_INVALID_SUBJECT= 10316;   /* 0x284C */ 
  213.     public static final int ERROR_MSG_INVALID_VERSION= 10317;   /* 0x284D */ 
  214.     public static final int ERROR_MSG_NO_CMD= 10318;    /* 0x284E */ 
  215.     public static final int ERROR_MSG_NO_SUBJECT= 10319;    /* 0x284F */ 
  216.     public static final int ERROR_MSG_NO_VERSION= 10320;    /* 0x2850 */ 
  217.     public static final int ERROR_MSG_MSSP_EMPTY= 10321;    /* 0x2851 */ 
  218.     public static final int ERROR_MSG_NEW_RESPONSE= 10322;  /* 0x2852 */ 
  219.     public static final int ERROR_MSG_NEW_CONTENT= 10323;   /* 0x2853 */ 
  220.     public static final int ERROR_MSG_INVALID_SESSION_ID        = 10324;    /* 0x2854 */ 
  221.    
  222. /* Error codes of DataBase 10400(0x28A0)*/ 
  223.     public static final int ERROR_DB_GENERAL= 10400;    /* 0x28A0 */ 
  224.     public static final int ERROR_DB_EXCEPTION= 10401;  /* 0x28A1 */ 
  225.     public static final int ERROR_DB_NO_RESULT= 10402;  /* 0x28A2 */ 
  226.     public static final int ERROR_DB_INVALID_USER= 10403;   /* 0x28A3 */ 
  227.     public static final int ERROR_DB_INVALID_PWD= 10404;    /* 0x28A4 */ 
  228.     public static final int ERROR_DB_CONNECT= 10405;    /* 0x28A5 */ 
  229.     public static final int ERROR_DB_INVALID_SQL= 10406;    /* 0x28A6 */ 
  230.     public static final int ERROR_DB_INVALID_APPID= 10407;  /* 0x28A7 */ 
  231.    
  232. /* Error codes of Resource 10500(0x2904)*/ 
  233.     public static final int ERROR_RES_GENERAL= 10500;   /* 0x2904 */ 
  234.     public static final int ERROR_RES_LOAD = 10501;     /* 0x2905 */   /* Load resource */ 
  235.     public static final int ERROR_RES_FREE = 10502;     /* 0x2906 */   /* Free resource */ 
  236.     public static final int ERROR_RES_MISSING = 10503;  /* 0x2907 */   /* Resource File Missing */ 
  237.     public static final int ERROR_RES_INVALID_NAME  = 10504;    /* 0x2908 */   /* Invalid resource file name */ 
  238.     public static final int ERROR_RES_INVALID_ID    = 10505;    /* 0x2909 */   /* Invalid resource ID */ 
  239.     public static final int ERROR_RES_INVALID_IMG   = 10506;    /* 0x290A */   /* Invalid resource image pointer */ 
  240.     public static final int ERROR_RES_WRITE= 10507;     /* 0x290B */   /* Write read-only resource */ 
  241.     public static final int ERROR_RES_LEAK = 10508;     /* 0x290C */   /* Resource leak out */ 
  242.     public static final int ERROR_RES_HEAD = 10509;     /* 0x290D */   /* Resource head currupt */ 
  243.     public static final int ERROR_RES_DATA = 10510;     /* 0x290E */   /* Resource data currupt */ 
  244.     public static final int ERROR_RES_SKIP = 10511;     /* 0x290F */   /* Resource file skipped */ 
  245.    
  246. /* Error codes of TTS 10600(0x2968)*/ 
  247.     public static final int ERROR_TTS_GENERAL= 10600;   /* 0x2968 */ 
  248.     public static final int ERROR_TTS_TEXTEND = 10601;  /* 0x2969 */  /* Meet text end */ 
  249.     public static final int ERROR_TTS_TEXT_EMPTY= 10602;    /* 0x296A */  /* no synth text */ 
  250.    
  251. /* Error codes of Recognizer 10700(0x29CC) */ 
  252.     public static final int ERROR_REC_GENERAL= 10700;   /* 0x29CC */ 
  253.     public static final int ERROR_REC_INACTIVE= 10701;  /* 0x29CD */ 
  254.     public static final int ERROR_REC_GRAMMAR_ERROR= 10702;     /* 0x29CE */ 
  255.     public static final int ERROR_REC_NO_ACTIVE_GRAMMARS        = 10703;    /* 0x29CF */ 
  256.     public static final int ERROR_REC_DUPLICATE_GRAMMAR= 10704;     /* 0x29D0 */ 
  257.     public static final int ERROR_REC_INVALID_MEDIA_TYPE        = 10705;    /* 0x29D1 */ 
  258.     public static final int ERROR_REC_INVALID_LANGUAGE= 10706;  /* 0x29D2 */ 
  259.     public static final int ERROR_REC_URI_NOT_FOUND= 10707;     /* 0x29D3 */ 
  260.     public static final int ERROR_REC_URI_TIMEOUT= 10708;   /* 0x29D4 */ 
  261.     public static final int ERROR_REC_URI_FETCH_ERROR= 10709;   /* 0x29D5 */ 
  262.    
  263. /* Error codes of Speech Detector 10800(0x2A30) */ 
  264.     public static final int ERROR_EP_GENERAL= 10800;    /* 0x2A30 */ 
  265.     public static final int ERROR_EP_NO_SESSION_NAME= 10801;    /* 0x2A31 */ 
  266.     public static final int ERROR_EP_INACTIVE  = 10802;     /* 0x2A32 */ 
  267.     public static final int ERROR_EP_INITIALIZED    = 10803;    /* 0x2A33 */ 
  268.    
  269. /* Error codes of TUV */   
  270.     public static final int ERROR_TUV_GENERAL= 10900;   /* 0x2A94 */ 
  271.     public static final int ERROR_TUV_GETHIDPARAM       = 10901;    /* 0x2A95 */   /* Get Busin Param huanid*/ 
  272.     public static final int ERROR_TUV_TOKEN= 10902;     /* 0x2A96 */   /* Get Token */ 
  273.     public static final int ERROR_TUV_CFGFILE= 10903;   /* 0x2A97 */   /* Open cfg file */ 
  274.     public static final int ERROR_TUV_RECV_CONTENT  = 10904;    /* 0x2A98 */   /* received content is error */ 
  275.     public static final int ERROR_TUV_VERFAIL    = 10905;   /* 0x2A99 */   /* Verify failure */ 
  276.    
  277. /* Error codes of IMTV */ 
  278.     public static final int ERROR_LOGIN_SUCCESS= 11000;     /* 0x2AF8 */   /* 成功 */ 
  279.     public static final int ERROR_LOGIN_NO_LICENSE          = 11001;    /* 0x2AF9 */   /* 试用次数结束,用户需要付费 */ 
  280.     public static final int ERROR_LOGIN_SESSIONID_INVALID       = 11002;    /* 0x2AFA */   /* SessionId失效,需要重新登录通行证 */ 
  281.     public static final int ERROR_LOGIN_SESSIONID_ERROR= 11003;     /* 0x2AFB */   /* SessionId为空,或者非法 */ 
  282.     public static final int ERROR_LOGIN_UNLOGIN       = 11004;  /* 0x2AFC */   /* 未登录通行证 */ 
  283.     public static final int ERROR_LOGIN_INVALID_USER            = 11005;    /* 0x2AFD */   /* 用户ID无效 */ 
  284.     public static final int ERROR_LOGIN_INVALID_PWD             = 11006;    /* 0x2AFE */   /* 用户密码无效 */ 
  285.     public static final int ERROR_LOGIN_SYSTEM_ERROR= 11099;    /* 0x2B5B */   /* 系统错误 */ 
  286.    
  287. /* Error codes of HCR */ 
  288.     public static final int ERROR_HCR_GENERAL= 11100;  
  289.     public static final int ERROR_HCR_RESOURCE_NOT_EXIST        = 11101;  
  290.     public static final int ERROR_HCR_CREATE= 11102;  
  291.     public static final int ERROR_HCR_DESTROY= 11103;  
  292.     public static final int ERROR_HCR_START= 11104;  
  293.     public static final int ERROR_HCR_APPEND_STROKES= 11105;  
  294.     public static final int ERROR_HCR_GET_RESULT= 11106;  
  295.     public static final int ERROR_HCR_SET_PREDICT_DATA= 11107;  
  296.     public static final int ERROR_HCR_GET_PREDICT_RESULT        = 11108;  
  297.    
  298.    
  299. /* Error codes of http 12000(0x2EE0) */ 
  300.     public static final int ERROR_HTTP_BASE= 12000/* 0x2EE0 */ 
  301.    
  302. /*Error codes of ISV */ 
  303.     public static final int ERROR_ISV_NO_USER  = 13000/* 32C8 */    /* the user doesn't exist */ 
  304.    
  305. /* Error codes of Lua scripts */ 
  306.     public static final int ERROR_LUA_BASE= 14000;    /* 0x36B0 */ 
  307.     public static final int ERROR_LUA_YIELD= 14001/* 0x36B1 */ 
  308.     public static final int ERROR_LUA_ERRRUN= 14002;    /* 0x36B2 */ 
  309.     public static final int ERROR_LUA_ERRSYNTAX= 14003/* 0x36B3 */ 
  310.     public static final int ERROR_LUA_ERRMEM= 14004;    /* 0x36B4 */ 
  311.     public static final int ERROR_LUA_ERRERR= 14005;    /* 0x36B5 */ 

嫌复制粘贴麻烦的可以点击下面的链接下载:

Msp_errors.java: http://www.t00y.com/file/8170772

QTSR.java: http://www.t00y.com/file/8170775

原文链接:http://www.cnblogs.com/htynkn/archive/2012/07/05/jna_yuyinshibie.html

【编辑推荐】

  1. Java系统程序员修炼之道
  2. Java程序员必知的8大排序
  3. Java和.NET开发过程中的一些不同
  4. Java高并发:静态页面生成方案
  5. 让Java代码跑得更快
责任编辑:张伟 来源: 夜明的孤行灯的博客
相关推荐

2011-05-31 16:38:47

Android 实现语音

2009-03-17 09:06:16

Iphone新系统语音识别

2011-08-09 15:38:00

Windows7语音识别

2015-12-07 14:39:18

微软Windows 95语音识别

2012-05-10 15:41:46

HTML5

2012-07-25 13:23:32

ibmdw

2011-09-08 16:24:25

Win 7语音识别

2017-02-27 21:37:49

2009-12-23 09:02:33

Windows 7语音识别

2016-02-17 10:39:18

语音识别语音合成语音交互

2014-09-02 10:43:45

RedisRPC

2022-09-26 11:35:50

App开发技术框架Speech框架

2010-08-19 09:56:02

Android语音功能Voice Actio

2011-01-18 11:52:25

Linux语音识别

2021-05-06 11:13:06

人工智能语音识别

2021-05-06 11:18:23

人工智能语音识别

2009-07-21 15:28:06

Windows Emb

2009-08-21 15:28:23

C#英文

2021-12-24 10:34:11

鸿蒙HarmonyOS应用

2022-12-01 07:03:22

语音识别人工智能技术
点赞
收藏

51CTO技术栈公众号