123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- /******************************************************************************
- * TtsEngObj.h *
- *-------------*
- * This is the header file for the sample CTTSEngObj class definition.
- *------------------------------------------------------------------------------
- * Copyright (c) Microsoft Corporation. All rights reserved.
- *
- ******************************************************************************/
- #ifndef TtsEngObj_h
- #define TtsEngObj_h
-
- //--- Additional includes
- #ifndef __TtsEng_h__
- #include "ttseng.h"
- #endif
-
- #ifndef SPDDKHLP_h
- #include <spddkhlp.h>
- #endif
-
- #ifndef SPCollec_h
- #include <spcollec.h>
- #endif
-
- #include "resource.h"
-
- __declspec( dllexport )int FAR PASCAL _export CompileDictionary(const char *voice, const char *path_log);
-
- //=== Constants ====================================================
-
- //=== Class, Enum, Struct and Union Declarations ===================
-
- //=== Enumerated Set Definitions ===================================
-
- //=== Function Type Definitions ====================================
-
- //=== Class, Struct and Union Definitions ==========================
-
- /*** CSentItem
- * This object is a helper class
- */
- class CSentItem
- {
- public:
- CSentItem() { memset( this, 0, sizeof(*this) ); }
- CSentItem( CSentItem& Other ) { memcpy( this, &Other, sizeof( Other ) ); }
-
- /*--- Data members ---*/
- const SPVSTATE* pXmlState;
- LPCWSTR pItem;
- ULONG ulItemLen;
- ULONG ulItemSrcOffset; // Original source character position
- ULONG ulItemSrcLen; // Length of original source item in characters
- };
-
- typedef CSPList<CSentItem,CSentItem&> CItemList;
-
- /*** CTTSEngObj COM object ********************************
- */
- class ATL_NO_VTABLE CTTSEngObj :
- public CComObjectRootEx<CComMultiThreadModel>,
- public CComCoClass<CTTSEngObj, &CLSID_SampleTTSEngine>,
- public ISpTTSEngine,
- public ISpObjectWithToken
- {
- /*=== ATL Setup ===*/
- public:
- DECLARE_REGISTRY_RESOURCEID(IDR_SAMPLETTSENGINE)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
-
- BEGIN_COM_MAP(CTTSEngObj)
- COM_INTERFACE_ENTRY(ISpTTSEngine)
- COM_INTERFACE_ENTRY(ISpObjectWithToken)
- END_COM_MAP()
-
- /*=== Methods =======*/
- public:
- /*--- Constructors/Destructors ---*/
- HRESULT FinalConstruct();
- void FinalRelease();
-
- /*=== Interfaces ====*/
- public:
- //--- ISpObjectWithToken ----------------------------------
- STDMETHODIMP SetObjectToken( ISpObjectToken * pToken );
- STDMETHODIMP GetObjectToken( ISpObjectToken ** ppToken )
- { return SpGenericGetObjectToken( ppToken, m_cpToken ); }
-
-
- //--- ISpTTSEngine --------------------------------------------
- STDMETHOD(Speak)( DWORD dwSpeakFlags,
- REFGUID rguidFormatId, const WAVEFORMATEX * pWaveFormatEx,
- const SPVTEXTFRAG* pTextFragList, ISpTTSEngineSite* pOutputSite );
- STDMETHOD(GetOutputFormat)( const GUID * pTargetFormatId, const WAVEFORMATEX * pTargetWaveFormatEx,
- GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx );
-
- HRESULT CheckActions( ISpTTSEngineSite* pOutputSite );
- int ProcessFragList(const SPVTEXTFRAG* pTextFragList, wchar_t *pW, ISpTTSEngineSite* pOutputSite, int *n_text);
-
- private:
- /*--- Non interface methods ---*/
-
- /*=== Member Data ===*/
- private:
- CComPtr<ISpObjectToken> m_cpToken;
- HANDLE m_hVoiceData;
- void* m_pVoiceData;
- //--- Voice (word/audio data) list
- // Note: You will probably have something more sophisticated here
- // we are just trying to keep it simple for the example.
- VOICEITEM* m_pWordList;
- ULONG m_ulNumWords;
-
- //--- Working variables to walk the text fragment list during Speak()
- const SPVTEXTFRAG* m_pCurrFrag;
- const WCHAR* m_pNextChar;
- const WCHAR* m_pEndChar;
- ULONGLONG m_ullAudioOff;
- };
-
- #endif //--- This must be the last line in the file
|