www.pudn.com > ruier_TTS_SR(vc6).rar > Text2Speech.h
#pragma once // CText2Speech 命令目标 /////////////////////////////////////////////////////////////// // active speech engine // #includeextern CComModule _Module; #include #include "sapi.h" #include #include /////////////////////////////////////////////////////////////// // speech // #define WM_TTSEVENT WM_USER+101 /////////////////////////////////////////////////////////////// // text-to-speech class // class CText2Speech { private: public: CText2Speech(); ~CText2Speech(); //初始化与销毁 bool Initialize(HWND hWnd,int nIDDlgItem); void Destroy(); // 播放控制 HRESULT Speak(const WCHAR *pwcs, DWORD dwFlags = SPF_DEFAULT); HRESULT Pause(); HRESULT Resume(); HRESULT Stop(); // 速度 HRESULT SetRate(long lRateAdjust); HRESULT GetRate(long* plRateAdjust); // 音量 HRESULT SetVolume(USHORT usVolume); HRESULT GetVolume(USHORT* pusVolume); //音色 ULONG GetVoiceCount(); HRESULT CText2Speech::SetVoice(HWND hWnd,int nIDDlgItem); // 错误识别 CString GetErrorString(); //处理事件 LRESULT PrcEvent(WPARAM wParam,LPARAM lParam,CWnd* cw,int len); // 接口 CComPtr m_IpVoice; private: HWND hw; CString m_sError; HRESULT initVoiceList(HWND hWnd,int nIDDlgItem); SPVOICESTATUS Stat; };