/native/external/espeak/platforms/windows/windows_sapi/ttsengobj.h
http://eyes-free.googlecode.com/ · C Header · 121 lines · 65 code · 24 blank · 32 comment · 0 complexity · 148ab83f638f53324b14c6623c8fb947 MD5 · raw file
- /******************************************************************************
- * 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