Java中怎么通過(guò)調(diào)用jna實(shí)現(xiàn)語(yǔ)音識(shí)別功能

Java中怎么通過(guò)調(diào)用jna實(shí)現(xiàn)語(yǔ)音識(shí)別功能,相信很多沒(méi)有經(jīng)驗(yàn)的人對(duì)此束手無(wú)策,為此本文總結(jié)了問(wèn)題出現(xiàn)的原因和解決方法,通過(guò)這篇文章希望你能解決這個(gè)問(wèn)題。

創(chuàng)新互聯(lián)建站憑借在網(wǎng)站建設(shè)、網(wǎng)站推廣領(lǐng)域領(lǐng)先的技術(shù)能力和多年的行業(yè)經(jīng)驗(yàn),為客戶提供超值的營(yíng)銷型網(wǎng)站建設(shè)服務(wù),我們始終認(rèn)為:好的營(yíng)銷型網(wǎng)站就是好的業(yè)務(wù)員。我們已成功為企業(yè)單位、個(gè)人等客戶提供了成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作服務(wù),以良好的商業(yè)信譽(yù),完善的服務(wù)及深厚的技術(shù)力量處于同行領(lǐng)先地位。

JNA

java調(diào)用.dll獲取.so一般通過(guò)JNI,但是JNI的使用比較復(fù)雜,需要用C另寫(xiě)一個(gè)共享庫(kù)進(jìn)行適配。而JNA是一個(gè)自動(dòng)適配工具,通過(guò)它調(diào)用.dll只需要一個(gè)借口即可。

官網(wǎng):https://github.com/twall/jna/。下載jna.jar即可。

編寫(xiě)接口

科大訊飛語(yǔ)音云主要提供語(yǔ)音合成和語(yǔ)音識(shí)別兩個(gè)方面的東西,我主要使用語(yǔ)音識(shí)別這塊的功能。

建立接口QTSR,繼承Library。

將msc.dll等文件復(fù)制到項(xiàng)目根目錄。

Java中怎么通過(guò)調(diào)用jna實(shí)現(xiàn)語(yǔ)音識(shí)別功能

加載msc.dll

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

然后來(lái)看一下msc.dll公開(kāi)了哪些方法。首先是QISRInit,這是一個(gè)全局初始化函數(shù)。

Java中怎么通過(guò)調(diào)用jna實(shí)現(xiàn)語(yǔ)音識(shí)別功能

它的返回值為int,參數(shù)是const char*。int還是java的int,但是char*就對(duì)應(yīng)的是java的String了。

所以在QTSR中添加方法:

public int QISRInit(String configs);

返回值在msp_errors.h中定義,等一下我們還是要弄在java里面去。

繼續(xù)看QISRInit函數(shù),在官方文檔中有調(diào)用示例:

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

對(duì)應(yīng)的在java中的調(diào)用代碼如下:

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

我們?cè)诳匆粋€(gè)函數(shù):QISRSessionBegin,這個(gè)開(kāi)始一路ISR會(huì)話。

Java中怎么通過(guò)調(diào)用jna實(shí)現(xiàn)語(yǔ)音識(shí)別功能

還是剛才的思路,char*對(duì)應(yīng)java的String,但是注意一下int *errorCode。這個(gè)函數(shù)其實(shí)傳入兩個(gè)參數(shù),傳出兩個(gè)參數(shù)。即本身返回的sessionId,還有errorCode。

這里的int*對(duì)應(yīng)的是jna的IntByReference。所以添加方法:

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

同樣看看官方示例:

/* vad_timeout和vad_speech_tail兩個(gè)參數(shù)只有在打開(kāi)VAD功能時(shí)才生效 */ const char*      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”;   int ret = MSP_SUCCESS;     const char*     session_id = QISRSessionBegin( NULL, params, &ret );     if(MSP_SUCCESS != ret )     {             printf( “QISRSessionBegin failed, error code is: %d”, ret );     }

在java這樣寫(xiě):

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";   IntByReference errorCode = new IntByReference();   String sessionId = QTSR.INSTANCE.QISRSessionBegin(null, params,errorCode);

運(yùn)行效果:

Java中怎么通過(guò)調(diào)用jna實(shí)現(xiàn)語(yǔ)音識(shí)別功能

其他的函數(shù)處理方式大致相同,這里貼上一個(gè)c和java在jna中的類型對(duì)應(yīng)表:

Java中怎么通過(guò)調(diào)用jna實(shí)現(xiàn)語(yǔ)音識(shí)別功能

其中Unsigned類型和signed在java中對(duì)應(yīng)是一樣的。

.h文件和常量處理

在SDK的include目錄有4個(gè).h文件,定義了一些常量,比如上面一節(jié)中的0其實(shí)是msp_errors.h中MSP_SUCCESS。

我以msp_errors.h為例,建立一個(gè)接口Msp_errors,繼承StdCallLibrary。

照著msp_errors.h中的定義在Msp_errors中進(jìn)行定義。

public static final int MSP_SUCCESS = 0;   public static final int ERROR_FAIL  = -1;   public static final int ERROR_EXCEPTION= -2;   public static final int ERROR_GENERAL= 10100;      public static final int ERROR_OUT_OF_MEMORY= 10101;        public static final int ERROR_FILE_NOT_FOUND= 10102;       public static final int ERROR_NOT_SUPPORT= 10103;

使用很簡(jiǎn)單的,比如MSP_SUCCESS 就是Msp_errors.MSP_SUCCESS。

完整代碼和文件

這個(gè)只是語(yǔ)音識(shí)別部分的,語(yǔ)音合成的話我記得有人做過(guò)jni接口的。

*QTSR.java

package com.cnblogs.htynkn;     import com.sun.jna.Library;  import com.sun.jna.Native;  import com.sun.jna.Pointer;  import com.sun.jna.ptr.IntByReference;     /**   * @author 夜明的孤行燈   * @date 2012-7-5   */    public interface QTSR extends Library {      QTSR INSTANCE = (QTSR) Native.loadLibrary("msc", QTSR.class);         /**       * 初始化MSC的ISR部分       *       * @param configs       *            初始化時(shí)傳入的字符串,以指定合成用到的一些配置參數(shù),各個(gè)參數(shù)以“參數(shù)名=參數(shù)值”的形式出現(xiàn),大小寫(xiě)不敏感,不同的參數(shù)之間以“       *            ,”或“\n”隔開(kāi),不設(shè)置任何值時(shí)可以傳入NULL或空串:       * @return 如果函數(shù)調(diào)用成功返回MSP_SUCCESS,否則返回錯(cuò)誤代碼,錯(cuò)誤代碼參見(jiàn)msp_errors       */     public int QISRInit(String configs);         /**       * 開(kāi)始一個(gè)ISR會(huì)話       *       * @param grammarList       *            uri-list格式的語(yǔ)法,可以是一個(gè)語(yǔ)法文件的URL或者一個(gè)引擎內(nèi)置語(yǔ)法列表??梢酝瑫r(shí)指定多個(gè)語(yǔ)法,不同的語(yǔ)法之間以“,”       *            隔開(kāi)。進(jìn)行語(yǔ)音聽(tīng)寫(xiě)時(shí)不需要語(yǔ)法,此參數(shù)設(shè)定為NULL或空串即可;進(jìn)行語(yǔ)音識(shí)別時(shí)則需要語(yǔ)法,語(yǔ)法可以在此參數(shù)中指定,       *            也可以隨后調(diào)用QISRGrammarActivate指定識(shí)別所用的語(yǔ)法。       * @param params       *            本路ISR會(huì)話使用的參數(shù),可設(shè)置的參數(shù)及其取值范圍請(qǐng)參考《可設(shè)置參數(shù)列表_MSP20.xls》,各個(gè)參數(shù)以“參數(shù)名=參數(shù)值”       *            的形式出現(xiàn),不同的參數(shù)之間以“,”或者“\n”隔開(kāi)。       * @param errorCode       *            如果函數(shù)調(diào)用成功則其值為MSP_SUCCESS,否則返回錯(cuò)誤代碼,錯(cuò)誤代碼參見(jiàn)msp_errors。幾個(gè)主要的返回值:       *            MSP_ERROR_NOT_INIT 未初始化 MSP_ERROR_INVALID_PARA 無(wú)效的參數(shù)       *            MSP_ERROR_NO_LICENSE 開(kāi)始一路會(huì)話失敗       * @return MSC為本路會(huì)話建立的ID,用來(lái)唯一的標(biāo)識(shí)本路會(huì)話,供以后調(diào)用其他函數(shù)時(shí)使用。函數(shù)調(diào)用失敗則會(huì)返回NULL。       */     public String QISRSessionBegin(String grammarList, String params,              IntByReference errorCode);         /**       * 傳入語(yǔ)法       *       * @param sessionID       *            由QISRSessionBegin返回過(guò)來(lái)的會(huì)話ID。       * @param grammar       *            語(yǔ)法字符串       * @param type       *            語(yǔ)法類型,可以是uri-list、abnf、xml等       * @param weight       *            本次傳入語(yǔ)法的權(quán)重,本參數(shù)在MSP 2.0中會(huì)被忽略。       * @return 如果函數(shù)調(diào)用成功返回MSP_SUCCESS,否則返回錯(cuò)誤代碼,錯(cuò)誤代碼參見(jiàn)msp_errors       */     public int QISRGrammarActivate(String sessionID, String grammar,              String type, int weight);         /**       * 寫(xiě)入用來(lái)識(shí)別的語(yǔ)音       *       * @param sessionID       *            由QISRSessionBegin返回過(guò)來(lái)的會(huì)話ID。       * @param waveData       *            音頻數(shù)據(jù)緩沖區(qū)起始地址       * @param waveLen       *            音頻數(shù)據(jù)長(zhǎng)度,其大小不能超過(guò)設(shè)定的max_audio_size       * @param audioStatus       *            用來(lái)指明用戶本次識(shí)別的音頻是否發(fā)送完畢,可能值如下:       *            MSP_AUDIO_SAMPLE_FIRST = 1 第一塊音頻       *            MSP_AUDIO_SAMPLE_CONTINUE = 2 還有后繼音頻       *            MSP_AUDIO_SAMPLE_LAST = 4 最后一塊音頻       * @param epStatus       *            端點(diǎn)檢測(cè)(End-point detected)器所處的狀態(tài),可能的值如下:       *            MSP _EP_LOOKING_FOR_SPEECH = 0 還沒(méi)有檢測(cè)到音頻的前端點(diǎn)。       *            MSP _EP_IN_SPEECH = 1 已經(jīng)檢測(cè)到了音頻前端點(diǎn),正在進(jìn)行正常的音頻處理。       *            MSP _EP_AFTER_SPEECH = 3 檢測(cè)到音頻的后端點(diǎn),后繼的音頻會(huì)被MSC忽略。       *            MSP _EP_TIMEOUT = 4 超時(shí)。       *            MSP _EP_ERROR= 5 出現(xiàn)錯(cuò)誤。       *            MSP _EP_MAX_SPEECH = 6 音頻過(guò)大。       * @param recogStatus       *            識(shí)別器所處的狀態(tài)       * @return       */     public int QISRAudioWrite(String sessionID, Pointer waveData, int waveLen,              int audioStatus, IntByReference epStatus, IntByReference recogStatus);         /**       * 獲取識(shí)別結(jié)果       *       * @param sessionID 由QISRSessionBegin返回過(guò)來(lái)的會(huì)話ID。       * @param rsltStatus 識(shí)別結(jié)果的狀態(tài),其取值范圍和含義請(qǐng)參考QISRAudioWrite的參數(shù)recogStatus       * @param waitTime 與服務(wù)器交互的間隔時(shí)間,可以控制和服務(wù)器的交互頻度。單位為ms,建議取值為5000。       * @param errorCode 如果函數(shù)調(diào)用成功返回MSP_SUCCESS,否則返回錯(cuò)誤代碼,錯(cuò)誤代碼參見(jiàn)msp_errors       * @return 函數(shù)執(zhí)行成功并且獲取到識(shí)別結(jié)果時(shí)返回識(shí)別結(jié)果,函數(shù)執(zhí)行成功沒(méi)有獲取到識(shí)別結(jié)果時(shí)返回NULL       */     public String QISRGetResult(String sessionID, IntByReference rsltStatus,              int waitTime, IntByReference errorCode);         /**       * 結(jié)束一路會(huì)話       *       * @param sessionID 由QISRSessionBegin返回過(guò)來(lái)的會(huì)話ID。       * @param hints 結(jié)束本次會(huì)話的原因描述,用于記錄日志,便于用戶查閱或者跟蹤某些問(wèn)題。       * @return       */     public int QISRSessionEnd(String sessionID, String hints);         /**       * 獲取與識(shí)別交互相關(guān)的參數(shù)       *       * @param sessionID 由QISRSessionBegin返回過(guò)來(lái)的會(huì)話ID。       * @param paramName 要獲取的參數(shù)名稱;支持同時(shí)查詢多個(gè)參數(shù),查詢多個(gè)參數(shù)時(shí),參數(shù)名稱按“,” 或“\n”分隔開(kāi)來(lái)。       * @param paramValue 獲取的參數(shù)值,以字符串形式返回;查詢多個(gè)參數(shù)時(shí),參數(shù)值之間以“;”分開(kāi),不支持的參數(shù)將返回空的值。       * @param valueLen 參數(shù)值的長(zhǎng)度。       * @return       */     public int QISRGetParam(String sessionID, String paramName,              String paramValue, IntByReference valueLen);         /**       * 逆初始化MSC的ISR部分       *       * @return       */     public int QISRFini();  }   *Msp_errors  ?  package com.cnblogs.htynkn;     import com.sun.jna.win32.StdCallLibrary;     /**   * @author 夜明的孤行燈   * @date 2012-7-5   */    public interface Msp_errors extends StdCallLibrary {      public static final int MSP_SUCCESS = 0;      public static final int ERROR_FAIL  = -1;      public static final int ERROR_EXCEPTION= -2;      public static final int ERROR_GENERAL= 10100;   /* 0x2774 */     public static final int ERROR_OUT_OF_MEMORY= 10101;     /* 0x2775 */     public static final int ERROR_FILE_NOT_FOUND= 10102;    /* 0x2776 */     public static final int ERROR_NOT_SUPPORT= 10103;   /* 0x2777 */     public static final int ERROR_NOT_IMPLEMENT= 10104;     /* 0x2778 */     public static final int ERROR_ACCESS= 10105;    /* 0x2779 */     public static final int ERROR_INVALID_PARA= 10106;  /* 0x277A */     public static final int ERROR_INVALID_PARA_VALUE= 10107;    /* 0x277B */     public static final int ERROR_INVALID_HANDLE= 10108;    /* 0x277C */     public static final int ERROR_INVALID_DATA= 10109;  /* 0x277D */     public static final int ERROR_NO_LICENSE= 10110;    /* 0x277E */     public static final int ERROR_NOT_INIT= 10111;  /* 0x277F */     public static final int ERROR_NULL_HANDLE= 10112;   /* 0x2780 */     public static final int ERROR_OVERFLOW= 10113;  /* 0x2781 */     public static final int ERROR_TIME_OUT= 10114;  /* 0x2782 */     public static final int ERROR_OPEN_FILE= 10115;     /* 0x2783 */     public static final int ERROR_NOT_FOUND= 10116;     /* 0x2784 */     public static final int ERROR_NO_ENOUGH_BUFFER= 10117;  /* 0x2785 */     public static final int ERROR_NO_DATA= 10118;   /* 0x2786 */     public static final int ERROR_NO_MORE_DATA= 10119;  /* 0x2787 */     public static final int ERROR_NO_RESPONSE_DATA= 10120;  /* 0x2788 */     public static final int ERROR_ALREADY_EXIST= 10121;     /* 0x2789 */     public static final int ERROR_LOAD_MODULE= 10122;   /* 0x278A */     public static final int ERROR_BUSY  = 10123;    /* 0x278B */     public static final int ERROR_INVALID_CONFIG= 10124;    /* 0x278C */     public static final int ERROR_VERSION_CHECK= 10125;     /* 0x278D */     public static final int ERROR_CANCELED= 10126;  /* 0x278E */     public static final int ERROR_INVALID_MEDIA_TYPE= 10127;    /* 0x278F */     public static final int ERROR_CONFIG_INITIALIZE= 10128;     /* 0x2790 */     public static final int ERROR_CREATE_HANDLE= 10129;     /* 0x2791 */     public static final int ERROR_CODING_LIB_NOT_LOAD= 10130;   /* 0x2792 */    /* Error codes of network 10200(0x27D8)*/     public static final int ERROR_NET_GENERAL= 10200;   /* 0x27D8 */     public static final int ERROR_NET_OPENSOCK= 10201;  /* 0x27D9 */   /* Open socket */     public static final int ERROR_NET_CONNECTSOCK= 10202;   /* 0x27DA */   /* Connect socket */     public static final int ERROR_NET_ACCEPTSOCK = 10203;   /* 0x27DB */   /* Accept socket */     public static final int ERROR_NET_SENDSOCK= 10204;  /* 0x27DC */   /* Send socket data */     public static final int ERROR_NET_RECVSOCK= 10205;  /* 0x27DD */   /* Recv socket data */     public static final int ERROR_NET_INVALIDSOCK= 10206;   /* 0x27DE */   /* Invalid socket handle */     public static final int ERROR_NET_BADADDRESS = 10207;   /* 0x27EF */   /* Bad network address */     public static final int ERROR_NET_BINDSEQUENCE= 10208;  /* 0x27E0 */   /* Bind after listen/connect */     public static final int ERROR_NET_NOTOPENSOCK= 10209;   /* 0x27E1 */   /* Socket is not opened */     public static final int ERROR_NET_NOTBIND= 10210;   /* 0x27E2 */   /* Socket is not bind to an address */     public static final int ERROR_NET_NOTLISTEN  = 10211;   /* 0x27E3 */   /* Socket is not listening */     public static final int ERROR_NET_CONNECTCLOSE= 10212;  /* 0x27E4 */   /* The other side of connection is closed */     public static final int ERROR_NET_NOTDGRAMSOCK= 10213;  /* 0x27E5 */   /* The socket is not datagram type */     public static final int ERROR_NET_DNS= 10214;   /* 0x27E6 */   /* domain name is invalid or dns server does not function well */    /* Error codes of mssp message 10300(0x283C) */     public static final int ERROR_MSG_GENERAL= 10300;   /* 0x283C */     public static final int ERROR_MSG_PARSE_ERROR= 10301;   /* 0x283D */     public static final int ERROR_MSG_BUILD_ERROR= 10302;   /* 0x283E */     public static final int ERROR_MSG_PARAM_ERROR= 10303;   /* 0x283F */     public static final int ERROR_MSG_CONTENT_EMPTY= 10304;     /* 0x2840 */     public static final int ERROR_MSG_INVALID_CONTENT_TYPE      = 10305;    /* 0x2841 */     public static final int ERROR_MSG_INVALID_CONTENT_LENGTH    = 10306;    /* 0x2842 */     public static final int ERROR_MSG_INVALID_CONTENT_ENCODE    = 10307;    /* 0x2843 */     public static final int ERROR_MSG_INVALID_KEY= 10308;   /* 0x2844 */     public static final int ERROR_MSG_KEY_EMPTY= 10309;     /* 0x2845 */     public static final int ERROR_MSG_SESSION_ID_EMPTY= 10310;  /* 0x2846 */     public static final int ERROR_MSG_LOGIN_ID_EMPTY= 10311;    /* 0x2847 */     public static final int ERROR_MSG_SYNC_ID_EMPTY= 10312;     /* 0x2848 */     public static final int ERROR_MSG_APP_ID_EMPTY= 10313;  /* 0x2849 */     public static final int ERROR_MSG_EXTERN_ID_EMPTY= 10314;   /* 0x284A */     public static final int ERROR_MSG_INVALID_CMD= 10315;   /* 0x284B */     public static final int ERROR_MSG_INVALID_SUBJECT= 10316;   /* 0x284C */     public static final int ERROR_MSG_INVALID_VERSION= 10317;   /* 0x284D */     public static final int ERROR_MSG_NO_CMD= 10318;    /* 0x284E */     public static final int ERROR_MSG_NO_SUBJECT= 10319;    /* 0x284F */     public static final int ERROR_MSG_NO_VERSION= 10320;    /* 0x2850 */     public static final int ERROR_MSG_MSSP_EMPTY= 10321;    /* 0x2851 */     public static final int ERROR_MSG_NEW_RESPONSE= 10322;  /* 0x2852 */     public static final int ERROR_MSG_NEW_CONTENT= 10323;   /* 0x2853 */     public static final int ERROR_MSG_INVALID_SESSION_ID        = 10324;    /* 0x2854 */    /* Error codes of DataBase 10400(0x28A0)*/     public static final int ERROR_DB_GENERAL= 10400;    /* 0x28A0 */     public static final int ERROR_DB_EXCEPTION= 10401;  /* 0x28A1 */     public static final int ERROR_DB_NO_RESULT= 10402;  /* 0x28A2 */     public static final int ERROR_DB_INVALID_USER= 10403;   /* 0x28A3 */     public static final int ERROR_DB_INVALID_PWD= 10404;    /* 0x28A4 */     public static final int ERROR_DB_CONNECT= 10405;    /* 0x28A5 */     public static final int ERROR_DB_INVALID_SQL= 10406;    /* 0x28A6 */     public static final int ERROR_DB_INVALID_APPID= 10407;  /* 0x28A7 */    /* Error codes of Resource 10500(0x2904)*/     public static final int ERROR_RES_GENERAL= 10500;   /* 0x2904 */     public static final int ERROR_RES_LOAD = 10501;     /* 0x2905 */   /* Load resource */     public static final int ERROR_RES_FREE = 10502;     /* 0x2906 */   /* Free resource */     public static final int ERROR_RES_MISSING = 10503;  /* 0x2907 */   /* Resource File Missing */     public static final int ERROR_RES_INVALID_NAME  = 10504;    /* 0x2908 */   /* Invalid resource file name */     public static final int ERROR_RES_INVALID_ID    = 10505;    /* 0x2909 */   /* Invalid resource ID */     public static final int ERROR_RES_INVALID_IMG   = 10506;    /* 0x290A */   /* Invalid resource image pointer */     public static final int ERROR_RES_WRITE= 10507;     /* 0x290B */   /* Write read-only resource */     public static final int ERROR_RES_LEAK = 10508;     /* 0x290C */   /* Resource leak out */     public static final int ERROR_RES_HEAD = 10509;     /* 0x290D */   /* Resource head currupt */     public static final int ERROR_RES_DATA = 10510;     /* 0x290E */   /* Resource data currupt */     public static final int ERROR_RES_SKIP = 10511;     /* 0x290F */   /* Resource file skipped */    /* Error codes of TTS 10600(0x2968)*/     public static final int ERROR_TTS_GENERAL= 10600;   /* 0x2968 */     public static final int ERROR_TTS_TEXTEND = 10601;  /* 0x2969 */  /* Meet text end */     public static final int ERROR_TTS_TEXT_EMPTY= 10602;    /* 0x296A */  /* no synth text */    /* Error codes of Recognizer 10700(0x29CC) */     public static final int ERROR_REC_GENERAL= 10700;   /* 0x29CC */     public static final int ERROR_REC_INACTIVE= 10701;  /* 0x29CD */     public static final int ERROR_REC_GRAMMAR_ERROR= 10702;     /* 0x29CE */     public static final int ERROR_REC_NO_ACTIVE_GRAMMARS        = 10703;    /* 0x29CF */     public static final int ERROR_REC_DUPLICATE_GRAMMAR= 10704;     /* 0x29D0 */     public static final int ERROR_REC_INVALID_MEDIA_TYPE        = 10705;    /* 0x29D1 */     public static final int ERROR_REC_INVALID_LANGUAGE= 10706;  /* 0x29D2 */     public static final int ERROR_REC_URI_NOT_FOUND= 10707;     /* 0x29D3 */     public static final int ERROR_REC_URI_TIMEOUT= 10708;   /* 0x29D4 */     public static final int ERROR_REC_URI_FETCH_ERROR= 10709;   /* 0x29D5 */    /* Error codes of Speech Detector 10800(0x2A30) */     public static final int ERROR_EP_GENERAL= 10800;    /* 0x2A30 */     public static final int ERROR_EP_NO_SESSION_NAME= 10801;    /* 0x2A31 */     public static final int ERROR_EP_INACTIVE  = 10802;     /* 0x2A32 */     public static final int ERROR_EP_INITIALIZED    = 10803;    /* 0x2A33 */    /* Error codes of TUV */       public static final int ERROR_TUV_GENERAL= 10900;   /* 0x2A94 */     public static final int ERROR_TUV_GETHIDPARAM       = 10901;    /* 0x2A95 */   /* Get Busin Param huanid*/     public static final int ERROR_TUV_TOKEN= 10902;     /* 0x2A96 */   /* Get Token */     public static final int ERROR_TUV_CFGFILE= 10903;   /* 0x2A97 */   /* Open cfg file */     public static final int ERROR_TUV_RECV_CONTENT  = 10904;    /* 0x2A98 */   /* received content is error */     public static final int ERROR_TUV_VERFAIL    = 10905;   /* 0x2A99 */   /* Verify failure */    /* Error codes of IMTV */     public static final int ERROR_LOGIN_SUCCESS= 11000;     /* 0x2AF8 */   /* 成功 */     public static final int ERROR_LOGIN_NO_LICENSE          = 11001;    /* 0x2AF9 */   /* 試用次數(shù)結(jié)束,用戶需要付費(fèi) */     public static final int ERROR_LOGIN_SESSIONID_INVALID       = 11002;    /* 0x2AFA */   /* SessionId失效,需要重新登錄通行證 */     public static final int ERROR_LOGIN_SESSIONID_ERROR= 11003;     /* 0x2AFB */   /* SessionId為空,或者非法 */     public static final int ERROR_LOGIN_UNLOGIN       = 11004;  /* 0x2AFC */   /* 未登錄通行證 */     public static final int ERROR_LOGIN_INVALID_USER            = 11005;    /* 0x2AFD */   /* 用戶ID無(wú)效 */     public static final int ERROR_LOGIN_INVALID_PWD             = 11006;    /* 0x2AFE */   /* 用戶密碼無(wú)效 */     public static final int ERROR_LOGIN_SYSTEM_ERROR= 11099;    /* 0x2B5B */   /* 系統(tǒng)錯(cuò)誤 */    /* Error codes of HCR */     public static final int ERROR_HCR_GENERAL= 11100;      public static final int ERROR_HCR_RESOURCE_NOT_EXIST        = 11101;      public static final int ERROR_HCR_CREATE= 11102;      public static final int ERROR_HCR_DESTROY= 11103;      public static final int ERROR_HCR_START= 11104;      public static final int ERROR_HCR_APPEND_STROKES= 11105;      public static final int ERROR_HCR_GET_RESULT= 11106;      public static final int ERROR_HCR_SET_PREDICT_DATA= 11107;      public static final int ERROR_HCR_GET_PREDICT_RESULT        = 11108;        /* Error codes of http 12000(0x2EE0) */     public static final int ERROR_HTTP_BASE= 12000; /* 0x2EE0 */    /*Error codes of ISV */     public static final int ERROR_ISV_NO_USER  = 13000; /* 32C8 */    /* the user doesn't exist */    /* Error codes of Lua scripts */     public static final int ERROR_LUA_BASE= 14000;    /* 0x36B0 */     public static final int ERROR_LUA_YIELD= 14001; /* 0x36B1 */     public static final int ERROR_LUA_ERRRUN= 14002;    /* 0x36B2 */     public static final int ERROR_LUA_ERRSYNTAX= 14003; /* 0x36B3 */     public static final int ERROR_LUA_ERRMEM= 14004;    /* 0x36B4 */     public static final int ERROR_LUA_ERRERR= 14005;    /* 0x36B5 */ }

看完上述內(nèi)容,你們掌握J(rèn)ava中怎么通過(guò)調(diào)用jna實(shí)現(xiàn)語(yǔ)音識(shí)別功能的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!

本文名稱:Java中怎么通過(guò)調(diào)用jna實(shí)現(xiàn)語(yǔ)音識(shí)別功能
文章起源:http://muchs.cn/article26/jcjhcg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、App開(kāi)發(fā)、網(wǎng)站策劃、小程序開(kāi)發(fā)手機(jī)網(wǎng)站建設(shè)、移動(dòng)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化