⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ifly_tts.h

📁 TTS语音开发示例
💻 H
📖 第 1 页 / 共 2 页
字号:
	TTSCHAR		szUserName[TTS_USER_NAME_MAX];			/* [in]  User name */
	TTSCHAR		szCompanyName[TTS_COMPANY_NAME_MAX];	/* [in]  Company name */
	TTSCHAR		szSerialNumber[TTS_SERIAL_NO_MAX];		/* [in]  Serial Number has form as "xxxxxx-xxxxxx-xxxxxx" */
	TTSCHAR		szServiceUID[TTS_SERVICE_UID_MAX];		/* [in]  TTS Sevice sign */
	TTSCHAR		szProductName[TTS_PRODUCT_NAME_MAX];	/* [in]  Client program name */
	TTSCHAR		szTTSServerIP[TTS_IP_MAXLEN];			/* [in]  The IP address of TTS Server */
	TTSDWORD	dwServiceID;							/* [out] TTS Service ID return by Service Module */
	TTSDWORD	dwErrorCode;							/* [out] The error code return by Service Module */
	TTSBOOL		bSetParams;								/* [in]	 Determine whether the following setting is valid or not */
	TTSINT16	nCodePage;								/* [in]  Default chinese codepage type */
	TTSINT16	nVID;									/* [in]  Default TTS Voice Lib */
	TTSINT16	nAudioFmt;								/* [in]  Default audio data format */
	TTSINT16	nSpeed;									/* [in]  Default speed */
	TTSINT16	nVolume;								/* [in]  Default volume */
	TTSINT16	nPitch;									/* [in]	 Default pitch */
	TTSINT16	nAudioHeadFmt;							/* [in]  Default audio head fmt */
	TTSINT16	nTextType;								/* [in]	 Default text type */
	TTSDWORD	dwReserved[TTS_RESERVED_LEN];			/* [in/out] Reserved field, set it to zero */
} TTSConnectStruct, *PTTSConnectStruct;

/* The structure used in synthesizing process */
typedef struct 
{
	TTSDWORD	dwServiceID;	/* [in]  Connect's service ID */
	TTSDWORD	dwInBufSize;	/* [in]  Text buffer size */
    TTSDWORD	dwOutBufSize;	/* [out] Output audio data length */
    TTSDWORD	dwInFlags;		/* [in]  Input data flag */
	TTSDWORD	dwOutFlags;		/* [out] Output data flag */
	TTSWORD		wAudioHeadLen;	/* [out] Output audio data head length */
	TTSDWORD	dwCurStart;		/* [out] The start position of current synthesizing text in szInBuf */
	TTSDWORD	dwCurEnd;		/* [out] The end position of current synthesizing text in szInBuf */
	TTSDWORD	dwErrorCode ;	/* [out] The error code returned by service module */
	
	TTSCHAR		*szInBuf;		/* [in]  Input text buffer pointer, malloced by caller */
	PTTSVOID	pOutBuf;		/* [out] Output audio data pointer, malloced by TTS service module */
	PTTSCHAR	pszPYBuf;		/* [out] Output PinYin string buf, malloced by TTS service mudule */

	TTSDWORD	dwReserved;		/* [in/out]Reserved field */
} TTSData, *PTTSData;

/*
 * The prototype of callback funtions used in synthesizing process
 */

/* Synthesize data process callback */
typedef TTSRETVAL (*TTSPROCESSCB)(HTTSINSTANCE hTTSInst, PTTSData pTTSData, TTSINT32 lParam, PTTSVOID pUserData);

/* Book mark event id */
#define TTS_EVENT_MARK			1
/* Synthesize events callback */
typedef TTSRETVAL (*TTSEVENTCB)(HTTSINSTANCE hTTSInst, PTTSData pTTSData, TTSINT16 nNotify, TTSINT32 lParam, PTTSVOID pUserData);

/* Callback data structure */
typedef struct
{
    TTSINT32		nNumCallbacks;      /* [in] Number of callback functions */
    TTSPROCESSCB	pfnTTSProcessCB;	/* [in] Synthesizing process callback function */
    TTSEVENTCB		pfnTTSEventCB;		/* [in] Event notifies in synthesizing process */
} TTSCallBacks, *PTTSCallBacks;

typedef struct
{
    /* [out] Count of available VIDs */
    TTSINT32        nCount;
    /* [out] List of available VID Indexs */
    TTSDWORD        dwVIDIndexList[TTS_AVID_MAXAVAVIDCOUNT];     
    /* [out] List of available VID ResourceIDs */
    TTSDWORD        dwVIDResList[TTS_AVID_MAXAVAVIDCOUNT];     
} TTSAvailableVIDs;

#pragma pack()

/*==========================================================================
	Declaration of Interface Funtions
 ==========================================================================*/

/***************************************************************************
 * Funtion Name		: TTSInitialize
 * Parameters		: None
 * Descrption		: Global initialize TTS, it is the first function to be called
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSInitialize();
typedef TTSRETVAL (*Proc_TTSInitialize)();

/**************************************************************************
 * Funtion Name		: TTSUninitialize
 * Parameters		: None
 * Descrption		: Global uninitialize TTS, it is the last function to be called
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSUninitialize();
typedef TTSRETVAL (*Proc_TTSUninitialize)();

/**************************************************************************
 * Funtion Name		: TTSConnect
 * Parameters		: PTTSConnectStruct pConnect --- [in/out] The connect structuture
 * Descrption		: TTSConnect create a instance to TTS Core service
 * Return Value		: Return a handle to the TTS Instance, otherwise return NULL.
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
HTTSINSTANCE TTSLIBAPI TTSConnect(PTTSConnectStruct pConnect);
typedef HTTSINSTANCE (*Proc_TTSConnect)(PTTSConnectStruct pConnect);

/**************************************************************************
 * Funtion Name		: TTSDisconnect
 * Parameters		: HTTSINSTANCE hTTSInst --- [in] The TTS handle returned by TTSConnect funtion
 * Descrption		: TTSDiconnect destroy the connect to TTS Service Module
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSDisconnect(HTTSINSTANCE hTTSInst);
typedef TTSRETVAL (*Proc_TTSDisconnect)(HTTSINSTANCE hTTSInst);

/**************************************************************************
 * Funtion Name		: TTSSynthText
 * Parameters		: HTTSINSTANCE hTTSInst --- [in] The TTS handle returned by TTSConnect funtion
 *					: PTTSData --- [in/out] Pointer to TTSData structure
 * Descrption		: Synthesize some text to memory
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSSynthText(HTTSINSTANCE hTTSInst, PTTSData pTTSData);
typedef TTSRETVAL (*Proc_TTSSynthText)(HTTSINSTANCE hTTSInst, PTTSData pTTSData);

/**************************************************************************
 * Funtion Name		: TTSFetchNext
 * Parameters		: HTTSINSTANCE hTTSInst --- [in] The TTS handle returned by TTSConnect funtion
 * 					: PTTSData --- [in/out] Pointer to TTSData structure
 * Descrption		: Fetch the audio data remains until OutFlag is TTS_DATA_FLAG_END
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSFetchNext(HTTSINSTANCE hTTSInst, PTTSData pTTSData);
typedef TTSRETVAL (*Proc_TTSFetchNext)(HTTSINSTANCE hTTSInst, PTTSData pTTSData);

/**************************************************************************
 * Funtion Name		: TTSSynthTextEx
 * Parameters		: HTTSINSTANCE hTTSInst --- [in] The TTS handle returned by TTSConnect funtion
 *					: PTTSData --- [in/out] Pointer to TTSData structure
 *					: pTTSCallBacks --- [in] Pointer to TTSCallbacks structure
 * 					: bASynch --- [in] The synchesize mode is asynchronous or not
 *					: PTTSVOID pUserData --- [in] User defined data
 * Descrption		: Synthesize some text to memory
 *					:
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSSynthTextEx(HTTSINSTANCE hTTSInst, PTTSData pTTSData, PTTSCallBacks pTTSCallBacks, TTSBOOL bASynch, PTTSVOID pUserData);
typedef TTSRETVAL (*Proc_TTSSynthTextEx)(HTTSINSTANCE hTTSInst, PTTSData pTTSData, PTTSCallBacks pTTSCallBacks, TTSBOOL bASynch, PTTSVOID pUserData);

/**************************************************************************
 * Funtion Name		: TTSClean
 * Parameters		: HTTSINSTANCE hTTSInst --- [in] The TTS handle returned by TTSConnect funtion
 * Descrption		: Reset the TTS status to initial status, free memory malloced in synthesizing process
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSClean(HTTSINSTANCE hTTSInst);
typedef TTSRETVAL (*Proc_TTSClean)(HTTSINSTANCE hTTSInst);

/**************************************************************************
 * Funtion Name		: TTSGetSynthParam
 * Parameters		: HTTSINSTANCE hTTSInst --- [in] The TTS instance handle return by TTSConnect
					: TTSDWORD dwParamType --- [in] Parameter type
					: TTSDWORD *pdwParam --- [in/out] Paremeter value
 * Descrption		: Get the parameters of the TTS system
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSGetSynthParam(HTTSINSTANCE hTTSInst, TTSDWORD dwParamType, TTSINT32 *pnParam);
typedef TTSRETVAL (*Proc_TTSGetSynthParam)(HTTSINSTANCE hTTSInst, TTSDWORD dwParamType, TTSINT32 *pnParam);

/**************************************************************************
 * Funtion Name		: TTSSetSynthParam
 * Parameters		: HTTSINSTANCE hTTSInst --- [in] The TTS instance handle return by TTSConnect
					: TTSDWORD dwParamType --- [in] Parameter type
					: TTSDWORD dwParam --- [in] Paremeter value
 * Descrption		: Set the parameters of the TTS system
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSSetSynthParam(HTTSINSTANCE hTTSInst, TTSDWORD dwParamType, TTSINT32 nParam);
typedef TTSRETVAL (*Proc_TTSSetSynthParam)(HTTSINSTANCE hTTSInst, TTSDWORD dwParamType, TTSINT32 nParam);

/**************************************************************************
 * Funtion Name		: TTSLoadUserLib
 * Parameters		: HTTSINSTANCE hTTSInst --- [in] The TTS instance handle return by TTSConnect
 *					: HTTSUSERLIB* lphUserLib --- [out] Pointer to the user defined library handle
 *					: PTTSVOID lpUserLibPath --- [in] User library
 *					: TTSINT32 nSize --- [in] sizeof lpUserLibPath data
 * Descrption		: Load a user defined library to TTS system
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSLoadUserLib(HTTSINSTANCE hTTSInst, HTTSUSERLIB* lphUserLib, PTTSVOID pUserLib, TTSINT32 nSize);
typedef TTSRETVAL (*Proc_TTSLoadUserLib)(HTTSINSTANCE hTTSInst, HTTSUSERLIB* lphUserLib, PTTSVOID pUserLib, TTSINT32 nSize);


/**************************************************************************
 * Funtion Name		: TTSUnloadUserLib
 * Parameters		: HTTSINSTANCE hTTSInst --- [in] The TTS instance handle return by TTSConnect
 *					: HTTSUSERLIB hUserLib --- [in] The labrary handle returned by TTSLoadUserLib
 * Descrption		: Remove a user defined library to TTS system
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI TTSUnloadUserLib(HTTSINSTANCE hTTSInst, HTTSUSERLIB hUserLib);
typedef TTSRETVAL (*Proc_TTSUnloadUserLib)(HTTSINSTANCE hTTSInst, HTTSUSERLIB hUserLib);

/*==========================================================================
	Accessorial Functions
 ===========================================================================*/

/**************************************************************************
 * Funtion Name		: TTSFormatMessage
 * Parameters		: TTSDWORD dwTTSErrCode --- [in] TTS error code
 *					: PTTSVOID pMsgBuf --- [out] Pointer to a buffer(malloced by user) 
 *					: TTSINT16* pnSize --- [in/out] message buffer length
 * Descrption		: Format a TTS error code to error description string
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
**************************************************************************/
TTSRETVAL TTSLIBAPI TTSFormatMessage(TTSDWORD dwTTSErrCode, PTTSVOID pMsgBuf, TTSINT16* pnSize);
typedef TTSRETVAL (*Proc_TTSFormatMessage)(TTSDWORD dwTTSErrCode, PTTSVOID pMsgBuf, TTSINT16* pnSize);

/**************************************************************************
 * Funtion Name		: TTSAbout
 * Parameters		: TTSDWORD dwAboutType --- [in] TTS About type
 *					: PTTSVOID pAboutContent --- [out] TTS About content
 *					: TTSINT16* nSize --- [in/out] content size
 * Descrption		: Get TTS System information of current version
 * Return Value		: Return 0 in success, otherwise return error code
 * Error Codes		: N
 * Exception Handle	: N
***************************************************************************/
TTSRETVAL TTSLIBAPI	TTSAbout(TTSDWORD dwAboutType, PTTSVOID pAboutContent, TTSINT16* pnSize);
typedef TTSRETVAL (*Proc_TTSAbout)(TTSDWORD dwAboutType, PTTSVOID pAboutContent, TTSINT16* pnSize);

#ifdef __cplusplus
} /*extern "C"*/
#endif

#endif /*#ifndef IFLY_TTS_H*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -