1 /* Copyright (C) 2012, 2013 Olga Yakovleva <yakovleva.o.v@gmail.com> */ 2 3 /* This program is free software: you can redistribute it and/or modify */ 4 /* it under the terms of the GNU Lesser General Public License as published by */ 5 /* the Free Software Foundation, either version 2.1 of the License, or */ 6 /* (at your option) any later version. */ 7 8 /* This program is distributed in the hope that it will be useful, */ 9 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 10 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ 11 /* GNU Lesser General Public License for more details. */ 12 13 /* You should have received a copy of the GNU Lesser General Public License */ 14 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */ 15 16 #ifndef RHVOICE_SAPI_ISPTTSENGINEIMPL_HPP 17 #define RHVOICE_SAPI_ISPTTSENGINEIMPL_HPP 18 19 #include <windows.h> 20 #include <sapi.h> 21 #include <sapiddk.h> 22 #include <comdef.h> 23 #include <comip.h> 24 #include "core/voice_profile.hpp" 25 #include "com.hpp" 26 #include "tts_base.hpp" 27 28 namespace RHVoice 29 { 30 namespace sapi 31 { 32 class __declspec(uuid("{9f215c97-3d3b-489d-8419-6b9abbf31ec2}")) ISpTTSEngineImpl: 33 public ISpTTSEngine, public ISpObjectWithToken, public tts_base 34 { 35 public: 36 STDMETHOD(Speak)(DWORD dwSpeakFlags,REFGUID rguidFormatId,const WAVEFORMATEX *pWaveFormatEx,const SPVTEXTFRAG *pTextFragList,ISpTTSEngineSite *pOutputSite); 37 STDMETHOD(GetOutputFormat)(const GUID *pTargetFmtId,const WAVEFORMATEX *pTargetWaveFormatEx,GUID *pOutputFormatId,WAVEFORMATEX **ppCoMemOutputWaveFormatEx); 38 STDMETHOD(SetObjectToken)(ISpObjectToken *pToken); 39 STDMETHOD(GetObjectToken)(ISpObjectToken **ppToken); 40 41 protected: get_interface(REFIID riid)42 void* get_interface(REFIID riid) 43 { 44 void* ptr=com::try_primary_interface<ISpTTSEngine>(this,riid); 45 return (ptr?ptr:com::try_interface<ISpObjectWithToken>(this,riid)); 46 } 47 48 private: 49 _COM_SMARTPTR_TYPEDEF(ISpObjectToken,__uuidof(ISpObjectToken)); 50 _COM_SMARTPTR_TYPEDEF(ISpDataKey,__uuidof(ISpDataKey)); 51 ISpObjectTokenPtr token; 52 voice_profile profile; 53 }; 54 } 55 } 56 #endif 57