PageRenderTime 27ms CodeModel.GetById 21ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/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
  1/******************************************************************************
  2* TtsEngObj.h *
  3*-------------*
  4*  This is the header file for the sample CTTSEngObj class definition.
  5*------------------------------------------------------------------------------
  6*  Copyright (c) Microsoft Corporation. All rights reserved.
  7*
  8******************************************************************************/
  9#ifndef TtsEngObj_h
 10#define TtsEngObj_h
 11
 12//--- Additional includes
 13#ifndef __TtsEng_h__
 14#include "ttseng.h"
 15#endif
 16
 17#ifndef SPDDKHLP_h
 18#include <spddkhlp.h>
 19#endif
 20
 21#ifndef SPCollec_h
 22#include <spcollec.h>
 23#endif
 24
 25#include "resource.h"
 26
 27__declspec( dllexport )int FAR PASCAL  _export CompileDictionary(const char *voice, const char *path_log);
 28
 29//=== Constants ====================================================
 30
 31//=== Class, Enum, Struct and Union Declarations ===================
 32
 33//=== Enumerated Set Definitions ===================================
 34
 35//=== Function Type Definitions ====================================
 36
 37//=== Class, Struct and Union Definitions ==========================
 38
 39/*** CSentItem
 40*   This object is a helper class
 41*/
 42class CSentItem
 43{
 44  public:
 45    CSentItem() { memset( this, 0, sizeof(*this) ); }
 46    CSentItem( CSentItem& Other ) { memcpy( this, &Other, sizeof( Other ) ); }
 47
 48  /*--- Data members ---*/
 49    const SPVSTATE* pXmlState;
 50    LPCWSTR         pItem;
 51    ULONG           ulItemLen;
 52    ULONG           ulItemSrcOffset;        // Original source character position
 53    ULONG           ulItemSrcLen;           // Length of original source item in characters
 54};
 55
 56typedef CSPList<CSentItem,CSentItem&> CItemList;
 57
 58/*** CTTSEngObj COM object ********************************
 59*/
 60class ATL_NO_VTABLE CTTSEngObj : 
 61	public CComObjectRootEx<CComMultiThreadModel>,
 62	public CComCoClass<CTTSEngObj, &CLSID_SampleTTSEngine>,
 63	public ISpTTSEngine,
 64    public ISpObjectWithToken
 65{
 66  /*=== ATL Setup ===*/
 67  public:
 68    DECLARE_REGISTRY_RESOURCEID(IDR_SAMPLETTSENGINE)
 69    DECLARE_PROTECT_FINAL_CONSTRUCT()
 70
 71    BEGIN_COM_MAP(CTTSEngObj)
 72	    COM_INTERFACE_ENTRY(ISpTTSEngine)
 73	    COM_INTERFACE_ENTRY(ISpObjectWithToken)
 74    END_COM_MAP()
 75
 76  /*=== Methods =======*/
 77  public:
 78    /*--- Constructors/Destructors ---*/
 79    HRESULT FinalConstruct();
 80    void FinalRelease();
 81
 82  /*=== Interfaces ====*/
 83  public:
 84    //--- ISpObjectWithToken ----------------------------------
 85    STDMETHODIMP SetObjectToken( ISpObjectToken * pToken );
 86    STDMETHODIMP GetObjectToken( ISpObjectToken ** ppToken )
 87        { return SpGenericGetObjectToken( ppToken, m_cpToken ); }
 88
 89
 90    //--- ISpTTSEngine --------------------------------------------
 91    STDMETHOD(Speak)( DWORD dwSpeakFlags,
 92                      REFGUID rguidFormatId, const WAVEFORMATEX * pWaveFormatEx,
 93                      const SPVTEXTFRAG* pTextFragList, ISpTTSEngineSite* pOutputSite );
 94    STDMETHOD(GetOutputFormat)( const GUID * pTargetFormatId, const WAVEFORMATEX * pTargetWaveFormatEx,
 95                                GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx );
 96
 97    HRESULT CheckActions( ISpTTSEngineSite* pOutputSite );
 98	int ProcessFragList(const SPVTEXTFRAG* pTextFragList, wchar_t *pW, ISpTTSEngineSite* pOutputSite, int *n_text);
 99
100  private:
101    /*--- Non interface methods ---*/
102
103  /*=== Member Data ===*/
104  private:
105    CComPtr<ISpObjectToken> m_cpToken;
106    HANDLE                  m_hVoiceData;
107    void*                   m_pVoiceData;
108    //--- Voice (word/audio data) list
109    //  Note: You will probably have something more sophisticated here
110    //        we are just trying to keep it simple for the example.
111    VOICEITEM*          m_pWordList;
112    ULONG               m_ulNumWords;
113
114    //--- Working variables to walk the text fragment list during Speak()
115    const SPVTEXTFRAG*  m_pCurrFrag;
116    const WCHAR*        m_pNextChar;
117    const WCHAR*        m_pEndChar;
118    ULONGLONG           m_ullAudioOff;
119};
120
121#endif //--- This must be the last line in the file