|
| 1 | + |
| 2 | +#ifndef __DSPOTTERSDK_API_H |
| 3 | +#define __DSPOTTERSDK_API_H |
| 4 | + |
| 5 | +#if defined(_WIN32) |
| 6 | + #ifdef DSpotterDll_EXPORTS |
| 7 | + #define DSPDLL_API __declspec(dllexport) |
| 8 | + #endif |
| 9 | +#endif |
| 10 | + |
| 11 | +#ifndef DSPDLL_API |
| 12 | +#define DSPDLL_API |
| 13 | +#endif |
| 14 | + |
| 15 | +#include "base_types.h" |
| 16 | +#include "DSpotterSDKApi_Const.h" |
| 17 | + |
| 18 | +#ifdef __cplusplus |
| 19 | +extern "C"{ |
| 20 | +#endif |
| 21 | + |
| 22 | +// lpbyCYBase(IN): The background model, contents of CYBase.mod. |
| 23 | +// lppbyModel(IN): The command model. |
| 24 | +// nMaxTime(IN): The maximum buffer length in number of frames for keeping the status of commands. |
| 25 | +// lpbyMemPool(IN/OUT): Memory buffer for the recognizer. |
| 26 | +// nMemSize(IN): Size in bytes of the memory buffer lpbyMemPool. |
| 27 | +// lpbyPreserve(IN/OUT): Preserve param. |
| 28 | +// nPreserve(IN): Preserve param. |
| 29 | +// pnErr(OUT): DSPOTTER_SUCCESS indicates success, else error code. It can be NULL. |
| 30 | +// Return: a recognizer handle or NULL |
| 31 | +DSPDLL_API HANDLE DSpotter_Init_Multi(BYTE *lpbyCYBase, BYTE *lppbyModel[], INT nNumModel, INT nMaxTime, BYTE *lpbyMemPool, INT nMemSize, BYTE *lpbyPreserve, INT nPreserve, INT *pnErr); |
| 32 | + |
| 33 | +// Purpose: Destroy a recognizer (free resources) |
| 34 | +// hDSpotter(IN): a handle of the recognizer |
| 35 | +// Return: Success or error code |
| 36 | +DSPDLL_API INT DSpotter_Release(HANDLE hDSpotter); |
| 37 | + |
| 38 | +// Purpose: Reset recognizer |
| 39 | +// hDSpotter(IN): a handle of the recognizer |
| 40 | +// Return: Success or error code |
| 41 | +DSPDLL_API INT DSpotter_Reset(HANDLE hDSpotter); |
| 42 | + |
| 43 | +// Purpose: Transfer voice samples to the recognizer for recognizing. |
| 44 | +// hDSpotter(IN): a handle of the recognizer |
| 45 | +// lpsSample(IN): the pointer of voice data buffer |
| 46 | +// nNumSample(IN): the number of voice data (a unit is a short, we prefer to add 480 samples per call) |
| 47 | +// Return: "DSPOTTER_ERR_NeedMoreSample" indicates call this function again, else call DSpotter_GetResult(...) |
| 48 | +DSPDLL_API INT DSpotter_AddSample(HANDLE hDSpotter, SHORT *lpsSample, INT nNumSample); |
| 49 | + |
| 50 | +// Purpose: Get recognition results. |
| 51 | +// hDSpotter(IN): a handle of the recognizer |
| 52 | +// Return: the command ID. It is 0 based |
| 53 | +DSPDLL_API INT DSpotter_GetResult(HANDLE hDSpotter); |
| 54 | +DSPDLL_API INT DSpotter_GetResultEPD(HANDLE hDSpotter, INT *pnWordDura, INT *pnEndDelay); |
| 55 | +DSPDLL_API INT DSpotter_GetResultScore(HANDLE hDSpotter, INT *pnGMM, INT *pnSG, INT *pnFIL); |
| 56 | + |
| 57 | +// Purpose: Get Cmd energy(RMS) |
| 58 | +// hDSpotter(IN): a handle of the recognizer |
| 59 | +// Return: Value or error code |
| 60 | +DSPDLL_API INT DSpotter_GetCmdEnergy(HANDLE hDSpotter); |
| 61 | + |
| 62 | +//Model Param |
| 63 | +DSPDLL_API INT DSpotter_GetNumWord(BYTE *lpbyModel); |
| 64 | + |
| 65 | +DSPDLL_API INT DSpotter_GetMemoryUsage_Multi(BYTE *lpbyCYBase, BYTE *lppbyModel[], INT nNumModel, INT nMaxTime); |
| 66 | + |
| 67 | +DSPDLL_API const char *DSpotter_VerInfo(void); |
| 68 | + |
| 69 | + |
| 70 | +/************************************************************************/ |
| 71 | +// Threshold Adjust API |
| 72 | +/************************************************************************/ |
| 73 | +// Purpose: Set model rejection level |
| 74 | +// hDSpotter(IN): a handle of the recognizer |
| 75 | +// nRejectionLevel(IN): rejection level |
| 76 | +// Return: Success or error code |
| 77 | +DSPDLL_API INT DSpotter_SetRejectionLevel(HANDLE hDSpotter, INT nRejectionLevel); |
| 78 | + |
| 79 | +// Purpose: Set model SG rejection level |
| 80 | +// hDSpotter(IN): a handle of the recognizer |
| 81 | +// nRejectionLevel(IN): SG rejection level |
| 82 | +// Return: Success or error code |
| 83 | +DSPDLL_API INT DSpotter_SetSgLevel(HANDLE hDSpotter, INT nRejectionLevel); |
| 84 | + |
| 85 | +// Purpose: Set model FIL rejection level |
| 86 | +// hDSpotter(IN): a handle of the recognizer |
| 87 | +// nRejectionLevel(IN): FIL rejection level |
| 88 | +// Return: Success or error code |
| 89 | +DSPDLL_API INT DSpotter_SetFilLevel(HANDLE hDSpotter, INT nRejectionLevel); |
| 90 | + |
| 91 | +// Purpose: Set engine response time |
| 92 | +// hDSpotter(IN): a handle of the recognizer |
| 93 | +// nResponseTime(IN): response time |
| 94 | +// Return: Success or error code |
| 95 | +DSPDLL_API INT DSpotter_SetResponseTime(HANDLE hDSpotter, INT nResponseTime); |
| 96 | + |
| 97 | +// Purpose: Set engine energy threshold |
| 98 | +// hDSpotter(IN): a handle of the recognizer |
| 99 | +// nEnergyTH(IN): energy threshold(RMS) |
| 100 | +// Return: Success or error code |
| 101 | +DSPDLL_API INT DSpotter_SetEnergyTH(HANDLE hDSpotter, INT nEnergyTH); |
| 102 | + |
| 103 | +// Purpose: Get engine energy threshold |
| 104 | +// hDSpotter(IN): a handle of the recognizer |
| 105 | +// Return: energy threshold(RMS) or error code |
| 106 | +DSPDLL_API INT DSpotter_GetEnergyTH(HANDLE hDSpotter); |
| 107 | + |
| 108 | +// Purpose: Set Cmd response time |
| 109 | +// hDSpotter(IN): a handle of the recognizer |
| 110 | +// nCmdIdx(IN): the command ID. It is 0 based |
| 111 | +// nResponseTime(IN): response time |
| 112 | +// Return: Success or error code |
| 113 | +DSPDLL_API INT DSpotter_SetCmdResponseTime(HANDLE hDSpotter, INT nCmdIdx, INT nResponseTime); |
| 114 | + |
| 115 | +// Purpose: Set Cmd reward |
| 116 | +// hDSpotter(IN): a handle of the recognizer |
| 117 | +// nCmdIdx(IN): the command ID. It is 0 based |
| 118 | +// nReward(IN): reward |
| 119 | +// Return: Success or error code |
| 120 | +DSPDLL_API INT DSpotter_SetCmdReward(HANDLE hDSpotter, INT nCmdIdx, INT nReward); |
| 121 | + |
| 122 | +// Purpose: Get Cmd response time |
| 123 | +// hDSpotter(IN): a handle of the recognizer |
| 124 | +// nCmdIdx(IN): the command ID. It is 0 based |
| 125 | +// Return: response time or error code |
| 126 | +DSPDLL_API INT DSpotter_GetCmdResponseTime(HANDLE hDSpotter, INT nCmdIdx); |
| 127 | + |
| 128 | +// Purpose: Get Cmd reward |
| 129 | +// hDSpotter(IN): a handle of the recognizer |
| 130 | +// nCmdIdx(IN): the command ID. It is 0 based |
| 131 | +// *pnErr(IN/Out): error code |
| 132 | +// Return: reward |
| 133 | +DSPDLL_API INT DSpotter_GetCmdReward(HANDLE hDSpotter, INT nCmdIdx, INT *pnErr); |
| 134 | + |
| 135 | +#ifdef __cplusplus |
| 136 | +} |
| 137 | +#endif |
| 138 | + |
| 139 | +#endif // __DSPOTTERSDK_API_H |
0 commit comments