00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00048 #ifndef COMSTL_INCL_COMSTL_SPEECH_HPP_SAPI_UTIL
00049 #define COMSTL_INCL_COMSTL_SPEECH_HPP_SAPI_UTIL
00050
00051
00052 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00053 # define COMSTL_VER_COMSTL_SPEECH_HPP_SAPI_UTIL_MAJOR 1
00054 # define COMSTL_VER_COMSTL_SPEECH_HPP_SAPI_UTIL_MINOR 0
00055 # define COMSTL_VER_COMSTL_SPEECH_HPP_SAPI_UTIL_REVISION 4
00056 # define COMSTL_VER_COMSTL_SPEECH_HPP_SAPI_UTIL_EDIT 6
00057 #endif
00058
00059
00060
00061
00062
00063 #ifndef COMSTL_INCL_COMSTL_H_COMSTL
00064 # include <comstl/comstl.h>
00065 #endif
00066 #ifndef COMSTL_INCL_UTIL_HPP_CREATION_FUNCTIONS
00067 # include <comstl/util/creation_functions.hpp>
00068 #endif
00069 #ifndef COMSTL_INCL_UTIL_HPP_INTERFACE_TRAITS
00070 # include <comstl/util/interface_traits.hpp>
00071 #endif
00072 #ifndef STLSOFT_INCL_STLSOFT_CONVERSION_HPP_CHAR_CONVERSIONS
00073 # include <stlsoft/conversion/char_conversions.hpp>
00074 #endif
00075 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
00076 # include <stlsoft/shims/access/string.hpp>
00077 #endif
00078 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ATTRIBUTE_HPP_GET_PTR
00079 # include <stlsoft/shims/attribute/get_ptr.hpp>
00080 #endif
00081 #ifndef STLSOFT_INCL_STLSOFT_SMARTPTR_HPP_REF_PTR
00082 # include <stlsoft/smartptr/ref_ptr.hpp>
00083 #endif
00084
00085 #ifdef COMSTL_SPEECH_SAPI_UTIL_USE_MS_SAPI_HEADERS
00086 # include <sapi.h>
00087 #endif
00088
00089
00090
00091
00092
00093 #if !defined(_COMSTL_NO_NAMESPACE) && \
00094 !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00095 # if defined(_STLSOFT_NO_NAMESPACE)
00096
00097 namespace comstl
00098 {
00099 # else
00100
00101
00102 namespace stlsoft
00103 {
00104
00105 namespace comstl_project
00106 {
00107
00108 # endif
00109 #endif
00110
00111
00112
00113
00114
00115 #ifndef COMSTL_SPEECH_SAPI_UTIL_USE_MS_SAPI_HEADERS
00116
00119 struct ISpNotifySource_ : public IUnknown
00120 {
00121 virtual void ISpNotifySource_1() = 0;
00122 virtual void ISpNotifySource_2() = 0;
00123 virtual void ISpNotifySource_3() = 0;
00124 virtual void ISpNotifySource_4() = 0;
00125 virtual void ISpNotifySource_5() = 0;
00126 virtual void ISpNotifySource_6() = 0;
00127 virtual void ISpNotifySource_7() = 0;
00128 };
00129
00132 struct ISpEventSource_ : public ISpNotifySource_
00133 {
00134 virtual void ISpEventSource_1() = 0;
00135 virtual void ISpEventSource_2() = 0;
00136 virtual void ISpEventSource_3() = 0;
00137 };
00138
00141 struct ISpVoice_ : public ISpEventSource_
00142 {
00143 virtual void ISpVoice_1() = 0;
00144 virtual void ISpVoice_2() = 0;
00145 virtual void ISpVoice_3() = 0;
00146 virtual void ISpVoice_4() = 0;
00147 virtual void ISpVoice_5() = 0;
00148 virtual void ISpVoice_6() = 0;
00149 virtual void ISpVoice_7() = 0;
00150
00151 virtual HRESULT STDMETHODCALLTYPE Speak(
00152 const WCHAR *pwcs,
00153 DWORD dwFlags,
00154 ULONG *pulStreamNumber) = 0;
00155
00156 virtual void ISpVoice_9() = 0;
00157 virtual void ISpVoice_10() = 0;
00158 virtual void ISpVoice_11() = 0;
00159 virtual void ISpVoice_12() = 0;
00160 virtual void ISpVoice_13() = 0;
00161 virtual void ISpVoice_14() = 0;
00162 virtual void ISpVoice_15() = 0;
00163 virtual void ISpVoice_16() = 0;
00164 virtual void ISpVoice_17() = 0;
00165 virtual void ISpVoice_18() = 0;
00166 virtual void ISpVoice_19() = 0;
00167
00168 virtual HRESULT STDMETHODCALLTYPE WaitUntilDone(
00169 ULONG msTimeout) = 0;
00170
00171 virtual void ISpVoice_21() = 0;
00172 virtual void ISpVoice_22() = 0;
00173
00174 virtual HANDLE STDMETHODCALLTYPE SpeakCompleteEvent( void) = 0;
00175
00176 virtual void ISpVoice_24() = 0;
00177 virtual void ISpVoice_25() = 0;
00178 };
00179
00182 enum SPEAKFLAGS
00183 {
00184 SPF_DEFAULT = 0,
00185 SPF_ASYNC = 1L << 0,
00186 SPF_PURGEBEFORESPEAK = 1L << 1,
00187 SPF_IS_FILENAME = 1L << 2,
00188 SPF_IS_XML = 1L << 3,
00189 SPF_IS_NOT_XML = 1L << 4,
00190 SPF_PERSIST_XML = 1L << 5,
00191 SPF_NLP_SPEAK_PUNC = 1L << 6,
00192 SPF_NLP_MASK = SPF_NLP_SPEAK_PUNC,
00193 SPF_VOICE_MASK = SPF_ASYNC | SPF_PURGEBEFORESPEAK | SPF_IS_FILENAME | SPF_IS_XML | SPF_IS_NOT_XML | SPF_NLP_MASK | SPF_PERSIST_XML,
00194 SPF_UNUSED_FLAGS = ~SPF_VOICE_MASK
00195 };
00196
00197 # define CLSID_SpVoice comstl_ns_qual(CLSID_SpVoice_)
00198 # define ISpVoice comstl_ns_qual(ISpVoice_)
00199
00200 namespace
00201 {
00202
00203 const CLSID CLSID_SpVoice_ = { 0x96749377, 0x3391, 0x11D2, { 0x9E, 0xE3, 0x00, 0xC0, 0x4F, 0x79, 0x73, 0x96 } };
00204 const IID IID_ISpVoice_ = { 0x6C44DF74, 0x72B9, 0x4992, { 0xA1, 0xEC, 0xEF, 0x99, 0x6E, 0x04, 0x22, 0xD4 } };
00205
00206 }
00207
00208
00209 COMSTL_IID_TRAITS_DEFINE__(ISpVoice_, ISpVoice_)
00210
00211
00212 #endif
00213
00214
00215
00216
00217
00218 namespace impl
00219 {
00220 inline HRESULT sapi_speak_(ISpVoice* voice, wchar_t const* words, DWORD flags)
00221 {
00222 COMSTL_ASSERT(NULL != voice);
00223
00224 ULONG streamNumber;
00225
00226 return voice->Speak(words, flags, &streamNumber);
00227 }
00228 inline HRESULT sapi_speak_(ISpVoice* voice, char const* words, DWORD flags)
00229 {
00230 return sapi_speak_(voice, stlsoft_ns_qual(a2w)(words), flags);
00231 }
00232
00233 }
00234
00235 template< ss_typename_param_k V
00236 , ss_typename_param_k S
00237 >
00238 inline HRESULT sapi_speak(V& voice, S const& words, DWORD flags)
00239 {
00240 return impl::sapi_speak_(stlsoft_ns_qual(get_ptr)(voice), stlsoft_ns_qual(c_str_ptr)(words), flags);
00241 }
00242
00243 inline HRESULT sapi_create(stlsoft_ns_qual(ref_ptr)<ISpVoice>& voice)
00244 {
00245 return comstl::co_create_instance(CLSID_SpVoice, voice);
00246 }
00247
00248
00249
00250 #ifndef _COMSTL_NO_NAMESPACE
00251 # if defined(_STLSOFT_NO_NAMESPACE) || \
00252 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00253 }
00254 # else
00255 }
00256 }
00257 # endif
00258
00259 # ifndef COMSTL_SPEECH_SAPI_UTIL_USE_MS_SAPI_HEADERS
00260
00261 using ::comstl::SPF_DEFAULT;
00262 using ::comstl::SPF_ASYNC;
00263 using ::comstl::SPF_PURGEBEFORESPEAK;
00264 using ::comstl::SPF_IS_FILENAME;
00265 using ::comstl::SPF_IS_XML;
00266 using ::comstl::SPF_IS_NOT_XML;
00267 using ::comstl::SPF_PERSIST_XML;
00268 using ::comstl::SPF_NLP_SPEAK_PUNC;
00269 using ::comstl::SPF_NLP_MASK;
00270 using ::comstl::SPF_VOICE_MASK;
00271 using ::comstl::SPF_UNUSED_FLAGS;
00272
00273 # endif
00274
00275 #endif
00276
00277
00278
00279 #endif
00280
00281